LuaAPI.wiki
changeset 328 fdc71ac8db83
parent 313 f7930ab43523
child 346 5f322c85c0e0
equal deleted inserted replaced
327:16e3a600d6af 328:fdc71ac8db83
   720 
   720 
   721 === <tt>!SwitchHog(gearUid)</tt> (0.9.16) ===
   721 === <tt>!SwitchHog(gearUid)</tt> (0.9.16) ===
   722 
   722 
   723 <blockquote>This function will switch to the hedgehog with the specified Uid.</blockquote>
   723 <blockquote>This function will switch to the hedgehog with the specified Uid.</blockquote>
   724 
   724 
       
   725 === <tt>!SendStat(TStatInfoType,statMessage[,teamName])</tt> (0.9.20) ===
       
   726 
       
   727 <blockquote>Exposes the uIO SendStat to the lua scripts. Use it to produce custom stat pages.
       
   728 
       
   729 <b>Examples:</b>
       
   730 
       
   731 <code lang="lua">
       
   732 -- will automatically change the health icon to a star
       
   733 SendStat('siGraphTitle','Custom Graph Title')
       
   734 SendStat('siGameResult','Winner is Team A!')
       
   735 SendStat('siCustomAchievement','This is a custom mesasge posted in the Details section!')
       
   736 -- Changes the word kill to Point, call it just before sending kills/score for each hog
       
   737 -- in case you want to change the word i.e. print Point or Points
       
   738 SendStat('siPointType','Point')
       
   739 -- if above function call was not used it will print 3 kills for teamName in Ranking section.
       
   740 -- if it was used it will print 3 Point for teamName in Ranking section.
       
   741 SendStat('siPlayerKills','3',teamName)
       
   742 -- call siClanHealth to send the "value" of a clan that will be used for the graph creation
       
   743 -- a good idea is to call it always for every hog by using the runOnGears(function)
       
   744 -- in normal mode "value" represents clan health
       
   745 SendStat('siClanHealth', "100",teamName)
       
   746 -- most hedgehogs killed in a round (hedgeHogName is who killed them)
       
   747 SendStat('siMaxStepKills', "1 hedgeHogName (teamName)")
       
   748 -- hog with most damage inflicted to his own team
       
   749 SendStat('siMaxTeamDamage', "100 hedgeHogName")
       
   750 -- total number of killed hedgehogs
       
   751 SendStat('siKilledHHs', "1")
       
   752 -- increases the wins of local teams in case the given number is greater than 0
       
   753 SendStat('siTeamStats', "teamName:0:")
       
   754 -- best shot award
       
   755 SendStat('siMaxStepDamage', "30 hedgeHogName (teamName)")
       
   756 -- team with most kills of own hedgehogs
       
   757 SendStat('siMaxStepDamage', "2 teamName")
       
   758 -- team with most skips
       
   759 SendStat('siMaxTurnSkips', "3 teamName")
       
   760 </code>
       
   761 
       
   762 <b>Important:</b>
       
   763 
       
   764   * 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.)
       
   765   * Calling just EndGame() won't produce any stats.
       
   766   * If one would like to produce a custom graph see also SendHealthStatsOff().
       
   767 
       
   768 </blockquote>
       
   769 
       
   770 === <tt>!SendHealthStatsOff()</tt> (0.9.20) ===
       
   771 
       
   772 <blockquote>Prevents the engine of sending health stats to the front end. 
       
   773 
       
   774 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>
       
   775 
   725 == Debugging Functions ==
   776 == Debugging Functions ==
   726 
   777 
   727 === <tt>!WriteLnToConsole(string)</tt> ===
   778 === <tt>!WriteLnToConsole(string)</tt> ===
   728 
   779 
   729 <blockquote>Writes (string) to the game0.log, found in the user data directory.
   780 <blockquote>Writes (string) to the game0.log, found in the user data directory.