LuaStats: siPointType special values
authorWuzzy
Fri, 21 Jun 2019 22:59:55 +0100
changeset 1922 0e978d0457b1
parent 1921 e65b834f2dd9
child 1923 6755e22daa77
LuaStats: siPointType special values
LuaStats.wiki
--- a/LuaStats.wiki	Fri Jun 21 22:44:42 2019 +0100
+++ b/LuaStats.wiki	Fri Jun 21 22:59:55 2019 +0100
@@ -18,8 +18,11 @@
 || `siGraphTitle` || Title of the graph. If you use this, the health icon changes into a star. || No ||
 || `siGameResult` || Title of the stats screen, used to show the result of the game, i.e. who won the game || No ||
 || `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 ||
-|| `siPointType` || Replaces the word “kills” in the ranking list. You have to call this each time before you report the score or kills of a team with `siPlayerKills`. Sadly, grammatical number is currently not respected at all here. || No ||
-|| `siPlayerKills` || Adds a team into the ranking with the given number of kills. The order in which this is called for each team matters. Unless the word “kills” has been replaced by `siPointType`, then that word is used instead. Only integers (converted to string) are possible. || Yes ||
+|| `siPointType` || Replaces the word “kills” in the ranking list. You have to call this each time before you report the score or kills of a team with `siPlayerKills`. Since version 1.0.0, there are a few special values you can use (see below).
+|| No ||
+|| `siPlayerKills` || Adds a team into the ranking with the given number of kills. The order in which this is called for each team matters. Unless the word “kills” has been replaced by `siPointType`, then that word is used instead. Only integers (converted to string) are possible. 
+
+|| Yes ||
 || `siClanHealth` || Value of a data point. This sets a single data point on the graph for the specified team. All teams will be converted to clans prior to drawing, there can only be one chart per clan. Subsequent calls will draw the next point along the horizontal axis; the frontend will then simply connect the dots in the final chart. Only whole numbers are supported. There must be at least 2 data points for any given clan, otherwise there won't be much to look at. ;-) You also should have called `SendHealthStatsOff` if to prevent the default health graphs to be drawn. || Yes ||
 || `siMaxStepKills` || Most hedgehogs killed in a round. `statMessage` must be in format “`<kills> <name of killer hedgehog> (<team name of killer>)`”. || No ||
 || `siMaxTeamDamage` || Team with most damage inflicted to self. `statMessage` must be in the format “`<damage> <team name>`”. || No ||
@@ -29,7 +32,23 @@
 || `siMaxTurnSkips` || Team with most skips. `statMessage` must be of format “`<number> <teamName>`”. || No ||
 || `siTeamRank` || Overwrite rank of team. `statMessage` is the rank of your choice. Must be sent before `siPlayerKills` of the team in question. || No ||
 
-<b>Examples:</b>
+=== Special values for `siPointType` (1.0.0) ===
+
+For `siPointType`, we support a few common point types. Just set `statMessage` to one of the following special values below:
+
+|| Value of `statMessage` || Meaning || Example ||
+|| `"!POINTS"` || Number of points || (25 points) ||
+|| `"!CRATES"` || Number of crates || (25 crates) ||
+|| `"!TIME"` || Number of millisecons || (0.025 seconds) ||
+|| `"!EMPTY"` || Don't display anything besides the team name || ||
+
+The special values will get properly localized in the frontend with proper numerus (e.g. singluar/plural) support.
+
+If you use any other value, Hedgewars will use this string literally, but there's no proper numerus support then, which might screw up translation. Use the special values whenever possible.
+
+If you want to use the number of kills in the ranking list, you do not need to call `SendStat`. The number of kills is already the default.
+
+=== Examples ===
 
 <code language="lua">
 -- will automatically change the health icon to a star
@@ -44,10 +63,8 @@
 SendStat(siPlayerKills, "1", 'Team B')
 SendStat(siPlayerKills, "5", 'Team C')
 
--- In the next ranking, this changes the word “kills” to “points”,
--- call it just before sending kills/score for each team
--- in case you want to change the word i.e. print “point” or “points”
-SendStat(siPointType, "points")
+-- In the next ranking, this changes the word “kill”/“kills” to ”point”/“points”
+SendStat(siPointType, "!POINTS")
 
 -- this will add Team D to the ranking and show “3 points“ in brackets (because of the siPointType above)
 SendStat(siPlayerKills, "3", "Team D")