LuaAPI.wiki
author sheepyluva@gmail.com
Thu, 17 Jan 2013 15:34:59 +0000
changeset 282 3a4cc2991b69
parent 244 74d74086e49b
child 284 365362b51148
permissions -rw-r--r--
Edited wiki page KnownBugs through web user interface. Like a baws.
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>
142
4926fef16e6c Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 141
diff changeset
     8
<blockquote><tt>!ScreenWidth</tt>, <tt>!ScreenHeight</tt>, <tt>!WaterLine</tt></blockquote>
125
b0b7654c6de6 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 123
diff changeset
     9
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    10
Game flags:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    11
157
90dd08518805 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 150
diff changeset
    12
<blockquote><tt>gfForts, gfMultiWeapon, gfBorder, gfSolidLand, gfDivideTeams, gfLowGravity, gfLaserSight, gfInvulnerable, gfMines, gfVampiric, gfKarma, gfArtillery, gfOneClanMode, gfRandomOrder, gfKing, gfPlaceHog, gfSharedAmmo, gfDisableGirders, gfExplosives, gfDisableLandObjects, gfAISurvival, gfInfAttack, gfResetWeps, gfResetHealth, gfPerHogAmmo, gfDisableWind, gfMoreWind, gfTagTeam</tt></blockquote>
102
86cf695636c6 Added gfResetHealth to Gameflags section along with a note.
RedGrinner@gmail.com
parents: 101
diff changeset
    13
86cf695636c6 Added gfResetHealth to Gameflags section along with a note.
RedGrinner@gmail.com
parents: 101
diff changeset
    14
*Note:* A few of these, e.g. gfResetHealth (and probably gfTagTeam) are not yet exposed to lua.
86cf695636c6 Added gfResetHealth to Gameflags section along with a note.
RedGrinner@gmail.com
parents: 101
diff changeset
    15
123
d6f33f6d142a Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 114
diff changeset
    16
More constants at [GearTypes Gear Types] , [AmmoTypes Ammo Types], [Sounds], [States], [Sprites], [VisualGearTypes Visual Gear Types]
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    17
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    18
Additional global changing variables accessible:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    19
24
a34dc3c46a47 added some global variables
henrik.rostedt
parents: 23
diff changeset
    20
 * <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
    21
 * <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
    22
 * <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
    23
 * <tt>!GameTime</tt> - number of total game ticks
a34dc3c46a47 added some global variables
henrik.rostedt
parents: 23
diff changeset
    24
 * <tt>!RealTime</tt> - number of total ticks
a34dc3c46a47 added some global variables
henrik.rostedt
parents: 23
diff changeset
    25
 * <tt>!TotalRounds</tt> - number of round that has passed
47
adf440f87f1e Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 46
diff changeset
    26
 * <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
    27
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    28
== Event Handlers ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    29
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    30
=== <tt>onGameInit()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    31
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    32
<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
    33
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    34
 * <tt>Seed = 0</tt> - sets the seed of the random number generator
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
    35
 * <tt>!GameFlags = gfSolidLand + gfArtillery + ...</tt> - sets the gameflags, see above for the available flags
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    36
 * <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
    37
 * <tt>!CaseFreq = 0</tt> - frequency of crate drops
22
af151755fd72 fix for auto-links
henrik.rostedt
parents: 21
diff changeset
    38
 * <tt>!HealthCaseProb = 35</tt> - chance of receiving a health crate
af151755fd72 fix for auto-links
henrik.rostedt
parents: 21
diff changeset
    39
 * <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
    40
 * <tt>!DamagePercent = 100</tt> - percent of damage to inforce
23
5800c5aef9ca one more
henrik.rostedt
parents: 22
diff changeset
    41
 * <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
    42
 * <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
    43
 * <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
    44
 * <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
    45
 * <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
    46
 * <tt>!SuddenDeathTurns = 30</tt> - turns until sudden death begins
22
af151755fd72 fix for auto-links
henrik.rostedt
parents: 21
diff changeset
    47
 * <tt>!WaterRise = 47</tt> - height of water rise at sudden death in pixels
af151755fd72 fix for auto-links
henrik.rostedt
parents: 21
diff changeset
    48
 * <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
    49
 * <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
    50
 * <tt>Theme = "Bamboo"</tt> - the theme to be used
147
379d7931ffc7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 146
diff changeset
    51
 * <tt>Ready = 5000</tt> - the ready timer at the start of the round
146
a644314c7703 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 145
diff changeset
    52
 * <tt>!MapGen</tt>
a644314c7703 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 145
diff changeset
    53
 * <tt>!TemplateFilter</tt>
87
315a93b441d4 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 82
diff changeset
    54
 * <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
    55
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    56
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
    57
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    58
=== <tt>onGameStart()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    59
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    60
<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
    61
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    62
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
    63
64
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    64
=== <tt>onGameTick()</tt> ===
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    65
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    66
<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
    67
</blockquote>
a651a8ab85d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 63
diff changeset
    68
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
    69
=== <tt>onNewTurn()</tt> ===
63
24004a9003ec Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 62
diff changeset
    70
24004a9003ec Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 62
diff changeset
    71
<blockquote>This function calls at the start of every turn.
24004a9003ec Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 62
diff changeset
    72
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    73
=== <tt>onGearAdd(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    74
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    75
<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
    76
combination with <tt>!GetGearType(gearUid)</tt>.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    77
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    78
=== <tt>onGearDelete(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    79
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    80
<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
    81
combination with <tt>!GetGearType(gearUid)</tt>.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
    82
</blockquote>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
    83
=== <tt>onGearDamage(gearUid, damage)</tt> ===
55
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    84
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    85
<blockquote>This function is called when a gear is damaged.
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    86
</blockquote>
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    87
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    88
Example:
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    89
66
7586adb1eace Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 65
diff changeset
    90
<code lang="lua">    function onGearDamage(gear, damage)
55
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    91
        if (!GetGearType(gear) == gtHedgehog) then
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    92
            -- 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
    93
            !AddCaption(!GetHogName(gear) .. ' took ' .. damage .. ' points of damage')
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    94
        end
ef26ff619aea Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 54
diff changeset
    95
    end</code>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
    96
=== <tt>onGearResurrect(gearUid) </tt> ===
44
bf53e635a2ac Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 43
diff changeset
    97
46
6c818c9fc1d5 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 45
diff changeset
    98
<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
    99
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   100
=== <tt>onAmmoStoreInit()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   101
13
2074f03075c6 LuaAPI: minor changes
tobias.neumann
parents: 12
diff changeset
   102
<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
   103
</blockquote>
98
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   104
203
08cc35ba4d34 Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents: 202
diff changeset
   105
=== <tt>onNewAmmoStore(team/clan index, hog index)</tt> ===
202
47363108b6b6 Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents: 184
diff changeset
   106
47363108b6b6 Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents: 184
diff changeset
   107
<blockquote>This function is identical to onAmmoStoreInit in function, but is called once per ammo store.  This allows different ammo sets for each clan, team or hedgehog depending on the mode.</blockquote>
47363108b6b6 Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents: 184
diff changeset
   108
If gfSharedAmmo is set, the parameters passed are the clan index, and -1, and the function will be called once for each clan.
47363108b6b6 Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents: 184
diff changeset
   109
If gfPerHogAmmo is set, the parameters passed are the team index and the hog index in that team, and the function will be called once for each hedgehog.
47363108b6b6 Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents: 184
diff changeset
   110
If neither is set, the parameters passed are the team index and -1, and the function will be called once for each team.
47363108b6b6 Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents: 184
diff changeset
   111
47363108b6b6 Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents: 184
diff changeset
   112
These indexes can be used to look up details of the clan/team/hedgehog prior to gear creation.  Routines to do these lookups will be created as needed.
47363108b6b6 Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents: 184
diff changeset
   113
If you add this hook, the expectation is that you will call SetAmmo appropriately.  Any values from onAmmoStoreInit are ignored.
47363108b6b6 Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents: 184
diff changeset
   114
148
f343b50d5619 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 147
diff changeset
   115
=== <tt>onScreenResize() (0.9.16) </tt> ===
145
547ac6a1d14e Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 144
diff changeset
   116
547ac6a1d14e Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 144
diff changeset
   117
<blockquote>This function is called when you resize the screen. Useful place to put a redraw function for any vgtHealthTags you're using.
547ac6a1d14e Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 144
diff changeset
   118
</blockquote>
547ac6a1d14e Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 144
diff changeset
   119
98
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   120
=== <tt>onAttack()</tt> ===
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   121
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   122
<blockquote>This function is called when your Hedgehog attacks.
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   123
</blockquote>
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   124
107
kyberneticist
parents: 102
diff changeset
   125
=== <tt>onHJump()</tt> ===
98
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   126
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   127
<blockquote>This function is called when you press the high jump key.
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   128
</blockquote>
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   129
107
kyberneticist
parents: 102
diff changeset
   130
=== <tt>onLJump()</tt> ===
98
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   131
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   132
<blockquote>This function is called when you press the long jump key.
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   133
</blockquote>
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   134
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   135
=== <tt>onPrecise()</tt> ===
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   136
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   137
<blockquote>This function is called when you press the precise key.
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   138
</blockquote>
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   139
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   140
=== <tt>onLeft()</tt> ===
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   141
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   142
<blockquote>This function is called when you press the left key.
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   143
</blockquote>
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   144
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   145
=== <tt>onRight()</tt> ===
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   146
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   147
<blockquote>This function is called when you press the right key.
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   148
</blockquote>
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   149
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   150
=== <tt>onUp()</tt> ===
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   151
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   152
<blockquote>This function is called when you press the up key.
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   153
</blockquote>
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   154
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   155
=== <tt>onDown()</tt> ===
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   156
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   157
<blockquote>This function is called when you press the down key.
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   158
</blockquote>
54e178bb6986 Added basic (not entirely accurate) entries for the event handlers relating to actions taken by Hedgehogs / user input.
RedGrinner@gmail.com
parents: 95
diff changeset
   159
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   160
=== <tt>onAttackUp()</tt> ===
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   161
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   162
<blockquote>This function is called when you release the attack key.</blockquote>
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   163
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   164
=== <tt>onDownUp()</tt> ===
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   165
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   166
<blockquote>This function is called when you release the down key.</blockquote>
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   167
 
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   168
=== <tt>onHogAttack()</tt> ===
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   169
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   170
<blockquote>This function is called when you press the attack key.</blockquote>
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   171
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   172
=== <tt>onLeftUp()</tt> ===
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   173
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   174
<blockquote>This function is called when you release the left key.</blockquote>
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   175
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   176
=== <tt>onPreciseUp()</tt> ===
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   177
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   178
<blockquote>This function is called when you release the precise key.</blockquote>
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   179
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   180
=== <tt>onRightUp()</tt> ===
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   181
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   182
<blockquote>This function is called when you release the right key.</blockquote>
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   183
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   184
=== <tt>onSetWeapon()</tt> ===
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   185
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   186
<blockquote>It is get called when a weapon is selected or switched.</blockquote>
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   187
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   188
=== <tt>onSlot()</tt> ===
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   189
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   190
<blockquote>This function is called when a weapon slot (row in the weapon menu) is selected.</blockquote>
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   191
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   192
=== <tt>onSwitch()</tt> ===
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   193
176
c480b9c21241 fix typo
sheepyluva@gmail.com
parents: 175
diff changeset
   194
<blockquote>This function is called when a hog is switched to another.</blockquote>
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   195
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   196
=== <tt>onTaunt()</tt> ===
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   197
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   198
<blockquote>This function is called when the player uses an animated   emote for example "/wave, /juggle and etc.</blockquote>
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   199
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   200
=== <tt>onTimer()</tt> ===
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   201
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   202
<blockquote>This function is called when one of the timer keys is pressed.</blockquote>
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   203
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   204
=== <tt>onUpUp()</tt> ===
173
ef246592a16e Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 172
diff changeset
   205
178
dde460404412 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 177
diff changeset
   206
<blockquote>This function is called when you release the up 
dde460404412 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 177
diff changeset
   207
key.</blockquote>
dde460404412 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 177
diff changeset
   208
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   209
=== <tt>onHogHide()</tt> (0.9.16) ===
178
dde460404412 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 177
diff changeset
   210
179
156e5fba2e2c Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 178
diff changeset
   211
<blockquote>This function is called when a hedgehog is hidden(removed from the map).</blockquote>
156e5fba2e2c Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 178
diff changeset
   212
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   213
=== <tt>onHogRestore()</tt> (0.9.16) ===
179
156e5fba2e2c Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 178
diff changeset
   214
156e5fba2e2c Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 178
diff changeset
   215
<blockquote>This function is called when a hedgehog is restored (unhidden).<blockquote>
173
ef246592a16e Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 172
diff changeset
   216
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   217
== Functions for creating gears ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   218
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   219
=== <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
   220
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   221
<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
   222
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   223
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   224
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   225
<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
   226
    !FindPlace(gear, true, 0, LAND_WIDTH)</code>
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   227
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   228
=== <tt>!AddVisualGear(x, y, viusalGearType, state, critical)</tt> ===
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   229
42
565e15a60043 Edited wiki page LuaAPI through web user interface.
kyberneticist
parents: 39
diff changeset
   230
<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
   231
</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
50
9033b970cbf7 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 49
diff changeset
   234
<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
   235
    vgear = !AddVisualGear(1000, 1000, vgtExplosion, 0, false) 
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   236
</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   237
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   238
=== <tt>!SpawnHealthCrate(x, y)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   239
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   240
<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
   241
</blockquote>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   242
=== <tt>!SpawnAmmoCrate(x, y, ammoType)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   243
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   244
<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
   245
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   246
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   247
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   248
<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
   249
    !SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   250
=== <tt>!SpawnUtilityCrate(x, y, ammoType)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   251
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   252
<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
   253
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   254
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   255
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   256
<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
   257
    !SpawnUtilityCrate(0, 0, amLaserSight)</code>
72
6bfadfa16443 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 71
diff changeset
   258
=== <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
   259
72
6bfadfa16443 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 71
diff changeset
   260
<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
   261
</blockquote>
132
e41fcc3ff67a Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 126
diff changeset
   262
Notice: This works only for singleplayer's 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
   263
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   264
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   265
72
6bfadfa16443 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 71
diff changeset
   266
<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
   267
=== <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
   268
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   269
<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
   270
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   271
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
   272
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   273
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   274
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   275
<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
   276
    !SetGearPosition(player, 1500, 1000)</code>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   277
== Functions to get gear properties ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   278
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   279
=== <tt>!GetGearType(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   280
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   281
<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
   282
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   283
=== <tt>!GetGearPosition(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   284
148
f343b50d5619 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 147
diff changeset
   285
<blockquote>returns x,y coordinates for the specified gear
f343b50d5619 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 147
diff changeset
   286
</blockquote>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   287
=== <tt>!GetGearRadius(gearUid)</tt> ===
148
f343b50d5619 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 147
diff changeset
   288
f343b50d5619 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 147
diff changeset
   289
<blockquote>Returns radius for the specified gear
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   290
</blockquote>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   291
=== <tt>!GetGearVelocity(gearUid)</tt> ===
71
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   292
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   293
<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
   294
</blockquote>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   295
=== <tt>!GetGearElasticity(gearUid) </tt> ===
74
6130cad02b02 Added GetGearElasticity
RedGrinner
parents: 73
diff changeset
   296
6130cad02b02 Added GetGearElasticity
RedGrinner
parents: 73
diff changeset
   297
<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
   298
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   299
=== <tt>!GetHogClan(gearUid)</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>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
   302
</blockquote>
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   303
=== <tt>!GetHogTeamName(gearUid)</tt> ===
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   304
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   305
<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
   306
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   307
=== <tt>!GetHogName(gearUid)</tt> ===
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
<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
   310
</blockquote>
140
04d82b673bc4 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 139
diff changeset
   311
=== <tt>!GetEffect(gearUid, effect)</tt> ===
04d82b673bc4 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 139
diff changeset
   312
04d82b673bc4 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 139
diff changeset
   313
<blockquote>Returns the state of given effect for the given hedgehog gear.  
04d82b673bc4 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 139
diff changeset
   314
</blockquote>
133
b737ccb5b49a Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 132
diff changeset
   315
=== <tt>!GetHogHat(gearUid)</tt> ===
b737ccb5b49a Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 132
diff changeset
   316
b737ccb5b49a Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 132
diff changeset
   317
<blockquote>Returns the hat of the specified hedgehog gear
b737ccb5b49a Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 132
diff changeset
   318
</blockquote>
141
b10bef9ac535 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 140
diff changeset
   319
=== <tt>!GetAmmoCount(gearUid, ammoType) (0.9.16)</tt> ===
133
b737ccb5b49a Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 132
diff changeset
   320
141
b10bef9ac535 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 140
diff changeset
   321
<blockquote>Returns the ammo count of the specified ammo type for the specified hedgehog gear.
b10bef9ac535 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 140
diff changeset
   322
</blockquote>
138
9ca80a93aae0 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 137
diff changeset
   323
=== <tt>!GetGearTarget(gearUid, x, y)  (0.9.16)</tt> ===
137
dd7605730ec5 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 136
diff changeset
   324
138
9ca80a93aae0 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 137
diff changeset
   325
<blockquote>Returns the x and y coordinate of target-based weapons/utilities. <b> Note: </b>: This can't be used in onGearAdd() but must be called after gear creation. 
137
dd7605730ec5 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 136
diff changeset
   326
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   327
=== <tt>GetX(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   328
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   329
<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
   330
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   331
=== <tt>GetY(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   332
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   333
<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
   334
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   335
=== <tt>!GetState(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   336
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   337
<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
   338
</blockquote>
114
e311af715b57 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 107
diff changeset
   339
=== <tt>!GetGearMessage(gearUid)</tt> ===
e311af715b57 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 107
diff changeset
   340
e311af715b57 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 107
diff changeset
   341
<blockquote>returns the message of the gear.
e311af715b57 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 107
diff changeset
   342
</blockquote>
209
26805ae2a319 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 203
diff changeset
   343
=== <tt>!GetFollowGear()</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   344
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   345
<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
   346
</blockquote>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   347
=== <tt>!GetTimer(gearUid)</tt> ===
12
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
<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
   350
</blockquote>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   351
=== <tt>!GetHealth(gearUid)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   352
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   353
<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
   354
</blockquote>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   355
=== <tt>!GetHogLevel(gearUid)</tt> ===
12
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>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
   358
</blockquote>
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   359
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   360
=== <tt>!GetVisualGearValues(vgUid)</tt> ===
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   361
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   362
<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
   363
X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint 
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   364
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
   365
Most visual gears require little to no modification of parameters.
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   366
</blockquote>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   367
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   368
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   369
<code lang="lua">    !GetVisualGearValues(vgUid) -- return visual gear values
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   370
</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   371
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   372
== Functions to modify gears ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   373
243
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   374
=== <tt>!HideHog(gearUid)</tt> ===
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   375
244
74d74086e49b Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 243
diff changeset
   376
<blockquote>Removes a hedgehog from the map. The hidden hedgehog can be restored with !RestoreHog(gearUid). The current hedgehog cannot be hidden!</blockquote>
243
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   377
Example: 
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   378
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   379
<code lang="lua">    gear = !AddGear(...)
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   380
     !HideHog(gear) -- Hide the newly created gear.</code>
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   381
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   382
=== <tt>!RestoreHog(gearUid)</tt> ===
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   383
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   384
<blockquote>Restores a previously hidden hedgehog.</blockquote>
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   385
Example: 
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   386
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   387
<code lang="lua">    gear = !AddGear(...)
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   388
     !HideHog(gear) -- Hide the newly created gear.
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   389
     !RestoreHog(gear) -- Restore the newly hidden gear.</code>
ac34d3763a17 Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents: 209
diff changeset
   390
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   391
=== <tt>!DeleteGear(gearUid)</tt> ===
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   392
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   393
<blockquote>Deletes a Gear</blockquote>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   394
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   395
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   396
<code lang="lua">    gear = !AddGear(...)
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   397
    !DeleteGear(gear) -- Delete the newly created gear.</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   398
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   399
=== <tt>!DeleteVisualGear(vgUid)</tt> ===
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   400
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   401
<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
   402
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   403
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   404
<code lang="lua">    vgear = !AddVisualGear(...)
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   405
    !DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   406
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   407
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   408
=== <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint)</tt> ===
39
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   409
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   410
<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
   411
Most visual gears require little to no modification of parameters.
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   412
</blockquote>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   413
Example:
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   414
51
5ab1cf4c7194 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 50
diff changeset
   415
<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
   416
    !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
   417
</code>
45a576e56425 Updating with visual gear functions and delete gear
kyberneticist
parents: 38
diff changeset
   418
136
538adf2596b5 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 135
diff changeset
   419
=== <tt>!FindPlace(gearUid, fall, left, right, tryHarder) (0.9.16)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   420
136
538adf2596b5 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 135
diff changeset
   421
<blockquote>Finds a place for the specified gear between x=left and x=right and places it there. 0.9.16 adds an optional fifth parameter, tryHarder. Setting to true/false will determine whether the engine attempts to make additional passes, even attempting to place gears on top of each other.
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   422
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   423
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   424
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   425
<code lang="lua">    gear = !AddGear(...)
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   426
    !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
   427
=== <tt>!HogSay(gearUid, text, manner)</tt> ===
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   428
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   429
<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
   430
</blockquote>
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   431
Example:
233360620ae2 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 58
diff changeset
   432
60
e9375c8b25c7 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 59
diff changeset
   433
<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
   434
    !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
   435
    !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
   436
</code>
52
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   437
=== <tt>!HogTurnLeft(gearUid, boolean)</tt> ===
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   438
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   439
<blockquote>Faces the specified hog left or right.
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   440
</blockquote>
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   441
Example:
714b56de5ea1 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 51
diff changeset
   442
54
2017dc6bc149 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 53
diff changeset
   443
<code lang="lua">    !HogTurnLeft(!CurrentHedgehog, true) -- turns !CurrentHedgehog left 
2017dc6bc149 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 53
diff changeset
   444
    !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
   445
=== <tt>!SetGearPosition(gearUid, x, y)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   446
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   447
<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
   448
</blockquote>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   449
=== <tt>!SetGearVelocity(gearUid, dx, dy)</tt> ===
71
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   450
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   451
<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
   452
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   453
=== <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
   454
101
174650a7ce20 Added entry for AddAmmo()
RedGrinner@gmail.com
parents: 100
diff changeset
   455
<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() event handler.
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   456
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   457
Example:
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   458
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   459
<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
   460
    !SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade</code>
135
124b11219537 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 134
diff changeset
   461
=== <tt>!AddAmmo(gearUid, ammoType, ammoCount) (0.9.16) </tt> ===
101
174650a7ce20 Added entry for AddAmmo()
RedGrinner@gmail.com
parents: 100
diff changeset
   462
135
124b11219537 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 134
diff changeset
   463
<blockquote>Adds ammoType to the specified gear. The amount added is determined by the arguments passed via !SetAmmo() in the onAmmoStoreInit() event handler. In 0.9.16 ammo can be set directly via the optional third parameter, ammoCount. A value of 0 will remove the weapon, a value of 100 will give infinite ammo.
101
174650a7ce20 Added entry for AddAmmo()
RedGrinner@gmail.com
parents: 100
diff changeset
   464
174650a7ce20 Added entry for AddAmmo()
RedGrinner@gmail.com
parents: 100
diff changeset
   465
*Note:* The effectiveness of this function may be limited due to problems with gfPerHogAmmo in lua scripting.
174650a7ce20 Added entry for AddAmmo()
RedGrinner@gmail.com
parents: 100
diff changeset
   466
174650a7ce20 Added entry for AddAmmo()
RedGrinner@gmail.com
parents: 100
diff changeset
   467
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   468
=== <tt>!SetHealth(gearUid, health)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   469
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   470
<blockquote>Sets the health of the specified gear.
99
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   471
This can be used for purposes other than killing hedgehogs.
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   472
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   473
For example:
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   474
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   475
  * Starting the RC Plane 10 shots
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   476
  * Starting Flying Saucer (gtJetpack) with only 50% fuel.
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   477
  * Setting all the mines to duds.
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   478
  * (And more!)
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   479
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   480
<code lang="lua">    function onGearAdd(gear)
175
2455fbbab5e8 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 174
diff changeset
   481
       if (!GetGearType(gear) == gtRCPlaane) then
99
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   482
            !SetHealth(gear, 10)
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   483
       end
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   484
       if (!GetGearType(gear) == gtJetpack) then
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   485
            !SetHealth(gear, 1000)
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   486
       end
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   487
       if (!GetGearType(gear) == gtMine) then
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   488
            !SetHealth(gear, 0)
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   489
       end
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   490
    end</code>
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   491
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   492
983ec9ac63c7 Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents: 98
diff changeset
   493
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   494
</blockquote>
132
e41fcc3ff67a Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 126
diff changeset
   495
=== <tt>!SetEffect(gearUid, effect, true/false)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   496
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   497
<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
   498
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   499
Example: (sets all bots poisoned)
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   500
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   501
<code lang="lua">    function onGearAdd(gear)
48
3c5d26c1562a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 47
diff changeset
   502
        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
   503
            !SetEffect(gear, hePoisoned, true)
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   504
        end
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   505
    end</code>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   506
17
2893bd461cc7 LuaAPI: minor improvement
tobias.neumann
parents: 16
diff changeset
   507
=== <tt>CopyPV(gearUid, gearUid)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   508
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   509
<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
   510
</blockquote>
71
2dcbebb06088 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 70
diff changeset
   511
=== <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
   512
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   513
<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
   514
</blockquote>
132
e41fcc3ff67a Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 126
diff changeset
   515
Notice: This function is no longer used, use GetGearVelocity and SetGearVelocity instead.
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   516
=== <tt>!FollowGear(gearUid)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   517
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   518
<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
   519
</blockquote>
139
6bf231a611a7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 138
diff changeset
   520
=== <tt>!SetHogName(gearUid, name)</tt> ===
6bf231a611a7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 138
diff changeset
   521
6bf231a611a7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 138
diff changeset
   522
<blockquote>Sets the name of the specified hedgehog gear
6bf231a611a7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 138
diff changeset
   523
</blockquote>
6bf231a611a7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 138
diff changeset
   524
=== <tt>!SetHogHat(gearUid, hat)</tt> ===
6bf231a611a7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 138
diff changeset
   525
6bf231a611a7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 138
diff changeset
   526
<blockquote>Sets the hat of the specified hedgehog gear
6bf231a611a7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 138
diff changeset
   527
</blockquote>
6bf231a611a7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 138
diff changeset
   528
=== <tt>!SetGearTarget(gearUid, x, y) (0.9.16)</tt> ===
6bf231a611a7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 138
diff changeset
   529
6bf231a611a7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 138
diff changeset
   530
<blockquote>Sets the x and y coordinate of target-based weapons/utilities. <b> Note: </b>: This can't be used in onGearAdd() but must be called after gear creation. 
6bf231a611a7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 138
diff changeset
   531
</blockquote>
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   532
=== <tt>!SetState(gearUid, state)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   533
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   534
<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
   535
</blockquote>
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   536
114
e311af715b57 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 107
diff changeset
   537
=== <tt>!SetGearMessage(gearUid, message)</tt> ===
e311af715b57 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 107
diff changeset
   538
e311af715b57 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 107
diff changeset
   539
<blockquote>Sets the message of the specified gear.
e311af715b57 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 107
diff changeset
   540
</blockquote>
e311af715b57 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 107
diff changeset
   541
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   542
=== <tt>!SetTag(gearUid, tag)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   543
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   544
<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
   545
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   546
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   547
=== <tt>!SetTimer(gearUid, timer)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   548
13
2074f03075c6 LuaAPI: minor changes
tobias.neumann
parents: 12
diff changeset
   549
<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
   550
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   551
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   552
=== <tt>!SetHogLevel(gearUid)</tt> ===
69
48f6e6c0076d Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 68
diff changeset
   553
48f6e6c0076d Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 68
diff changeset
   554
<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
   555
</blockquote>
48f6e6c0076d Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 68
diff changeset
   556
183
72b2bac582e2 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 182
diff changeset
   557
=== <tt>!SetGearPos(gearUid,value) (0.9.18-dev)</tt> ===
72b2bac582e2 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 182
diff changeset
   558
72b2bac582e2 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 182
diff changeset
   559
<blockquote>Set pos of specified gear to specified value.</blockquote>
72b2bac582e2 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 182
diff changeset
   560
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   561
== Other Functions ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   562
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   563
=== <tt>!EndGame()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   564
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   565
<blockquote>Makes the game end.
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   566
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   567
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   568
=== <tt>!ParseCommand(string)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   569
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   570
<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
   571
</blockquote>
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   572
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   573
=== <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
   574
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   575
<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
   576
64fc6cee4af7 Added a note on the new icons for ShowMission
RedGrinner
parents: 78
diff changeset
   577
As of (0.9.15), icon currently accepts:
81
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   578
 * -amBazooka, -amShotgun etc. (and other ammo types)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   579
 * 0 (Gold Crown icon)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   580
 * 1 (Target icon)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   581
 * 2 (Exclamation mark)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   582
 * 3 (Question mark)
a381e4547712 Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 80
diff changeset
   583
 * 4 (Gold star)
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   584
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   585
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   586
=== <tt>!HideMission()</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   587
143
58019b91cd69 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 142
diff changeset
   588
<blockquote>Hides the mission. This function is currently bugged somehow and will completely ruin your life, and your script should you happen to use it.
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   589
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   590
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   591
=== <tt>!AddCaption(text)</tt> ===
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   592
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   593
<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
   594
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   595
147
379d7931ffc7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 146
diff changeset
   596
=== <tt>!MapHasBorder()</tt> ===
379d7931ffc7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 146
diff changeset
   597
379d7931ffc7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 146
diff changeset
   598
<blockquote>Returns true/false if the map has a border or not.
379d7931ffc7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 146
diff changeset
   599
</blockquote>
379d7931ffc7 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 146
diff changeset
   600
150
7a8df9b04b66 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 149
diff changeset
   601
=== <tt>!TestRectForObstacle(x1, y1, x2, y2, bool) (0.9.16) </tt> ===
149
baceeb7b94f9 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 148
diff changeset
   602
baceeb7b94f9 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 148
diff changeset
   603
<blockquote>Checks the given rectangle for collisions.
baceeb7b94f9 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 148
diff changeset
   604
</blockquote>
baceeb7b94f9 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 148
diff changeset
   605
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   606
=== <tt>!PlaySound(soundId)</tt> ===
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   607
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   608
<blockquote>Plays the specified sound.
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   609
</blockquote>
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   610
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   611
=== <tt>!PlaySound(soundId, gearUid)</tt> ===
70
ff7d4c176303 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 69
diff changeset
   612
ff7d4c176303 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 69
diff changeset
   613
<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
   614
</blockquote>
ff7d4c176303 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 69
diff changeset
   615
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   616
=== <tt>!SetInputMask(mask)</tt> ===
77
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   617
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   618
<blockquote>Masks specified player input.
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   619
</blockquote>
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   620
Example: 
78
2edf207a905a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 77
diff changeset
   621
<code lang="lua">    -- masks the long and high jump commands
2edf207a905a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 77
diff changeset
   622
SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump))) 
2edf207a905a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 77
diff changeset
   623
    -- clears input mask, allowing player to take actions
2edf207a905a Edited wiki page LuaAPI through web user interface.
RedGrinner
parents: 77
diff changeset
   624
    SetInputMask(0xFFFFFFFF) 
77
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   625
		</code>
588f5dc682e2 Added SetInputMask function
RedGrinner
parents: 76
diff changeset
   626
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
   627
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   628
=== <tt>!SetZoom(zoomLevel)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   629
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   630
<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
   631
</blockquote>
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   632
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   633
=== <tt>!GetZoom()</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   634
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   635
<blockquote>Returns the current zoom level
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   636
</blockquote>
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   637
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   638
=== <tt>!GetRandom(number)</tt> ===
28
026591d95ac6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 24
diff changeset
   639
43
c07e89eded71 Elaborate on GetRandom
kyberneticist
parents: 42
diff changeset
   640
<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
   641
</blockquote>
38
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   642
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   643
=== <tt>!SetWind(windSpeed)</tt> ===
38
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   644
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   645
<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
   646
</blockquote>
123cc75cbe6a Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 28
diff changeset
   647
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   648
=== <tt>!GetDataPath()</tt> ===
68
fd230628d72c Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 67
diff changeset
   649
fd230628d72c Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 67
diff changeset
   650
<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
   651
</blockquote>
fd230628d72c Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 67
diff changeset
   652
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   653
=== <tt>!GetUserDataPath()</tt> ===
180
96e6b405bcf6 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 179
diff changeset
   654
96e6b405bcf6 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 179
diff changeset
   655
<blockquote>Returns the path to the user data directory, used when adding libraries.
96e6b405bcf6 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 179
diff changeset
   656
</blockquote>
96e6b405bcf6 Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 179
diff changeset
   657
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   658
=== <tt>!GetClanColor(clan)</tt> ===
73
c6623486d077 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 72
diff changeset
   659
c6623486d077 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 72
diff changeset
   660
<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
   661
</blockquote>
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   662
=== <tt>!SetClanColor(clan, color)</tt> ===
144
c080c7eb9656 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 143
diff changeset
   663
c080c7eb9656 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 143
diff changeset
   664
<blockquote>Sets the colour of the chosen clan by its number.
c080c7eb9656 Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 143
diff changeset
   665
</blockquote>
73
c6623486d077 Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents: 72
diff changeset
   666
132
e41fcc3ff67a Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 126
diff changeset
   667
=== <tt>!PlaceGirder(x, y, state)</tt> (0.9.16) ===
89
caf6544f767a Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 87
diff changeset
   668
caf6544f767a Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 87
diff changeset
   669
<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
   670
These are the accepted states:
90
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   671
  * 0: short, vertical
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   672
  * 1: short, decreasing
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   673
  * 2: short, horizontal
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   674
  * 3: short, increasing
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   675
  * 4: long, vertical
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   676
  * 5: long, decreasing
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   677
  * 6: long, horizontal
a96c29444a05 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 89
diff changeset
   678
  * 7: long, increasing
89
caf6544f767a Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 87
diff changeset
   679
</blockquote>
caf6544f767a Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 87
diff changeset
   680
132
e41fcc3ff67a Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents: 126
diff changeset
   681
=== <tt>!GetCurAmmoType()</tt> (0.9.16) ===
95
87343aa1f1f6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 92
diff changeset
   682
87343aa1f1f6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 92
diff changeset
   683
<blockquote>Returns the currently selected [AmmoTypes Ammo Type].
87343aa1f1f6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 92
diff changeset
   684
</blockquote>
87343aa1f1f6 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 92
diff changeset
   685
182
b64d2239cb8c Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 181
diff changeset
   686
=== <tt>!SwitchHog(gearUid)</tt> (0.9.16) ===
b64d2239cb8c Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 181
diff changeset
   687
b64d2239cb8c Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 181
diff changeset
   688
<blockquote>This function will switch to the hedgehog with the specified Uid.</blockquote>
b64d2239cb8c Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents: 181
diff changeset
   689
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   690
== Debugging Functions ==
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   691
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   692
=== <tt>!WriteLnToConsole(string)</tt> ===
12
74ead59b6c64 LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff changeset
   693
184
346bf9196f84 Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents: 183
diff changeset
   694
<blockquote>Writes (string) to the game0.log, found in the user data directory.
181
714a208397bd version number fixes
sheepyluva@gmail.com
parents: 180
diff changeset
   695
</blockquote>