LuaAPI: Improve examples for siPlayerKills
authorWuzzy
Mon, 03 Sep 2018 22:46:22 +0100
changeset 1538 1fa7f4048719
parent 1537 9e6138eb93da
child 1539 7c038e79eddf
LuaAPI: Improve examples for siPlayerKills
LuaAPI.wiki
--- a/LuaAPI.wiki	Mon Sep 03 22:31:57 2018 +0100
+++ b/LuaAPI.wiki	Mon Sep 03 22:46:22 2018 +0100
@@ -1495,7 +1495,7 @@
 || `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` || 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 ||
+|| `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 ||
@@ -1515,18 +1515,23 @@
 
 SendStat(siCustomAchievement,'This is a custom message 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')
+-- Adds 3 teams into the ranking: First, Team A (with 3 kills), then Team B (1 kill) and then Team C (5 kills).
+SendStat(siPlayerKills, "3", 'Team A')
+SendStat(siPlayerKills, "1", 'Team B')
+SendStat(siPlayerKills, "5", 'Team C')
 
--- 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)
+-- 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")
+
+-- this will add Team D to the ranking and show “3 points“ in brackets (because of the siPointType above)
+SendStat(siPlayerKills, "3", "Team D")
 
 -- 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)
+SendStat(siClanHealth, "100", "teamName")
 
 -- most hedgehogs killed in a round (hedgehogName is who killed them)
 SendStat(siMaxStepKills, "1 hedgehogName (teamName)")