LuaAPI.wiki
changeset 328 fdc71ac8db83
parent 313 f7930ab43523
child 346 5f322c85c0e0
--- a/LuaAPI.wiki	Mon Jun 10 11:43:07 2013 +0000
+++ b/LuaAPI.wiki	Tue Jun 11 21:05:44 2013 +0000
@@ -722,6 +722,57 @@
 
 <blockquote>This function will switch to the hedgehog with the specified Uid.</blockquote>
 
+=== <tt>!SendStat(TStatInfoType,statMessage[,teamName])</tt> (0.9.20) ===
+
+<blockquote>Exposes the uIO SendStat to the lua scripts. Use it to produce custom stat pages.
+
+<b>Examples:</b>
+
+<code lang="lua">
+-- will automatically change the health icon to a star
+SendStat('siGraphTitle','Custom Graph Title')
+SendStat('siGameResult','Winner is Team A!')
+SendStat('siCustomAchievement','This is a custom mesasge posted in the Details section!')
+-- Changes the word kill to Point, call it just before sending kills/score for each hog
+-- in case you want to change the word i.e. print Point or Points
+SendStat('siPointType','Point')
+-- if above function call was not used it will print 3 kills for teamName in Ranking section.
+-- if it was used it will print 3 Point for teamName in Ranking section.
+SendStat('siPlayerKills','3',teamName)
+-- call siClanHealth to send the "value" of a clan that will be used for the graph creation
+-- a good idea is to call it always for every hog by using the runOnGears(function)
+-- in normal mode "value" represents clan health
+SendStat('siClanHealth', "100",teamName)
+-- most hedgehogs killed in a round (hedgeHogName is who killed them)
+SendStat('siMaxStepKills', "1 hedgeHogName (teamName)")
+-- hog with most damage inflicted to his own team
+SendStat('siMaxTeamDamage', "100 hedgeHogName")
+-- total number of killed hedgehogs
+SendStat('siKilledHHs', "1")
+-- increases the wins of local teams in case the given number is greater than 0
+SendStat('siTeamStats', "teamName:0:")
+-- best shot award
+SendStat('siMaxStepDamage', "30 hedgeHogName (teamName)")
+-- team with most kills of own hedgehogs
+SendStat('siMaxStepDamage', "2 teamName")
+-- team with most skips
+SendStat('siMaxTurnSkips', "3 teamName")
+</code>
+
+<b>Important:</b>
+
+  * As the game engine send stats to the front end at the end of the game one should send her stats when the game is going to finish and right before the call of EndGame(). (Note: Stats are sent from the engine in CheckForWin. If conditions are met(win or draw) then SendStats(uStats) is called.)
+  * Calling just EndGame() won't produce any stats.
+  * If one would like to produce a custom graph see also SendHealthStatsOff().
+
+</blockquote>
+
+=== <tt>!SendHealthStatsOff()</tt> (0.9.20) ===
+
+<blockquote>Prevents the engine of sending health stats to the front end. 
+
+If any health stats haven't been sent before this will cause the health graph to the stats page to be hidden. Use this function in the lua scripts to produce custom graphs by calling it inside onGameStart() and using the SendStat().</blockquote>
+
 == Debugging Functions ==
 
 === <tt>!WriteLnToConsole(string)</tt> ===