LuaAPI.wiki
author Cairo@chusym.com
Mon, 03 Jan 2011 10:12:03 +0000
changeset 82 a8eacc51c636
parent 81 a381e4547712
child 87 315a93b441d4
permissions -rw-r--r--
Expanded on the WriteLnToConsole function.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
67
eecbb1c261bb Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 66
diff changeset
     1
#summary API for writing Lua scripts in Hedgewars.
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
     2
<wiki:toc max_depth="3" />
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
     3
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
     4
== Global available Constants ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
     5
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
     6
<blockquote><tt>LAND_WIDTH</tt>, <tt>LAND_HEIGHT</tt>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
     7
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
     8
Game flags:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
     9
21
e8bcd7c1ba3c updated with more options and flags
henrik.rostedt
parents: 17
diff changeset
    10
<blockquote><tt>gfForts, gfMultiWeapon, gfSolidLand, gfDivideTeams, gfLowGravity, gfLaserSight, gfInvulnerable, gfMines, gfVampiric, gfKarma, gfArtillery, gfOneClanMode, gfRandomOrder, gfKing, gfPlaceHog, gfSharedAmmo, gfDisableGirders, gfExplosives, gfDisableLandObjects, gfAISurvival, gfInfAttack, gfResetWeps, gfPerHogAmmo, gfDisableWind</tt></blockquote>
13
2074f03075c6 LuaAPI: minor changes
tobias.neumann
parents: 12
diff changeset
    11
More constants at [GearTypes Gear Types] , [AmmoTypes Ammo Types], [Sounds], [States]
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    13
Additional global changing variables accessible:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    14
24
a34dc3c46a47 added some global variables
henrik.rostedt
parents: 23
diff changeset
    15
 * <tt>!ClansCount</tt> - number of clans in the game (teams with the same color belong to one clan)
a34dc3c46a47 added some global variables
henrik.rostedt
parents: 23
diff changeset
    16
 * <tt>!TeamsCount</tt> - number of teams in the game
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    17
 * <tt>!TurnTimeLeft</tt> - number of game ticks left until the current turn ends
24
a34dc3c46a47 added some global variables
henrik.rostedt
parents: 23
diff changeset
    18
 * <tt>!GameTime</tt> - number of total game ticks
a34dc3c46a47 added some global variables
henrik.rostedt
parents: 23
diff changeset
    19
 * <tt>!RealTime</tt> - number of total ticks
a34dc3c46a47 added some global variables
henrik.rostedt
parents: 23
diff changeset
    20
 * <tt>!TotalRounds</tt> - number of round that has passed
47
adf440f87f1e Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 46
diff changeset
    21
 * <tt>!CurrentHedgehog</tt> - the hedgehog gear that is currently in play
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    22
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    23
== Event Handlers ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    24
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    25
=== <tt>onGameInit()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    26
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    27
<blockquote>This function is called before the game loads its resources. One can modify various game variables here:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    28
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    29
 * <tt>Seed = 0</tt> - sets the seed of the random number generator
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    30
 * <tt>!GameFlags = gfSolidLand + gfArtillery + …</tt> - sets the gameflags, see above for the available flags
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    31
 * <tt>!TurnTime = 60000</tt> - set the turntime in ms
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    32
 * <tt>!CaseFreq = 0</tt> - frequency of crate drops
22
af151755fd72 fix for auto-links
henrik.rostedt
parents: 21
diff changeset
    33
 * <tt>!HealthCaseProb = 35</tt> - chance of receiving a health crate
af151755fd72 fix for auto-links
henrik.rostedt
parents: 21
diff changeset
    34
 * <tt>!HealthCaseAmount = 25</tt> - amount of health in a health crate
21
e8bcd7c1ba3c updated with more options and flags
henrik.rostedt
parents: 17
diff changeset
    35
 * <tt>!DamagePercent = 100</tt> - percent of damage to inforce
23
5800c5aef9ca one more
henrik.rostedt
parents: 22
diff changeset
    36
 * <tt>!MinesNum = 0</tt> - number of mines being placed (before 0.9.14 !LandAdds)
21
e8bcd7c1ba3c updated with more options and flags
henrik.rostedt
parents: 17
diff changeset
    37
 * <tt>!MinesTime = 3</tt> - time for a mine to explode from activated, -1 for random
e8bcd7c1ba3c updated with more options and flags
henrik.rostedt
parents: 17
diff changeset
    38
 * <tt>!MineDudPercent = 0</tt> - chance of mine being a dud
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    39
 * <tt>Explosives = 0</tt> - number of explosives being placed
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    40
 * <tt>Delay = 0</tt> - delay between each round
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    41
 * <tt>!SuddenDeathTurns = 30</tt> - turns until sudden death begins
22
af151755fd72 fix for auto-links
henrik.rostedt
parents: 21
diff changeset
    42
 * <tt>!WaterRise = 47</tt> - height of water rise at sudden death in pixels
af151755fd72 fix for auto-links
henrik.rostedt
parents: 21
diff changeset
    43
 * <tt>!HealthDecrease = 5</tt> - amount of health decreased on sudden death
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    44
 * <tt>Map = "Bamboo"</tt> - the map being played
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    45
 * <tt>Theme = "Bamboo"</tt> - the theme to be used
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    46
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    47
If you want to add teams or hogs manually you have to do it here.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    48
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    49
=== <tt>onGameStart()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    50
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    51
<blockquote>This function is called when the first round starts.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    52
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    53
Can be used to show the mission and for more setup, for example initial target spawning.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    54
64
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    55
=== <tt>onGameTick()</tt> ===
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    56
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    57
<blockquote>This function is called on every game tick, i.e. 1000 times a second.
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    58
</blockquote>
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    59
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
    60
=== <tt>onNewTurn()</tt> (0.9.15) ===
63
24004a9003ec Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 62
diff changeset
    61
24004a9003ec Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 62
diff changeset
    62
<blockquote>This function calls at the start of every turn.
24004a9003ec Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 62
diff changeset
    63
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    64
=== <tt>onGearAdd(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    65
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    66
<blockquote>This function is called when a new gear is added. Useful in
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    67
combination with <tt>!GetGearType(gearUid)</tt>.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    68
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    69
=== <tt>onGearDelete(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    70
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    71
<blockquote>This function is called when a new gear is deleted. Useful in
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    72
combination with <tt>!GetGearType(gearUid)</tt>.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    73
</blockquote>
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
    74
=== <tt>onGearDamage(gearUid, damage)</tt> (0.9.15) ===
55
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    75
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    76
<blockquote>This function is called when a gear is damaged.
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    77
</blockquote>
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    78
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    79
Example:
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    80
66
7586adb1eace Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 65
diff changeset
    81
<code lang="lua">    function onGearDamage(gear, damage)
55
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    82
        if (!GetGearType(gear) == gtHedgehog) then
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    83
            -- adds a message saying, e.g. "Hoggy H took 25 points of damage"
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    84
            !AddCaption(!GetHogName(gear) .. ' took ' .. damage .. ' points of damage')
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    85
        end
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    86
    end</code>
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
    87
=== <tt>onGearResurrect(gearUid) (0.9.14)</tt> ===
44
bf53e635a2ac Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 43
diff changeset
    88
46
6c818c9fc1d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 45
diff changeset
    89
<blockquote>This function is called when a gear is resurrected. CPU Hogs will resurrect if gfAISurvival is included in !GameFlags. Alternatively, specific gears can have heResurrectable set to true via !SetEffect.
44
bf53e635a2ac Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 43
diff changeset
    90
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    91
=== <tt>onAmmoStoreInit()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    92
13
2074f03075c6 LuaAPI: minor changes
tobias.neumann
parents: 12
diff changeset
    93
<blockquote>This function is called when the game is initialized to request the available ammo and ammo probabilities. Use !SetAmmo here.
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    94
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    95
== Functions for creating gears ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    96
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    97
=== <tt>!AddGear(x, y, gearType, state, dx, dy, timer)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    98
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    99
<blockquote>This creates a new gear at position x,y (measured from top left) of kind gearType (see [GearTypes Gear Types]). The initial velocities are dx and dy. All arguments are numbers. The function returns the uid of the gear created.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   100
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   101
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   102
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   103
<code lang="lua">    local gear = !AddGear(0, 0, gtTarget, 0, 0, 0, 0)
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   104
    !FindPlace(gear, true, 0, LAND_WIDTH)</code>
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   105
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   106
=== <tt>!AddVisualGear(x, y, viusalGearType, state, critical)</tt> ===
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   107
42
565e15a60043 Edited wiki page LuaAPI through web user interface.
kyberneticist
parents: 39
diff changeset
   108
<blockquote>This creates a new visual gear at position x,y (measured from top left) of kind visualGearType (see [VisualGearTypes Visual Gear Types]).  The function returns the uid of the visual gear created.  Set critical to true if the visual gear is crucial to game play.  False if it is just an effect, and can be skipped when in fastforward (such as when joining a room).  A critical visual gear will always be created, a non-critical one may fail.  Most visual gears delete themselves. 
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   109
</blockquote>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   110
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   111
50
9033b970cbf7 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 49
diff changeset
   112
<code lang="lua">  -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
9033b970cbf7 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 49
diff changeset
   113
    vgear = !AddVisualGear(1000, 1000, vgtExplosion, 0, false) 
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   114
</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   115
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   116
=== <tt>!SpawnHealthCrate(x, y)</tt> (0.9.14) ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   117
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   118
<blockquote>Spawns a health crate at the specified position.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   119
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   120
=== <tt>!SpawnAmmoCrate(x, y, ammoType)</tt> (0.9.14) ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   121
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   122
<blockquote>Spawns an ammo crate at the specified position with content of ammoType (see [AmmoTypes Ammo Types]). Because by default settings the number of ammo in crates is zero it has to be increased to at least one with SetAmmo first, see the example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   123
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   124
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   125
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   126
<code lang="lua">    !SetAmmo(amGrenade, 0, 0, 0, 1) -- see below
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   127
    !SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   128
=== <tt>!SpawnUtilityCrate(x, y, ammoType)</tt> (0.9.14) ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   129
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   130
<blockquote>Spawns an utility crate at specified position with content of ammoType.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   131
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   132
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   133
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   134
<code lang="lua">    !SetAmmo(amLaserSight, 0, 0, 0, 1)
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   135
    !SpawnUtilityCrate(0, 0, amLaserSight)</code>
72
6bfadfa16443 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 71
diff changeset
   136
=== <tt>!AddTeam(teamname, color, grave, fort, voicepack, flag)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   137
72
6bfadfa16443 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 71
diff changeset
   138
<blockquote>Adds a new team. Note that this can only be done in onGameInit(), not at a later time. First argument is the team name followed by color, grave, fort, voicepack and flag settings.
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   139
</blockquote>
72
6bfadfa16443 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 71
diff changeset
   140
Notice: This works only for singleplayers training missions for now and will desync multiplayer games. Flag setting is dev only.
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   141
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   142
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   143
72
6bfadfa16443 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 71
diff changeset
   144
<code lang="lua">    !AddTeam("team 1", 14483456, "Simple", "Island", "Default", "hedgewars")</code>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   145
=== <tt>!AddHog(hogname, botlevel, health, hat)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   146
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   147
<blockquote>Adds a new hedgehog for current team (last created one), with botlevel and specified health also head.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   148
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   149
Notice: This works only for singleplayers training missions for now and will desync multiplayer games.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   150
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   151
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   152
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   153
<code lang="lua">    local player = !AddHog("HH 1", 0, 100, "!NoHat") -- botlevel 0 means human player
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   154
    !SetGearPosition(player, 1500, 1000)</code>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   155
== Functions to get gear properties ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   156
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   157
=== <tt>!GetGearType(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   158
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   159
<blockquote>returns one of [GearTypes Gear Types] for the specified gear
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   160
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   161
=== <tt>!GetGearPosition(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   162
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   163
<blockquote>returns tuple of x,y coordinates for the specified gear
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   164
</blockquote>
75
2ef49675d837 Fixed edit
RedGrinner
parents: 74
diff changeset
   165
=== <tt>!GetGearVelocity(gearUid)</tt> (0.9.15) ===
71
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   166
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   167
<blockquote>returns tuple of dx,dy values for the specified gear
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   168
</blockquote>
75
2ef49675d837 Fixed edit
RedGrinner
parents: 74
diff changeset
   169
=== <tt>!GetGearElasticity(gearUid) (0.9.15)</tt> ===
74
6130cad02b02 Added GetGearElasticity
RedGrinner
parents: 73
diff changeset
   170
6130cad02b02 Added GetGearElasticity
RedGrinner
parents: 73
diff changeset
   171
<blockquote>Returns the elasticity of the specified gear. Useful for determining if a hog is on a rope or not. If a hog is attached to a rope, or is busy firing one, the elasticity of the rope will be non-zero.
6130cad02b02 Added GetGearElasticity
RedGrinner
parents: 73
diff changeset
   172
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   173
=== <tt>!GetHogClan(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   174
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   175
<blockquote>returns the clan id of the specified hedgehog gear
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   176
</blockquote>
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   177
=== <tt>!GetHogTeamName(gearUid)</tt> ===
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   178
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   179
<blockquote>returns the name of the specified hedgehog gear's team
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   180
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   181
=== <tt>!GetHogName(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   182
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   183
<blockquote>returns the name of the specified hedgehog gear
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   184
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   185
=== <tt>GetX(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   186
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   187
<blockquote>returns x coordinate of the gear
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   188
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   189
=== <tt>GetY(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   190
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   191
<blockquote>returns y coordinate of the gear
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   192
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   193
=== <tt>!GetState(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   194
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   195
<blockquote>returns the state of the gear. This is one of [States]
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   196
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   197
=== <tt>!GetFollowGear(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   198
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   199
<blockquote>Returns the uid of the gear that is currently being followed.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   200
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   201
=== <tt>!GetTimer(gearUid)</tt> (0.9.14) ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   202
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   203
<blockquote>returns the timer of the gear. This is for example the time it takes for watermelon, mine, etc. to explode. This is also the time used to specify the blowtorch or rcplane time.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   204
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   205
=== <tt>!GetHealth(gearUid)</tt> (0.9.14) ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   206
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   207
<blockquote>returns the health of the gear
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   208
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   209
=== <tt>!GetBotLevel(gearUid)</tt> (0.9.14) ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   210
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   211
<blockquote>returns the bot level from 0 to 5. 0 means human player.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   212
</blockquote>
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   213
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   214
=== <tt>!GetVisualGearValues(vgUid)</tt> (0.9.15) ===
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   215
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   216
<blockquote>This returns the typically set visual gear values, useful if manipulating things like smoke or bubbles or circles.  It returns the following values:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   217
X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint 
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   218
X, Y typically position, dX, dY typically speed, Angle is usually the rotation angle, Frame is typically the animation frame, FrameTicks is usually an animation counter.  State can have a variety of values, but is typically bit packed, Timer is usually the gear lifetime and Tint is the colour.
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   219
Most visual gears require little to no modification of parameters.
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   220
</blockquote>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   221
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   222
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   223
<code lang="lua">    !GetVisualGearValues(vgUid) -- return visual gear values
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   224
</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   225
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   226
== Functions to modify gears ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   227
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   228
=== <tt>!DeleteGear(gearUid)</tt> ===
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   229
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   230
<blockquote>Deletes a Gear</blockquote>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   231
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   232
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   233
<code lang="lua">    gear = !AddGear(…)
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   234
    !DeleteGear(gear) -- Delete the newly created gear.</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   235
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   236
=== <tt>!DeleteVisualGear(vgUid)</tt> (0.9.15) ===
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   237
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   238
<blockquote>Deletes a Visual Gear.  Note, most visual gears delete themselves.</blockquote>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   239
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   240
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   241
<code lang="lua">    vgear = !AddVisualGear(…)
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   242
    !DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   243
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   244
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   245
=== <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint)</tt> (0.9.15) ===
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   246
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   247
<blockquote>This allows manipulation of many of the visual gear values.  Calling GetVisualGearValues first is recommended on most visual gears unless you are controlling all the key values.  In the case of vgtCircle, the visual gear values are mapped as follows.  X, Y: position.  State: radius. Timer: Thickness.  FrameTicks: pulsation speed (0 to disable).  dX, dY: min/max pulsation opacity (0-255). Tint: colour, RGBA.
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   248
Most visual gears require little to no modification of parameters.
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   249
</blockquote>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   250
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   251
51
5ab1cf4c7194 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 50
diff changeset
   252
<code lang="lua">  -- set a circle to position 1000,1000 pulsing from opacity 20 to 200 (8%-78%), radius of 50, 3px thickness, bright red.
5ab1cf4c7194 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 50
diff changeset
   253
    !SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff)
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   254
</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   255
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   256
=== <tt>!FindPlace(gearUid, fall, left, right)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   257
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   258
<blockquote>Finds a place for the specified gear between x=left and x=right and places it there.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   259
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   260
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   261
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   262
<code lang="lua">    gear = !AddGear(…)
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   263
    !FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH</code>
59
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   264
=== <tt>!HogSay(gearUid, text, manner)</tt> ===
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   265
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   266
<blockquote>Makes the specified gear say, think, or shout some text in a bubble.
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   267
</blockquote>
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   268
Example:
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   269
60
e9375c8b25c7 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 59
diff changeset
   270
<code lang="lua">    !HogSay(!CurrentHedgehog, "I wonder what to do...", SAY_THINK) -- thought bubble with text
e9375c8b25c7 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 59
diff changeset
   271
    !HogSay(!CurrentHedgehog, "I'm hungry...", SAY_SAY) -- speech bubble with text
e9375c8b25c7 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 59
diff changeset
   272
    !HogSay(!CurrentHedgehog, "I smell CAKE!", SAY_SHOUT) -- exclamatory bubble with text
59
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   273
</code>
52
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   274
=== <tt>!HogTurnLeft(gearUid, boolean)</tt> ===
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   275
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   276
<blockquote>Faces the specified hog left or right.
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   277
</blockquote>
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   278
Example:
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   279
54
2017dc6bc149 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 53
diff changeset
   280
<code lang="lua">    !HogTurnLeft(!CurrentHedgehog, true) -- turns !CurrentHedgehog left 
2017dc6bc149 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 53
diff changeset
   281
    !HogTurnLeft(!CurrentHedgehog, false) -- turns !CurrentHedgehog right</code>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   282
=== <tt>!SetGearPosition(gearUid, x, y)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   283
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   284
<blockquote>Places the specified gear exactly at the position (x,y).
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   285
</blockquote>
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   286
=== <tt>!SetGearVelocity(gearUid, dx, dy)</tt> (0.9.15) ===
71
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   287
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   288
<blockquote>Gives the specified gear the velocity of dx, dy.
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   289
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   290
=== <tt>!SetAmmo(ammoType, count, probability, delay, numberInCrate)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   291
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   292
<blockquote>This updates the settings for a specified [AmmoTypes Ammo Type] as of count available for players, spawn probability, availability delay in turns, and the number available in crates. This is supposed to be used in the onAmmoStoreInit() even handler.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   293
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   294
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   295
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   296
<code lang="lua">    !SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   297
    !SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade</code>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   298
=== <tt>!SetHealth(gearUid, health)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   299
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   300
<blockquote>Sets the health of the specified gear.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   301
</blockquote>
48
3c5d26c1562a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 47
diff changeset
   302
=== <tt>!SetEffect(gearUid, effect, true/false)</tt> (0.9.14 / dev) ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   303
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   304
<blockquote>Enables (true) or disables (false) one of the effects <tt>heInvulnerable, heResurrectable, hePoisoned</tt> for the specified hedgehog gear.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   305
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   306
Example: (sets all bots poisoned)
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   307
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   308
<code lang="lua">    function onGearAdd(gear)
48
3c5d26c1562a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 47
diff changeset
   309
        if (!GetGearType(gear) == gtHedgehog) and (!GetBotLevel(gear) > 0) then
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   310
            !SetEffect(gear, hePoisoned, true)
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   311
        end
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   312
    end</code>
48
3c5d26c1562a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 47
diff changeset
   313
Notice: In 0.9.14 this function takes 0 or 1 instead of true/false.
17
2893bd461cc7 LuaAPI: minor improvement
tobias.neumann
parents: 16
diff changeset
   314
=== <tt>CopyPV(gearUid, gearUid)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   315
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   316
<blockquote>This sets the position and velocity of the second gear to the first one.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   317
</blockquote>
71
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   318
=== <tt>CopyPV2(gearUid, gearUid)</tt> (deprecated) ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   319
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   320
<blockquote>This sets the position of the second gear to that of the first one, but makes its velocity twice the one of the first.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   321
</blockquote>
71
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   322
Notice: This is removed in dev, use GetGearVelocity and SetGearVelocity instead.
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   323
=== <tt>!FollowGear(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   324
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   325
<blockquote>Makes the gameclient follow the specifiec gear.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   326
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   327
=== <tt>!SetState(gearUid, state)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   328
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   329
<blockquote>Sets the state of the specified gear to one of [States].
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   330
</blockquote>
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   331
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   332
=== <tt>!SetTag(gearUid, tag)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   333
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   334
<blockquote>Sets the tag of the specified gear, different for every gear.
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   335
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   336
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   337
=== <tt>!SetTimer(gearUid, timer)</tt> (0.9.14) ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   338
13
2074f03075c6 LuaAPI: minor changes
tobias.neumann
parents: 12
diff changeset
   339
<blockquote>Sets the timer of the specified gear. Also see !GetTimer.
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   340
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   341
69
48f6e6c0076d Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 68
diff changeset
   342
=== <tt>!SetBotLevel(gearUid)</tt> (dev) ===
48f6e6c0076d Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 68
diff changeset
   343
48f6e6c0076d Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 68
diff changeset
   344
<blockquote>Sets the bot level from 0 to 5. 0 means human player.
48f6e6c0076d Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 68
diff changeset
   345
</blockquote>
48f6e6c0076d Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 68
diff changeset
   346
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   347
== Other Functions ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   348
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   349
=== <tt>!EndGame()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   350
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   351
<blockquote>Makes the game end.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   352
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   353
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   354
=== <tt>!ParseCommand(string)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   355
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   356
<blockquote>Makes the gameclient parse the specified custom command.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   357
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   358
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   359
=== <tt>!ShowMission(caption, subcaption, text, icon, time)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   360
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   361
<blockquote>Use to tell the player what he is supposed to do.
79
64fc6cee4af7 Added a note on the new icons for ShowMission
RedGrinner
parents: 78
diff changeset
   362
64fc6cee4af7 Added a note on the new icons for ShowMission
RedGrinner
parents: 78
diff changeset
   363
As of (0.9.15), icon currently accepts:
81
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   364
 * -amBazooka, -amShotgun etc. (and other ammo types)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   365
 * 0 (Gold Crown icon)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   366
 * 1 (Target icon)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   367
 * 2 (Exclamation mark)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   368
 * 3 (Question mark)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   369
 * 4 (Gold star)
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   370
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   371
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   372
=== <tt>!HideMission()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   373
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   374
<blockquote>Hides the mission.
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   375
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   376
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   377
=== <tt>!AddCaption(text)</tt> (0.9.14) ===
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   378
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   379
<blockquote>Display event text in the upper part of the screen.
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   380
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   381
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   382
=== <tt>!PlaySound(soundId)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   383
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   384
<blockquote>Plays the specified sound.
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   385
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   386
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   387
=== <tt>!PlaySound(soundId, gearUid)</tt> (0.9.15) ===
70
ff7d4c176303 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 69
diff changeset
   388
ff7d4c176303 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 69
diff changeset
   389
<blockquote>Plays the specified sound for the chosen hedgehog's team.
ff7d4c176303 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 69
diff changeset
   390
</blockquote>
ff7d4c176303 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 69
diff changeset
   391
77
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   392
=== <tt>!SetInputMask(mask)</tt> (0.9.15) ===
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   393
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   394
<blockquote>Masks specified player input.
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   395
</blockquote>
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   396
Example: 
78
2edf207a905a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 77
diff changeset
   397
<code lang="lua">    -- masks the long and high jump commands
2edf207a905a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 77
diff changeset
   398
SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump))) 
2edf207a905a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 77
diff changeset
   399
    -- clears input mask, allowing player to take actions
2edf207a905a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 77
diff changeset
   400
    SetInputMask(0xFFFFFFFF) 
77
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   401
		</code>
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   402
Note: Using the input mask is an effective way to script uninterrupted cinematics, or create modes such as No Jumping. 
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   403
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   404
=== <tt>!SetZoom(zoomLevel)</tt> (0.9.14) ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   405
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   406
<blockquote>Sets the zoom level. The value for maximum zoom is currently 1.0 and for minimum 3.0 The default zoom level is 2.0
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   407
</blockquote>
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   408
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   409
=== <tt>!GetZoom()</tt> (0.9.14) ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   410
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   411
<blockquote>Returns the current zoom level
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   412
</blockquote>
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   413
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   414
=== <tt>!GetRandom(number)</tt> (0.9.14) ===
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   415
43
c07e89eded71 Elaborate on GetRandom
kyberneticist
parents: 42
diff changeset
   416
<blockquote>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 can use the Lua random, but adding a regular gear should use GetRandom.
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   417
</blockquote>
38
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   418
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   419
=== <tt>!SetWind(windSpeed)</tt> (0.9.15) ===
38
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   420
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   421
<blockquote>Sets the current wind in the range of -100 to 100. Use together with gfDisableWind for full control.
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   422
</blockquote>
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   423
68
fd230628d72c Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 67
diff changeset
   424
=== <tt>!GetDataPath()</tt> (dev) ===
fd230628d72c Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 67
diff changeset
   425
fd230628d72c Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 67
diff changeset
   426
<blockquote>Returns the path to the data directory, used when adding libraries.
fd230628d72c Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 67
diff changeset
   427
</blockquote>
fd230628d72c Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 67
diff changeset
   428
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   429
=== <tt>!GetClanColor(clan)<tt> (0.9.15) ===
73
c6623486d077 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 72
diff changeset
   430
c6623486d077 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 72
diff changeset
   431
<blockquote>Returns the colour of the chosen clan by its number.
c6623486d077 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 72
diff changeset
   432
</blockquote>
c6623486d077 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 72
diff changeset
   433
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   434
== Debugging Functions ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   435
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   436
=== <tt>!WriteLnToConsole(string)</tt> (0.9.14) ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   437
82
a8eacc51c636 Expanded on the WriteLnToConsole function.
Cairo@chusym.com
parents: 81
diff changeset
   438
<blockquote>Writes a line or lines to the chat area.
13
2074f03075c6 LuaAPI: minor changes
tobias.neumann
parents: 12
diff changeset
   439
</blockquote>