LuaAPI.wiki
author Cairo@chusym.com
Wed, 09 Mar 2011 05:00:02 +0000
changeset 94 65351a24eac9
parent 92 e196d5419883
child 95 87343aa1f1f6
permissions -rw-r--r--
Sorted the list of gears according to alphabetical order (I got it right this time :)).
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
87
315a93b441d4 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 82
diff changeset
    46
 * <tt>Goals = "Jumping is disabled"</tt> - if you want to add info to the game mode dialog, use "|" to separate lines
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    47
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    48
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
    49
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    50
=== <tt>onGameStart()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    51
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    52
<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
    53
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    54
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
    55
64
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    56
=== <tt>onGameTick()</tt> ===
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    57
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    58
<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
    59
</blockquote>
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    60
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
    61
=== <tt>onNewTurn()</tt> (0.9.15) ===
63
24004a9003ec Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 62
diff changeset
    62
24004a9003ec Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 62
diff changeset
    63
<blockquote>This function calls at the start of every turn.
24004a9003ec Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 62
diff changeset
    64
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    65
=== <tt>onGearAdd(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    66
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    67
<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
    68
combination with <tt>!GetGearType(gearUid)</tt>.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    69
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    70
=== <tt>onGearDelete(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    71
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    72
<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
    73
combination with <tt>!GetGearType(gearUid)</tt>.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    74
</blockquote>
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
    75
=== <tt>onGearDamage(gearUid, damage)</tt> (0.9.15) ===
55
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    76
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    77
<blockquote>This function is called when a gear is damaged.
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    78
</blockquote>
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    79
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    80
Example:
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    81
66
7586adb1eace Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 65
diff changeset
    82
<code lang="lua">    function onGearDamage(gear, damage)
55
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    83
        if (!GetGearType(gear) == gtHedgehog) then
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    84
            -- 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
    85
            !AddCaption(!GetHogName(gear) .. ' took ' .. damage .. ' points of damage')
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    86
        end
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    87
    end</code>
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
    88
=== <tt>onGearResurrect(gearUid) (0.9.14)</tt> ===
44
bf53e635a2ac Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 43
diff changeset
    89
46
6c818c9fc1d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 45
diff changeset
    90
<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
    91
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    92
=== <tt>onAmmoStoreInit()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    93
13
2074f03075c6 LuaAPI: minor changes
tobias.neumann
parents: 12
diff changeset
    94
<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
    95
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    96
== Functions for creating gears ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    97
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    98
=== <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
    99
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   100
<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
   101
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   102
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   103
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   104
<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
   105
    !FindPlace(gear, true, 0, LAND_WIDTH)</code>
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   106
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   107
=== <tt>!AddVisualGear(x, y, viusalGearType, state, critical)</tt> ===
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   108
42
565e15a60043 Edited wiki page LuaAPI through web user interface.
kyberneticist
parents: 39
diff changeset
   109
<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
   110
</blockquote>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   111
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   112
50
9033b970cbf7 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 49
diff changeset
   113
<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
   114
    vgear = !AddVisualGear(1000, 1000, vgtExplosion, 0, false) 
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   115
</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   116
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   117
=== <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
   118
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   119
<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
   120
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   121
=== <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
   122
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   123
<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
   124
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   125
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   126
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   127
<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
   128
    !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
   129
=== <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
   130
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   131
<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
   132
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   133
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   134
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   135
<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
   136
    !SpawnUtilityCrate(0, 0, amLaserSight)</code>
72
6bfadfa16443 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 71
diff changeset
   137
=== <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
   138
72
6bfadfa16443 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 71
diff changeset
   139
<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
   140
</blockquote>
72
6bfadfa16443 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 71
diff changeset
   141
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
   142
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   143
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   144
72
6bfadfa16443 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 71
diff changeset
   145
<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
   146
=== <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
   147
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   148
<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
   149
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   150
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
   151
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   152
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   153
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   154
<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
   155
    !SetGearPosition(player, 1500, 1000)</code>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   156
== Functions to get gear properties ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   157
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   158
=== <tt>!GetGearType(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   159
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   160
<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
   161
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   162
=== <tt>!GetGearPosition(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   163
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   164
<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
   165
</blockquote>
75
2ef49675d837 Fixed edit
RedGrinner
parents: 74
diff changeset
   166
=== <tt>!GetGearVelocity(gearUid)</tt> (0.9.15) ===
71
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   167
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   168
<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
   169
</blockquote>
75
2ef49675d837 Fixed edit
RedGrinner
parents: 74
diff changeset
   170
=== <tt>!GetGearElasticity(gearUid) (0.9.15)</tt> ===
74
6130cad02b02 Added GetGearElasticity
RedGrinner
parents: 73
diff changeset
   171
6130cad02b02 Added GetGearElasticity
RedGrinner
parents: 73
diff changeset
   172
<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
   173
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   174
=== <tt>!GetHogClan(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   175
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   176
<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
   177
</blockquote>
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   178
=== <tt>!GetHogTeamName(gearUid)</tt> ===
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   179
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   180
<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
   181
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   182
=== <tt>!GetHogName(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   183
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   184
<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
   185
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   186
=== <tt>GetX(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   187
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   188
<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
   189
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   190
=== <tt>GetY(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   191
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   192
<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
   193
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   194
=== <tt>!GetState(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   195
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   196
<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
   197
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   198
=== <tt>!GetFollowGear(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   199
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   200
<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
   201
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   202
=== <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
   203
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   204
<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
   205
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   206
=== <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
   207
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   208
<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
   209
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   210
=== <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
   211
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   212
<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
   213
</blockquote>
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   214
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   215
=== <tt>!GetVisualGearValues(vgUid)</tt> (0.9.15) ===
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   216
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   217
<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
   218
X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint 
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   219
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
   220
Most visual gears require little to no modification of parameters.
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   221
</blockquote>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   222
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   223
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   224
<code lang="lua">    !GetVisualGearValues(vgUid) -- return visual gear values
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   225
</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   226
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   227
== Functions to modify gears ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   228
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   229
=== <tt>!DeleteGear(gearUid)</tt> ===
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   230
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   231
<blockquote>Deletes a Gear</blockquote>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   232
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   233
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   234
<code lang="lua">    gear = !AddGear(…)
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   235
    !DeleteGear(gear) -- Delete the newly created gear.</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   236
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   237
=== <tt>!DeleteVisualGear(vgUid)</tt> (0.9.15) ===
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   238
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   239
<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
   240
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   241
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   242
<code lang="lua">    vgear = !AddVisualGear(…)
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   243
    !DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   244
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   245
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   246
=== <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
   247
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   248
<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
   249
Most visual gears require little to no modification of parameters.
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   250
</blockquote>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   251
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   252
51
5ab1cf4c7194 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 50
diff changeset
   253
<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
   254
    !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
   255
</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   256
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   257
=== <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
   258
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   259
<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
   260
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   261
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   262
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   263
<code lang="lua">    gear = !AddGear(…)
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   264
    !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
   265
=== <tt>!HogSay(gearUid, text, manner)</tt> ===
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   266
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   267
<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
   268
</blockquote>
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   269
Example:
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   270
60
e9375c8b25c7 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 59
diff changeset
   271
<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
   272
    !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
   273
    !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
   274
</code>
52
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   275
=== <tt>!HogTurnLeft(gearUid, boolean)</tt> ===
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   276
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   277
<blockquote>Faces the specified hog left or right.
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   278
</blockquote>
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   279
Example:
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   280
54
2017dc6bc149 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 53
diff changeset
   281
<code lang="lua">    !HogTurnLeft(!CurrentHedgehog, true) -- turns !CurrentHedgehog left 
2017dc6bc149 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 53
diff changeset
   282
    !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
   283
=== <tt>!SetGearPosition(gearUid, x, y)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   284
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   285
<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
   286
</blockquote>
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   287
=== <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
   288
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   289
<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
   290
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   291
=== <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
   292
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   293
<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
   294
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   295
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   296
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   297
<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
   298
    !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
   299
=== <tt>!SetHealth(gearUid, health)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   300
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   301
<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
   302
</blockquote>
48
3c5d26c1562a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 47
diff changeset
   303
=== <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
   304
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   305
<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
   306
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   307
Example: (sets all bots poisoned)
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   308
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   309
<code lang="lua">    function onGearAdd(gear)
48
3c5d26c1562a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 47
diff changeset
   310
        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
   311
            !SetEffect(gear, hePoisoned, true)
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   312
        end
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   313
    end</code>
48
3c5d26c1562a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 47
diff changeset
   314
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
   315
=== <tt>CopyPV(gearUid, gearUid)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   316
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   317
<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
   318
</blockquote>
71
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   319
=== <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
   320
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   321
<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
   322
</blockquote>
71
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   323
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
   324
=== <tt>!FollowGear(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   325
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   326
<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
   327
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   328
=== <tt>!SetState(gearUid, state)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   329
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   330
<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
   331
</blockquote>
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   332
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   333
=== <tt>!SetTag(gearUid, tag)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   334
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   335
<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
   336
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   337
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   338
=== <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
   339
13
2074f03075c6 LuaAPI: minor changes
tobias.neumann
parents: 12
diff changeset
   340
<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
   341
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   342
69
48f6e6c0076d Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 68
diff changeset
   343
=== <tt>!SetBotLevel(gearUid)</tt> (dev) ===
48f6e6c0076d Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 68
diff changeset
   344
48f6e6c0076d Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 68
diff changeset
   345
<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
   346
</blockquote>
48f6e6c0076d Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 68
diff changeset
   347
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   348
== Other Functions ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   349
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   350
=== <tt>!EndGame()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   351
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   352
<blockquote>Makes the game end.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   353
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   354
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   355
=== <tt>!ParseCommand(string)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   356
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   357
<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
   358
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   359
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   360
=== <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
   361
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   362
<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
   363
64fc6cee4af7 Added a note on the new icons for ShowMission
RedGrinner
parents: 78
diff changeset
   364
As of (0.9.15), icon currently accepts:
81
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   365
 * -amBazooka, -amShotgun etc. (and other ammo types)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   366
 * 0 (Gold Crown icon)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   367
 * 1 (Target icon)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   368
 * 2 (Exclamation mark)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   369
 * 3 (Question mark)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   370
 * 4 (Gold star)
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   371
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   372
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   373
=== <tt>!HideMission()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   374
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   375
<blockquote>Hides the mission.
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   376
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   377
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   378
=== <tt>!AddCaption(text)</tt> (0.9.14) ===
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   379
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   380
<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
   381
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   382
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   383
=== <tt>!PlaySound(soundId)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   384
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   385
<blockquote>Plays the specified sound.
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   386
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   387
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   388
=== <tt>!PlaySound(soundId, gearUid)</tt> (0.9.15) ===
70
ff7d4c176303 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 69
diff changeset
   389
ff7d4c176303 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 69
diff changeset
   390
<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
   391
</blockquote>
ff7d4c176303 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 69
diff changeset
   392
77
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   393
=== <tt>!SetInputMask(mask)</tt> (0.9.15) ===
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   394
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   395
<blockquote>Masks specified player input.
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   396
</blockquote>
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   397
Example: 
78
2edf207a905a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 77
diff changeset
   398
<code lang="lua">    -- masks the long and high jump commands
2edf207a905a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 77
diff changeset
   399
SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump))) 
2edf207a905a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 77
diff changeset
   400
    -- clears input mask, allowing player to take actions
2edf207a905a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 77
diff changeset
   401
    SetInputMask(0xFFFFFFFF) 
77
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   402
		</code>
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   403
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
   404
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   405
=== <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
   406
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   407
<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
   408
</blockquote>
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   409
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   410
=== <tt>!GetZoom()</tt> (0.9.14) ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   411
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   412
<blockquote>Returns the current zoom level
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   413
</blockquote>
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   414
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   415
=== <tt>!GetRandom(number)</tt> (0.9.14) ===
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   416
43
c07e89eded71 Elaborate on GetRandom
kyberneticist
parents: 42
diff changeset
   417
<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
   418
</blockquote>
38
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   419
76
0cdebc52edad Changed some dev labels to 0.9.15
RedGrinner
parents: 75
diff changeset
   420
=== <tt>!SetWind(windSpeed)</tt> (0.9.15) ===
38
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   421
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   422
<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
   423
</blockquote>
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   424
68
fd230628d72c Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 67
diff changeset
   425
=== <tt>!GetDataPath()</tt> (dev) ===
fd230628d72c Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 67
diff changeset
   426
fd230628d72c Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 67
diff changeset
   427
<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
   428
</blockquote>
fd230628d72c Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 67
diff changeset
   429
89
caf6544f767a Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 87
diff changeset
   430
=== <tt>!GetClanColor(clan)</tt> (0.9.15) ===
73
c6623486d077 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 72
diff changeset
   431
c6623486d077 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 72
diff changeset
   432
<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
   433
</blockquote>
c6623486d077 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 72
diff changeset
   434
89
caf6544f767a Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 87
diff changeset
   435
=== <tt>!PlaceGirder(x, y, state)</tt> (dev) ===
caf6544f767a Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 87
diff changeset
   436
caf6544f767a Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 87
diff changeset
   437
<blockquote>Places a girder with centre points x, y and the chosen state.
caf6544f767a Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 87
diff changeset
   438
These are the accepted states:
90
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   439
  * 0: short, vertical
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   440
  * 1: short, decreasing
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   441
  * 2: short, horizontal
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   442
  * 3: short, increasing
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   443
  * 4: long, vertical
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   444
  * 5: long, decreasing
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   445
  * 6: long, horizontal
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   446
  * 7: long, increasing
89
caf6544f767a Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 87
diff changeset
   447
</blockquote>
caf6544f767a Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 87
diff changeset
   448
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   449
== Debugging Functions ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   450
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   451
=== <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
   452
92
e196d5419883 Edited WriteLnToConsole.
Cairo@chusym.com
parents: 90
diff changeset
   453
<blockquote>Writes (string) to the chat place, as if you had pressed t and typed it.
13
2074f03075c6 LuaAPI: minor changes
tobias.neumann
parents: 12
diff changeset
   454
</blockquote>