940 |
940 |
941 |
941 |
942 == Stats functions == |
942 == Stats functions == |
943 === <tt>!SendStat(TStatInfoType, statMessage[, teamName])</tt> (0.9.20) === |
943 === <tt>!SendStat(TStatInfoType, statMessage[, teamName])</tt> (0.9.20) === |
944 |
944 |
945 <blockquote>Exposes the uIO SendStat to the lua scripts. Use it to produce custom stat pages. |
945 This function exposes the uIO SendStat to the Lua scripts. Use it to produce custom stat pages. |
|
946 |
|
947 `TStatInfoType` is the piece of information you want to manipulate. The result of this functions varies greatly for different `TStatInfoType`s. The parameter `statMessage` is mandatory and is a string used for the statistics, its meaning depends on the `TStatInfoType`. The parameter `teamName` contains the name of a team which is relevant to the chosen stat. This parameter is not always required, this also depends on `TStatInfoType`. |
|
948 |
|
949 This tables explains the different behaviours of this function for different values of `TStatInfoType`: |
|
950 |
|
951 || `TStatInfoType` || Meaning of `statMessage` || Team parameter used? || |
|
952 || `siGraphTitle` || Title of the graph. If you use this, the health icon changes into a star. || No || |
|
953 || `siGameResult` || Title of the stats screen, used to show the result of the game, i.e. who won the game || No || |
|
954 || `siCustomAchievement` || A freeform text for a single “bullet point” in the “bullet point” list in the details section. For each time you call `SendStat` with this `TStatInfoType`, a new “bullet point” gets added to the list. || No || |
|
955 || `siPointType` || Replaces the word “kills” in the ranking list. Sadly, grammatical number is currently not respected at all here. || No || |
|
956 || `siPlayerKills` || The number of kills for the specified team (converted to a string), as shown in the ranking list. Unless the word “kills” has been replaced by `siPointType`, then that word is used instead. Only integers (converted to string) are possible. || Yes || |
|
957 || `siClanHealth` || Value of a data point (converted to a string). This sets a single data point on the graph for the specified team. Subsequent calls will draw the next point along the horizontal axis; the frontend will then simply connect the dots in the final graph. The graphs are treated independently for each other. Currently the graph only can display positive values. You also should have called `SendHealthStatsOff` if you use this to prevent the default health graphs to be drawn. || Yes || |
|
958 || `siMaxStepKills` || Most hedgehogs killed in a round. `statText` must be in format “`<kills> <name of killer hedgehog> (<team name of killer>)`”. || No || |
|
959 || `siMaxTeamDamage` || Hedgehog with most damage inflicted to his own team. `statText` must be in the format “`<damage> <hedgehog name>`”. || No || |
|
960 || `siKilledHHs` || Total number of killed hedgehogs (converted to string). || No || |
|
961 || `siTeamStats` || Increases the wins of local teams in case the given number is greater than 0. || No || |
|
962 || `siMaxStepDamage` || Best shot award (most damage in one turn). `statText` must be in format “`<damage> <hedgehog name> (<team name>)`”. || No || |
|
963 || `siMaxTurnSkips` || Team with most skips. `statText` must be of format “`<number> <teamName>`”. || No || |
|
964 |
946 |
965 |
947 <b>Examples:</b> |
966 <b>Examples:</b> |
948 |
967 |
949 <code language="lua"> |
968 <code language="lua"> |
950 -- will automatically change the health icon to a star |
969 -- will automatically change the health icon to a star |
951 SendStat(siGraphTitle,'Custom Graph Title') |
970 SendStat(siGraphTitle,'Custom Graph Title') |
952 SendStat(siGameResult,'Winner is Team A!') |
971 SendStat(siGameResult,'Winner is Team A!') |
953 SendStat(siCustomAchievement,'This is a custom mesasge posted in the Details section!') |
972 SendStat(siCustomAchievement,'This is a custom message posted in the Details section!') |
954 -- Changes the word kill to Point, call it just before sending kills/score for each hog |
973 -- Changes the word kill to Point, call it just before sending kills/score for each hog |
955 -- in case you want to change the word i.e. print Point or Points |
974 -- in case you want to change the word i.e. print Point or Points |
956 SendStat(siPointType,'Point') |
975 SendStat(siPointType,'Point') |
957 -- if above function call was not used it will print 3 kills for teamName in Ranking section. |
976 -- if above function call was not used it will print 3 kills for teamName in Ranking section. |
958 -- if it was used it will print 3 Point for teamName in Ranking section. |
977 -- if it was used it will print 3 Point for teamName in Ranking section. |
981 |
1000 |
982 * 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.) |
1001 * 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.) |
983 * Calling just EndGame() won't produce any stats. |
1002 * Calling just EndGame() won't produce any stats. |
984 * If one would like to produce a custom graph see also SendHealthStatsOff(). |
1003 * If one would like to produce a custom graph see also SendHealthStatsOff(). |
985 |
1004 |
986 </blockquote> |
|
987 |
|
988 === <tt>!SendHealthStatsOff()</tt> (0.9.20) === |
1005 === <tt>!SendHealthStatsOff()</tt> (0.9.20) === |
989 |
1006 |
990 <blockquote>Prevents the engine of sending health stats to the front end. |
1007 <blockquote>Prevents the engine of sending health stats to the front end. |
991 |
1008 |
992 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> |
1009 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> |