LuaGameplay.wiki
changeset 1937 55255a1feba7
parent 1919 d9cd57b53b6e
child 1938 e1b83a39bbbc
equal deleted inserted replaced
1936:f03a8c73065a 1937:55255a1feba7
   446 There are some special campaign variables which are used by Hedgewars to determine which missions to display in the campaign menu. This is described [ConfigurationFiles#%5BCampaign%20%3CCAMPAIGN_NAME%3E%5D here].
   446 There are some special campaign variables which are used by Hedgewars to determine which missions to display in the campaign menu. This is described [ConfigurationFiles#%5BCampaign%20%3CCAMPAIGN_NAME%3E%5D here].
   447 
   447 
   448 === <tt>!GetCampaignVar(varname)</tt> ===
   448 === <tt>!GetCampaignVar(varname)</tt> ===
   449 Returns the value of the campaign variable `varname` as a string. See also `SaveCampaignVar`.
   449 Returns the value of the campaign variable `varname` as a string. See also `SaveCampaignVar`.
   450 
   450 
   451 === <tt>!SaveMissionVar(varname, value)</tt> (0.9.25) ===
   451 === <tt>!SaveMissionVar(varname, value)</tt> (1.0.0) ===
   452 Stores the value `value` (a string) into the mission variable `varname` (also a string). A mission variable is like a campaign variable, but it applies for singleplayer missions only (Training/Challenge/Scenario), excluding campaign missions.
   452 Stores the value `value` (a string) into the mission variable `varname` (also a string). A mission variable is like a campaign variable, but it applies for singleplayer missions only (Training/Challenge/Scenario), excluding campaign missions.
   453 
   453 
   454 === <tt>!GetMissionVar(varname)</tt> (0.9.25) ===
   454 === <tt>!GetMissionVar(varname)</tt> (1.0.0) ===
   455 Returns the value of the mission variable `varname` as a string. See also `SaveMissionVar`.
   455 Returns the value of the mission variable `varname` as a string. See also `SaveMissionVar`.
   456 
   456 
   457 == Randomness ==
   457 == Randomness ==
   458 === <tt>!GetRandom(number)</tt> ===
   458 === <tt>!GetRandom(number)</tt> ===
   459 Returns a randomly generated number in the range of 0 to number - 1. This random number uses the game seed, so is synchronised, and thus safe for multiplayer and saved games. Use `GetRandom` for anything that could impact the engine state. For example, a visual gear could simply use Lua’s `math.random`, but adding a regular gear should use `GetRandom`.
   459 Returns a randomly generated number in the range of 0 to number - 1. This random number uses the game seed, so is synchronised, and thus safe for multiplayer and saved games. Use `GetRandom` for anything that could impact the engine state. For example, a visual gear could simply use Lua’s `math.random`, but adding a regular gear should use `GetRandom`.