author | almikes@aol.com |
Wed, 03 Dec 2014 04:47:59 +0000 | |
changeset 413 | 6d90d6994e95 |
parent 412 | d2f4b5b9b77c |
child 414 | 14ec7b5cb560 |
permissions | -rw-r--r-- |
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. |
284
365362b51148
This is cool stuff, let's put it on the project frontpage (adding "featured" tag)
sheepyluva@gmail.com
parents:
244
diff
changeset
|
2 |
#labels Featured |
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
3 |
<wiki:toc max_depth="4" /> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
4 |
|
312
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
5 |
== Introduction == |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
6 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
7 |
Version 0.9.13 of Hedgewars introduced the ability to use Lua scripts to modify Hedgewars behaviour for different maps without having to recompile the whole game. The till then used triggers (only appeared in training maps) were removed. |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
8 |
|
313 | 9 |
Lua is an easy to learn scripting language that's implemented using open source libraries. If you'd like to learn more about Lua, have a look at [http://www.lua.org Lua's official homepage]. Even though its easy to learn syntax this wiki page won't explain all basics of using Lua, e.g. declaring variables or using control structures. There are tons of step-by-step tutorials and documentation available on the internet. Just throw "Lua" into your favourite search engine and give it a try. |
312
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
10 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
11 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
12 |
How Hedgewars handles Lua scripts As of Version 0.9.13 Hedgewars supports Lua scripts for two similar tasks: Define tutorial missions or provide special map behaviour for precreated maps. |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
13 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
14 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
15 |
=== Tutorial missions === |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
16 |
Tutorial missions are located within text files inside "share/hedgewars/Data/Missions/Training". The game will list all files with the lua extension inside this directory in the Training selection screen. You'll find some premade example scripts within this directory that contain several comments on the script lines and what they do. |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
17 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
18 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
19 |
=== Special maps === |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
20 |
In addition to tutorial missions predrawn maps (maps not created using the random map creator) may contain a single lua script file named "map.lua". If it's there it will be used once the map is played. This way it's possible to play maps alone or over the internet using custom goals. Maps containing lua scripts will be listed with a "Mission:" prefix in map selection. |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
21 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
22 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
23 |
=== How Lua scripts are used === |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
24 |
Several parts of script files are executed multiple times. In general, the whole script file is read while loading the map. Declarations as well as function calls outside functions are executed at once. Later on the game will call special predefined function names at special occassions such as the creation of new game objects (called gears). |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
25 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
26 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
27 |
=== Important things to know === |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
28 |
It is possible to play missions in multiplayer. However this requires all participating players to have the exact same version of the map files, including the "map.lua" script file. If this isn't the case the game will probably desync and kick at least the one player using a different version of the map files. To avoid problems when running prepackaged maps, you should never modify any maps provided with the Hedgewars default package. Instead, create a copy of the existing map and modify this one. Feel free to share your work on the forums. |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
29 |
Another thing to note is the current status of our scripting implementation. Similar to the whole game, this is still work in progress and we can't guarantee that scripts working in this version will run in future revisions of the game as we might extend, change or rename parts of the scripting engine. |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
30 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
31 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
32 |
=== Global variables/constants === |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
33 |
Global variables are used by the game to interact with the scripts by passing and retrieving their values. While some of the variables are never read by the engine some allow you to modify the engine's behaviour, e.g. the theme to be used for the current map. |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
34 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
35 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
36 |
=== Functions called by the game: Event Handlers === |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
37 |
After successfully loading the Lua script the game will call the following functions on different occasions. To be used, they have to use the exact same name as defined below. |
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
38 |
|
6c0397400a9b
Add Smaxx' nice lua API introduction from the hedgewars.org wiki
sheepyluva@gmail.com
parents:
295
diff
changeset
|
39 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
40 |
== Global available Constants == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
41 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
42 |
<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
|
43 |
</blockquote> |
142
4926fef16e6c
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
141
diff
changeset
|
44 |
<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
|
45 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
46 |
Game flags: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
47 |
|
157
90dd08518805
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
150
diff
changeset
|
48 |
<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
|
49 |
|
86cf695636c6
Added gfResetHealth to Gameflags section along with a note.
RedGrinner@gmail.com
parents:
101
diff
changeset
|
50 |
*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
|
51 |
|
123
d6f33f6d142a
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
114
diff
changeset
|
52 |
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
|
53 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
54 |
Additional global changing variables accessible: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
55 |
|
24 | 56 |
* <tt>!ClansCount</tt> - number of clans in the game (teams with the same color belong to one clan) |
57 |
* <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
|
58 |
* <tt>!TurnTimeLeft</tt> - number of game ticks left until the current turn ends |
24 | 59 |
* <tt>!GameTime</tt> - number of total game ticks |
60 |
* <tt>!TotalRounds</tt> - number of round that has passed |
|
47
adf440f87f1e
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
46
diff
changeset
|
61 |
* <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
|
62 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
63 |
== Event Handlers == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
64 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
65 |
=== <tt>onGameInit()</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
66 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
67 |
<blockquote>This function is called 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
|
68 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
69 |
* <tt>Seed = 0</tt> - sets the seed of the random number generator |
410 | 70 |
* <tt>!EnableGameFlags(gfSolidLand, gfArtillery)</tt> - sets the !GameFlags (just 2 of them in this example), 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
|
71 |
* <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
|
72 |
* <tt>!CaseFreq = 0</tt> - frequency of crate drops |
22 | 73 |
* <tt>!HealthCaseProb = 35</tt> - chance of receiving a health crate |
74 |
* <tt>!HealthCaseAmount = 25</tt> - amount of health in a health crate |
|
21 | 75 |
* <tt>!DamagePercent = 100</tt> - percent of damage to inforce |
23 | 76 |
* <tt>!MinesNum = 0</tt> - number of mines being placed (before 0.9.14 !LandAdds) |
21 | 77 |
* <tt>!MinesTime = 3</tt> - time for a mine to explode from activated, -1 for random |
78 |
* <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
|
79 |
* <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
|
80 |
* <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
|
81 |
* <tt>!SuddenDeathTurns = 30</tt> - turns until sudden death begins |
22 | 82 |
* <tt>!WaterRise = 47</tt> - height of water rise at sudden death in pixels |
83 |
* <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
|
84 |
* <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
|
85 |
* <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
|
86 |
* <tt>Ready = 5000</tt> - the ready timer at the start of the round |
412 | 87 |
* <tt>!MapGen</tt> - type of map generator. One of `mgRandom`, `mgMaze`, `mgPerlin`, `mgDrawn`. |
146
a644314c7703
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
145
diff
changeset
|
88 |
* <tt>!TemplateFilter</tt> |
87
315a93b441d4
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
82
diff
changeset
|
89 |
* <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
|
90 |
|
412 | 91 |
If you want to add teams or hogs manually you have to do it here. If you want to draw your own map using `AddPoint` and `FlushPoints`, you have to do this within this function as well. |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
92 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
93 |
=== <tt>onGameStart()</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
94 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
95 |
<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
|
96 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
97 |
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
|
98 |
|
64
a651a8ab85d5
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
63
diff
changeset
|
99 |
=== <tt>onGameTick()</tt> === |
a651a8ab85d5
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
63
diff
changeset
|
100 |
|
346
5f322c85c0e0
toss in onGameTick20 - this page needs more updating tho
kyberneticist@gmail.com
parents:
328
diff
changeset
|
101 |
<blockquote>This function is called on every game tick, i.e. 1000 times a second. If you just need to check on something periodically, consider... |
5f322c85c0e0
toss in onGameTick20 - this page needs more updating tho
kyberneticist@gmail.com
parents:
328
diff
changeset
|
102 |
</blockquote> |
5f322c85c0e0
toss in onGameTick20 - this page needs more updating tho
kyberneticist@gmail.com
parents:
328
diff
changeset
|
103 |
|
5f322c85c0e0
toss in onGameTick20 - this page needs more updating tho
kyberneticist@gmail.com
parents:
328
diff
changeset
|
104 |
=== <tt>onGameTick20()</tt> === |
5f322c85c0e0
toss in onGameTick20 - this page needs more updating tho
kyberneticist@gmail.com
parents:
328
diff
changeset
|
105 |
|
5f322c85c0e0
toss in onGameTick20 - this page needs more updating tho
kyberneticist@gmail.com
parents:
328
diff
changeset
|
106 |
<blockquote>This function is called every 20 game ticks, i.e. 50 times a second. It reduces lua overhead for simple monitoring that doesn't need to happen every single tick. |
64
a651a8ab85d5
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
63
diff
changeset
|
107 |
</blockquote> |
a651a8ab85d5
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
63
diff
changeset
|
108 |
|
181 | 109 |
=== <tt>onNewTurn()</tt> === |
63
24004a9003ec
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
62
diff
changeset
|
110 |
|
24004a9003ec
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
62
diff
changeset
|
111 |
<blockquote>This function calls at the start of every turn. |
24004a9003ec
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
62
diff
changeset
|
112 |
</blockquote> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
113 |
=== <tt>onGearAdd(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
114 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
115 |
<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
|
116 |
combination with <tt>!GetGearType(gearUid)</tt>. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
117 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
118 |
=== <tt>onGearDelete(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
119 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
120 |
<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
|
121 |
combination with <tt>!GetGearType(gearUid)</tt>. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
122 |
</blockquote> |
181 | 123 |
=== <tt>onGearDamage(gearUid, damage)</tt> === |
55
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
124 |
|
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
125 |
<blockquote>This function is called when a gear is damaged. |
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
126 |
</blockquote> |
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
127 |
|
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
128 |
Example: |
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
129 |
|
66
7586adb1eace
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
65
diff
changeset
|
130 |
<code lang="lua"> function onGearDamage(gear, damage) |
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
131 |
if (GetGearType(gear) == gtHedgehog) then |
55
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
132 |
-- adds a message saying, e.g. "Hoggy H took 25 points of damage" |
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
133 |
AddCaption(GetHogName(gear) .. ' took ' .. damage .. ' points of damage') |
55
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
134 |
end |
ef26ff619aea
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
54
diff
changeset
|
135 |
end</code> |
181 | 136 |
=== <tt>onGearResurrect(gearUid) </tt> === |
44
bf53e635a2ac
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
43
diff
changeset
|
137 |
|
380 | 138 |
<blockquote>This function is called when a gear is resurrected. CPU Hogs will resurrect if the !GameFlag gfAISurvival is enabled. 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
|
139 |
</blockquote> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
140 |
=== <tt>onAmmoStoreInit()</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
141 |
|
13 | 142 |
<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
|
143 |
</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
|
144 |
|
203
08cc35ba4d34
Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents:
202
diff
changeset
|
145 |
=== <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
|
146 |
|
47363108b6b6
Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents:
184
diff
changeset
|
147 |
<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
|
148 |
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
|
149 |
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
|
150 |
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
|
151 |
|
47363108b6b6
Edited wiki page LuaAPI through web user interface.
kyberneticist@gmail.com
parents:
184
diff
changeset
|
152 |
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
|
153 |
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
|
154 |
|
148
f343b50d5619
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
147
diff
changeset
|
155 |
=== <tt>onScreenResize() (0.9.16) </tt> === |
145
547ac6a1d14e
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
144
diff
changeset
|
156 |
|
547ac6a1d14e
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
144
diff
changeset
|
157 |
<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
|
158 |
</blockquote> |
547ac6a1d14e
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
144
diff
changeset
|
159 |
|
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
|
160 |
=== <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
|
161 |
|
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
|
162 |
<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
|
163 |
</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
|
164 |
|
107 | 165 |
=== <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
|
166 |
|
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
|
167 |
<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
|
168 |
</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
|
169 |
|
107 | 170 |
=== <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
|
171 |
|
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
|
172 |
<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
|
173 |
</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
|
174 |
|
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
|
175 |
=== <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
|
176 |
|
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
|
177 |
<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
|
178 |
</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
|
179 |
|
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
|
180 |
=== <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
|
181 |
|
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
|
182 |
<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
|
183 |
</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
|
184 |
|
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
|
185 |
=== <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
|
186 |
|
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
|
187 |
<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
|
188 |
</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
|
189 |
|
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
|
190 |
=== <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
|
191 |
|
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
|
192 |
<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
|
193 |
</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
|
194 |
|
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
|
195 |
=== <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
|
196 |
|
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
|
197 |
<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
|
198 |
</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
|
199 |
|
181 | 200 |
=== <tt>onAttackUp()</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 you release the attack key.</blockquote> |
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
203 |
|
181 | 204 |
=== <tt>onDownUp()</tt> === |
175
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
205 |
|
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
206 |
<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
|
207 |
|
181 | 208 |
=== <tt>onHogAttack()</tt> === |
175
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
209 |
|
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
210 |
<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
|
211 |
|
181 | 212 |
=== <tt>onLeftUp()</tt> === |
175
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
213 |
|
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
214 |
<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
|
215 |
|
181 | 216 |
=== <tt>onPreciseUp()</tt> === |
175
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
217 |
|
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
218 |
<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
|
219 |
|
181 | 220 |
=== <tt>onRightUp()</tt> === |
175
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
221 |
|
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
222 |
<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
|
223 |
|
181 | 224 |
=== <tt>onSetWeapon()</tt> === |
175
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
225 |
|
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
226 |
<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
|
227 |
|
181 | 228 |
=== <tt>onSlot()</tt> === |
175
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
229 |
|
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
230 |
<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
|
231 |
|
181 | 232 |
=== <tt>onSwitch()</tt> === |
175
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
233 |
|
176 | 234 |
<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
|
235 |
|
181 | 236 |
=== <tt>onTaunt()</tt> === |
175
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
237 |
|
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
238 |
<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
|
239 |
|
181 | 240 |
=== <tt>onTimer()</tt> === |
175
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
241 |
|
2455fbbab5e8
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
174
diff
changeset
|
242 |
<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
|
243 |
|
181 | 244 |
=== <tt>onUpUp()</tt> === |
173
ef246592a16e
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
172
diff
changeset
|
245 |
|
178
dde460404412
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
177
diff
changeset
|
246 |
<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
|
247 |
key.</blockquote> |
dde460404412
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
177
diff
changeset
|
248 |
|
181 | 249 |
=== <tt>onHogHide()</tt> (0.9.16) === |
178
dde460404412
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
177
diff
changeset
|
250 |
|
179
156e5fba2e2c
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
178
diff
changeset
|
251 |
<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
|
252 |
|
181 | 253 |
=== <tt>onHogRestore()</tt> (0.9.16) === |
179
156e5fba2e2c
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
178
diff
changeset
|
254 |
|
403 | 255 |
<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
|
256 |
|
411 | 257 |
=== <tt>onSpritePlacement(spriteId, centerX, centerY)</tt> (0.9.21) === |
258 |
This function is called when a [Sprites Sprite] has been placed. |
|
259 |
||
260 |
`spriteID` is the type of the sprite, you find a list at [Sprites Sprites]. `centerX` and `centerY` are the coordinates of the center of the sprite. |
|
261 |
||
402
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
262 |
=== <tt>onGirderPlacement(frameIdx, centerX, centerY)</tt> (0.9.21) === |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
263 |
This function is called when a girder has been placed. |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
264 |
|
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
265 |
`frameIdx` is an integer and declares the length and orientation of the girder: |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
266 |
|| `frameIdx` || length || orientation || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
267 |
|| 0 || short || horizontal || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
268 |
|| 1 || short || decreasing right || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
269 |
|| 2 || short || vertical || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
270 |
|| 3 || short || increasing right || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
271 |
|| 4 || long || horizontal || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
272 |
|| 5 || long || decreasing right || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
273 |
|| 6 || long || vertical || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
274 |
|| 7 || long || increasing right || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
275 |
|
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
276 |
`centerX` and `centerY` are the coordinates of the girder’s center. |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
277 |
|
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
278 |
=== <tt>onRubberPlacement(frameIdx, centerX, centerY)</tt> (0.9.21) === |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
279 |
This function is called when a rubber has been placed. |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
280 |
|
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
281 |
`frameIdx` is an integer which stands for the orientation of the rubber. |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
282 |
|
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
283 |
|| `frameIdx` || orientation || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
284 |
|| 0 || horizontal || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
285 |
|| 1 || decreasing right || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
286 |
|| 2 || vertical || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
287 |
|| 3 || increasing right || |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
288 |
|
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
289 |
`centerX` and `centerY` are the coordinates of the rubber’s center. |
1e7586c110f6
Documented 0.9.21 functions onGirderPlacement and onRubberPlacement.
almikes@aol.com
parents:
401
diff
changeset
|
290 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
291 |
== Functions for creating gears == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
292 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
293 |
=== <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
|
294 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
295 |
<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
|
296 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
297 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
298 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
299 |
<code lang="lua"> local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0) |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
300 |
FindPlace(gear, true, 0, LAND_WIDTH)</code> |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
301 |
|
359 | 302 |
=== <tt>!AddVisualGear(x, y, visualGearType, state, critical)</tt> === |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
303 |
|
42
565e15a60043
Edited wiki page LuaAPI through web user interface.
kyberneticist
parents:
39
diff
changeset
|
304 |
<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
|
305 |
</blockquote> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
306 |
Example: |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
307 |
|
50
9033b970cbf7
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
49
diff
changeset
|
308 |
<code lang="lua"> -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created. |
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
309 |
vgear = AddVisualGear(1000, 1000, vgtExplosion, 0, false) |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
310 |
</code> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
311 |
|
181 | 312 |
=== <tt>!SpawnHealthCrate(x, y)</tt> === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
313 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
314 |
<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
|
315 |
</blockquote> |
181 | 316 |
=== <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
|
317 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
318 |
<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
|
319 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
320 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
321 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
322 |
<code lang="lua"> SetAmmo(amGrenade, 0, 0, 0, 1) -- see below |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
323 |
SpawnAmmoCrate(0, 0, amGrenade) -- x=y=0 means random position on map</code> |
181 | 324 |
=== <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
|
325 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
326 |
<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
|
327 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
328 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
329 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
330 |
<code lang="lua"> SetAmmo(amLaserSight, 0, 0, 0, 1) |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
331 |
SpawnUtilityCrate(0, 0, amLaserSight)</code> |
400 | 332 |
|
333 |
=== <tt>!SpawnFakeAmmoCrate(x, y, explode, poison) </tt> === |
|
334 |
||
335 |
Spawns a crate which looks exactly like a real ammo crate but contains not any ammo. It can be use useful for scripted events or to create a trap. |
|
336 |
`explode` and `poison` are booleans. |
|
337 |
If `explode` is `true`, the crate will explode when collected. |
|
338 |
If `poison` is `true`, the collector will be poisoned. |
|
339 |
||
340 |
Example: |
|
341 |
||
342 |
<code lang="lua">SpawnFakeAmmoCrate(500, 432, false, false) -- Spawns a fake ammo crate at the coordinates (500, 434) without explosion and poison. |
|
343 |
</code> |
|
344 |
||
345 |
=== <tt>!SpawnFakeHealthCrate(x, y, explode, poison) </tt> === |
|
346 |
||
347 |
Spawns a crate which looks exactly like a real health crate but it will not heal the player. It can be use useful for scripted events or to create a trap. |
|
348 |
`explode` and `poison` are booleans. |
|
349 |
If `explode` is `true`, the crate will explode when collected. |
|
350 |
If `poison` is `true`, the collector will be poisoned. |
|
351 |
||
352 |
=== <tt>!SpawnFakeUtilityCrate(x, y, explode, poison) </tt> === |
|
353 |
||
354 |
Spawns a crate which looks exactly like a real utility crate but contains not any ammo. It can be use useful for scripted events or to create a trap. |
|
355 |
`explode` and `poison` are booleans. |
|
356 |
If `explode` is `true`, the crate will explode when collected. |
|
357 |
If `poison` is `true`, the collector will be poisoned. |
|
358 |
||
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
359 |
=== <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
|
360 |
|
413
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
361 |
Adds a new hedgehog for current team (last created one with the `AddTeam` function), with bot level and specified health, also hat. |
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
362 |
`botlevel` ranges from `0` to `5`, where `0` denotes a human player and `1` to `5` denote the skill level of a bot. |
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
363 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
364 |
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
|
365 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
366 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
367 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
368 |
<code lang="lua"> local player = AddHog("HH 1", 0, 100, "NoHat") -- botlevel 0 means human player |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
369 |
SetGearPosition(player, 1500, 1000)</code> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
370 |
== Functions to get gear properties == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
371 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
372 |
=== <tt>!GetGearType(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
373 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
374 |
<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
|
375 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
376 |
=== <tt>!GetGearPosition(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
377 |
|
148
f343b50d5619
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
147
diff
changeset
|
378 |
<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
|
379 |
</blockquote> |
181 | 380 |
=== <tt>!GetGearRadius(gearUid)</tt> === |
148
f343b50d5619
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
147
diff
changeset
|
381 |
|
f343b50d5619
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
147
diff
changeset
|
382 |
<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
|
383 |
</blockquote> |
181 | 384 |
=== <tt>!GetGearVelocity(gearUid)</tt> === |
71
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
385 |
|
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
386 |
<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
|
387 |
</blockquote> |
181 | 388 |
=== <tt>!GetGearElasticity(gearUid) </tt> === |
74 | 389 |
|
390 |
<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. |
|
391 |
</blockquote> |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
392 |
=== <tt>!GetHogClan(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
393 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
394 |
<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
|
395 |
</blockquote> |
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
396 |
=== <tt>!GetHogTeamName(gearUid)</tt> === |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
397 |
|
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
398 |
<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
|
399 |
</blockquote> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
400 |
=== <tt>!GetHogName(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
401 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
402 |
<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
|
403 |
</blockquote> |
140
04d82b673bc4
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
139
diff
changeset
|
404 |
=== <tt>!GetEffect(gearUid, effect)</tt> === |
04d82b673bc4
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
139
diff
changeset
|
405 |
|
04d82b673bc4
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
139
diff
changeset
|
406 |
<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
|
407 |
</blockquote> |
373 | 408 |
|
409 |
see !SetEffect for further details |
|
133
b737ccb5b49a
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
132
diff
changeset
|
410 |
=== <tt>!GetHogHat(gearUid)</tt> === |
b737ccb5b49a
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
132
diff
changeset
|
411 |
|
b737ccb5b49a
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
132
diff
changeset
|
412 |
<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
|
413 |
</blockquote> |
141
b10bef9ac535
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
140
diff
changeset
|
414 |
=== <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
|
415 |
|
141
b10bef9ac535
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
140
diff
changeset
|
416 |
<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
|
417 |
</blockquote> |
138
9ca80a93aae0
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
137
diff
changeset
|
418 |
=== <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
|
419 |
|
138
9ca80a93aae0
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
137
diff
changeset
|
420 |
<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
|
421 |
</blockquote> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
422 |
=== <tt>GetX(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
423 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
424 |
<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
|
425 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
426 |
=== <tt>GetY(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
427 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
428 |
<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
|
429 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
430 |
=== <tt>!GetState(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
431 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
432 |
<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
|
433 |
</blockquote> |
114
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
434 |
=== <tt>!GetGearMessage(gearUid)</tt> === |
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
435 |
|
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
436 |
<blockquote>returns the message of the gear. |
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
437 |
</blockquote> |
209
26805ae2a319
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
203
diff
changeset
|
438 |
=== <tt>!GetFollowGear()</tt> === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
439 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
440 |
<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
|
441 |
</blockquote> |
181 | 442 |
=== <tt>!GetTimer(gearUid)</tt> === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
443 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
444 |
<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
|
445 |
</blockquote> |
181 | 446 |
=== <tt>!GetHealth(gearUid)</tt> === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
447 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
448 |
<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
|
449 |
</blockquote> |
181 | 450 |
=== <tt>!GetHogLevel(gearUid)</tt> === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
451 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
452 |
<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
|
453 |
</blockquote> |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
454 |
|
181 | 455 |
=== <tt>!GetVisualGearValues(vgUid)</tt> === |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
456 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
457 |
<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
|
458 |
X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
459 |
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
|
460 |
Most visual gears require little to no modification of parameters. |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
461 |
</blockquote> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
462 |
Example: |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
463 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
464 |
<code lang="lua"> GetVisualGearValues(vgUid) -- return visual gear values |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
465 |
</code> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
466 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
467 |
== Functions to modify gears == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
468 |
|
243
ac34d3763a17
Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents:
209
diff
changeset
|
469 |
=== <tt>!HideHog(gearUid)</tt> === |
ac34d3763a17
Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents:
209
diff
changeset
|
470 |
|
244
74d74086e49b
Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents:
243
diff
changeset
|
471 |
<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
|
472 |
Example: |
ac34d3763a17
Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents:
209
diff
changeset
|
473 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
474 |
<code lang="lua"> gear = AddGear(...) |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
475 |
HideHog(gear) -- Hide the newly created gear.</code> |
243
ac34d3763a17
Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents:
209
diff
changeset
|
476 |
|
ac34d3763a17
Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents:
209
diff
changeset
|
477 |
=== <tt>!RestoreHog(gearUid)</tt> === |
ac34d3763a17
Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents:
209
diff
changeset
|
478 |
|
ac34d3763a17
Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents:
209
diff
changeset
|
479 |
<blockquote>Restores a previously hidden hedgehog.</blockquote> |
ac34d3763a17
Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents:
209
diff
changeset
|
480 |
Example: |
ac34d3763a17
Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents:
209
diff
changeset
|
481 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
482 |
<code lang="lua"> gear = AddGear(...) |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
483 |
HideHog(gear) -- Hide the newly created gear. |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
484 |
RestoreHog(gear) -- Restore the newly hidden gear.</code> |
243
ac34d3763a17
Edited wiki page LuaAPI through web user interface.
szabibibi@gmail.com
parents:
209
diff
changeset
|
485 |
|
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
486 |
=== <tt>!DeleteGear(gearUid)</tt> === |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
487 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
488 |
<blockquote>Deletes a Gear</blockquote> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
489 |
Example: |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
490 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
491 |
<code lang="lua"> gear = AddGear(...) |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
492 |
DeleteGear(gear) -- Delete the newly created gear.</code> |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
493 |
|
181 | 494 |
=== <tt>!DeleteVisualGear(vgUid)</tt> === |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
495 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
496 |
<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
|
497 |
Example: |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
498 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
499 |
<code lang="lua"> vgear = AddVisualGear(...) |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
500 |
DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code> |
39
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
501 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
502 |
|
181 | 503 |
=== <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
|
504 |
|
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
505 |
<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
|
506 |
Most visual gears require little to no modification of parameters. |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
507 |
</blockquote> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
508 |
Example: |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
509 |
|
51
5ab1cf4c7194
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
50
diff
changeset
|
510 |
<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. |
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
511 |
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
|
512 |
</code> |
45a576e56425
Updating with visual gear functions and delete gear
kyberneticist
parents:
38
diff
changeset
|
513 |
|
136
538adf2596b5
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
135
diff
changeset
|
514 |
=== <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
|
515 |
|
136
538adf2596b5
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
135
diff
changeset
|
516 |
<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
|
517 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
518 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
519 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
520 |
<code lang="lua"> gear = AddGear(...) |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
521 |
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
|
522 |
=== <tt>!HogSay(gearUid, text, manner)</tt> === |
233360620ae2
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
58
diff
changeset
|
523 |
|
233360620ae2
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
58
diff
changeset
|
524 |
<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
|
525 |
</blockquote> |
233360620ae2
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
58
diff
changeset
|
526 |
Example: |
233360620ae2
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
58
diff
changeset
|
527 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
528 |
<code lang="lua"> HogSay(CurrentHedgehog, "I wonder what to do...", SAY_THINK) -- thought bubble with text |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
529 |
HogSay(CurrentHedgehog, "I'm hungry...", SAY_SAY) -- speech bubble with text |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
530 |
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
|
531 |
</code> |
52
714b56de5ea1
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
51
diff
changeset
|
532 |
=== <tt>!HogTurnLeft(gearUid, boolean)</tt> === |
714b56de5ea1
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
51
diff
changeset
|
533 |
|
714b56de5ea1
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
51
diff
changeset
|
534 |
<blockquote>Faces the specified hog left or right. |
714b56de5ea1
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
51
diff
changeset
|
535 |
</blockquote> |
714b56de5ea1
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
51
diff
changeset
|
536 |
Example: |
714b56de5ea1
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
51
diff
changeset
|
537 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
538 |
<code lang="lua"> HogTurnLeft(CurrentHedgehog, true) -- turns CurrentHedgehog left |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
539 |
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
|
540 |
=== <tt>!SetGearPosition(gearUid, x, y)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
541 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
542 |
<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
|
543 |
</blockquote> |
181 | 544 |
=== <tt>!SetGearVelocity(gearUid, dx, dy)</tt> === |
71
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
545 |
|
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
546 |
<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
|
547 |
</blockquote> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
548 |
=== <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
|
549 |
|
101 | 550 |
<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
|
551 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
552 |
Example: |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
553 |
|
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
554 |
<code lang="lua"> SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
555 |
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
|
556 |
=== <tt>!AddAmmo(gearUid, ammoType, ammoCount) (0.9.16) </tt> === |
101 | 557 |
|
135
124b11219537
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
134
diff
changeset
|
558 |
<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 | 559 |
|
560 |
*Note:* The effectiveness of this function may be limited due to problems with gfPerHogAmmo in lua scripting. |
|
561 |
||
562 |
</blockquote> |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
563 |
=== <tt>!SetHealth(gearUid, health)</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>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
|
566 |
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
|
567 |
|
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
568 |
For example: |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
569 |
|
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
570 |
* 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
|
571 |
* 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
|
572 |
* 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
|
573 |
* (And more!) |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
574 |
|
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
575 |
<code lang="lua"> function onGearAdd(gear) |
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
576 |
if (GetGearType(gear) == gtRCPlaane) then |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
577 |
SetHealth(gear, 10) |
99
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
578 |
end |
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
579 |
if (GetGearType(gear) == gtJetpack) then |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
580 |
SetHealth(gear, 1000) |
99
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
581 |
end |
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
582 |
if (GetGearType(gear) == gtMine) then |
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
583 |
SetHealth(gear, 0) |
99
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
584 |
end |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
585 |
end</code> |
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
586 |
|
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
587 |
|
983ec9ac63c7
Added a non-exhaustive list of examples for further applications of SetHealth()
RedGrinner@gmail.com
parents:
98
diff
changeset
|
588 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
589 |
</blockquote> |
373 | 590 |
=== <tt>!SetEffect(gearUid, effect, effectState)</tt> === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
591 |
|
373 | 592 |
<blockquote>Sets the state for one of the effects <tt>heInvulnerable, heResurrectable, hePoisoned, heResurrected, heFrozen</tt> for the specified hedgehog gear. |
593 |
A value of 0 usually means the effect is disabled, values other than that indicate that it is enabled and in some cases specify e.g. the remaining time of that effect. |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
594 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
595 |
Example: (sets all bots poisoned) |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
596 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
597 |
<code lang="lua"> function onGearAdd(gear) |
361
315e9db1f458
no need to prevent linking of names in code blocks
sheepyluva@gmail.com
parents:
360
diff
changeset
|
598 |
if (GetGearType(gear) == gtHedgehog) and (GetBotLevel(gear) > 0) then |
373 | 599 |
SetEffect(gear, hePoisoned, 1) |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
600 |
end |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
601 |
end</code> |
181 | 602 |
|
373 | 603 |
Note: prior to the ice-gun release, 0.9.19 (commit 10a0a31804f3 ) effectState was of boolean type (true = effect enabled, false = effect disabled) |
604 |
||
17 | 605 |
=== <tt>CopyPV(gearUid, gearUid)</tt> === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
606 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
607 |
<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
|
608 |
</blockquote> |
71
2dcbebb06088
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
70
diff
changeset
|
609 |
=== <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
|
610 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
611 |
<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
|
612 |
</blockquote> |
132
e41fcc3ff67a
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
126
diff
changeset
|
613 |
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
|
614 |
=== <tt>!FollowGear(gearUid)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
615 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
616 |
<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
|
617 |
</blockquote> |
139
6bf231a611a7
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
138
diff
changeset
|
618 |
=== <tt>!SetHogName(gearUid, name)</tt> === |
6bf231a611a7
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
138
diff
changeset
|
619 |
|
6bf231a611a7
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
138
diff
changeset
|
620 |
<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
|
621 |
</blockquote> |
398
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
622 |
=== <tt>!SetHogTeamName(gearUid, name)</tt> === |
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
623 |
|
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
624 |
<blockquote>Sets the team name of the specified hedgehog gear |
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
625 |
</blockquote> |
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
626 |
=== <tt>!SetWeapon(ammoType)</tt> === |
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
627 |
|
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
628 |
<blockquote>Sets the selected weapon of CurrentHedgehog to one of the [AmmoTypes Ammo Type]. |
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
629 |
|
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
630 |
<b>Example:</b> |
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
631 |
|
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
632 |
<code lang="lua"> |
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
633 |
AddAmmo(CurrentHedgehog, amBazooka, 1) -- give the CurrentHedgehog a bazooka |
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
634 |
SetWeapon(amBazooka) -- select the Bazooka.</code> |
1f9f7fb00be3
Added entries for SetHogTeamName, SetWeapon
RedGrinner@gmail.com
parents:
394
diff
changeset
|
635 |
</blockquote> |
408 | 636 |
|
410 | 637 |
=== <tt>!SetNextWeapon()</tt> (0.9.21) === |
408 | 638 |
This function makes the current hedgehog switch to the next weapon in list of available weapons. It can be used for example in trainings to pre-select a weapon. |
639 |
||
640 |
||
139
6bf231a611a7
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
138
diff
changeset
|
641 |
=== <tt>!SetHogHat(gearUid, hat)</tt> === |
6bf231a611a7
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
138
diff
changeset
|
642 |
|
6bf231a611a7
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
138
diff
changeset
|
643 |
<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
|
644 |
</blockquote> |
6bf231a611a7
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
138
diff
changeset
|
645 |
=== <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
|
646 |
|
6bf231a611a7
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
138
diff
changeset
|
647 |
<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
|
648 |
</blockquote> |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
649 |
=== <tt>!SetState(gearUid, state)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
650 |
|
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
651 |
<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
|
652 |
</blockquote> |
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
653 |
|
114
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
654 |
=== <tt>!SetGearMessage(gearUid, message)</tt> === |
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
655 |
|
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
656 |
<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
|
657 |
</blockquote> |
e311af715b57
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
107
diff
changeset
|
658 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
659 |
=== <tt>!SetTag(gearUid, tag)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
660 |
|
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
661 |
<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
|
662 |
</blockquote> |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
663 |
|
181 | 664 |
=== <tt>!SetTimer(gearUid, timer)</tt> === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
665 |
|
13 | 666 |
<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
|
667 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
668 |
|
360 | 669 |
=== <tt>!SetHogLevel(gearUid, level)</tt> === |
69
48f6e6c0076d
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
68
diff
changeset
|
670 |
|
48f6e6c0076d
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
68
diff
changeset
|
671 |
<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
|
672 |
</blockquote> |
48f6e6c0076d
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
68
diff
changeset
|
673 |
|
360 | 674 |
=== <tt>!SetGearPos(gearUid, value) (0.9.18-dev)</tt> === |
183
72b2bac582e2
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
182
diff
changeset
|
675 |
|
72b2bac582e2
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
182
diff
changeset
|
676 |
<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
|
677 |
|
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
678 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
679 |
== Gameplay functions == |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
680 |
|
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
681 |
=== `GameFlags` === |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
682 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
683 |
==== <tt>!ClearGameFlags()</tt> ==== |
380 | 684 |
|
381
87b3dcfe11cc
I hate the wiki syntax... and I think it hates me too
sheepyluva@gmail.com
parents:
380
diff
changeset
|
685 |
<blockquote>Disables *all* !GameFlags |
380 | 686 |
</blockquote> |
687 |
||
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
688 |
==== <tt>!DisableGameFlags(gameflag, ...)</tt> ==== |
380 | 689 |
|
381
87b3dcfe11cc
I hate the wiki syntax... and I think it hates me too
sheepyluva@gmail.com
parents:
380
diff
changeset
|
690 |
<blockquote>Disables the listed !GameFlags, without changing the status of other !GameFlags |
380 | 691 |
</blockquote> |
692 |
||
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
693 |
==== <tt>!EnableGameFlags(gameflag, ...)</tt> ==== |
380 | 694 |
|
381
87b3dcfe11cc
I hate the wiki syntax... and I think it hates me too
sheepyluva@gmail.com
parents:
380
diff
changeset
|
695 |
<blockquote>Enables the listed !GameFlags, without changing the status of other !GameFlags |
380 | 696 |
</blockquote> |
697 |
||
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
698 |
==== <tt>!GetGameFlag(gameflag)</tt> ==== |
380 | 699 |
|
700 |
<blockquote>Returns true if the specified gameflag is enabled, otherwise false |
|
701 |
</blockquote> |
|
702 |
||
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
703 |
=== Environment === |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
704 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
705 |
==== <tt>!SetGravity(percent)</tt> ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
706 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
707 |
<blockquote>Changes the current gravity of the game in percent (relative to default, integer value). |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
708 |
Setting it to 100 will set gravity to default gravity of hedgewars, 200 will double it, etc. |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
709 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
710 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
711 |
==== <tt>!GetGravity()</tt> ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
712 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
713 |
<blockquote>Returns the current gravity in percent |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
714 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
715 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
716 |
==== <tt>!SetWaterLine(waterline)</tt> ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
717 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
718 |
<blockquote>Sets the water level to the specified y-coordinate |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
719 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
720 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
721 |
==== <tt>!SetWind(windSpeed)</tt> ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
722 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
723 |
<blockquote>Sets the current wind in the range of -100 to 100. Use together with gfDisableWind for full control. |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
724 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
725 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
726 |
==== <tt>!EndGame()</tt> ==== |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
727 |
|
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
728 |
<blockquote>Makes the game end. |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
729 |
</blockquote> |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
730 |
|
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
731 |
=== Map === |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
732 |
==== <tt>!MapHasBorder()</tt> ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
733 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
734 |
<blockquote>Returns true/false if the map has a border or not. |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
735 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
736 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
737 |
==== <tt>!TestRectForObstacle(x1, y1, x2, y2, landOnly) (0.9.16) </tt> ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
738 |
<blockquote>Checks the rectangle between the given coordinates for possible collisions. set landOnly to true if you don't want to check for collisions with gears (hedgehogs, etc.) |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
739 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
740 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
741 |
==== <tt>!PlaceGirder(x, y, state)</tt> (0.9.16) ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
742 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
743 |
<blockquote>Places a girder with centre points x, y and the chosen state. |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
744 |
These are the accepted states: |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
745 |
* 0: short, horizontal |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
746 |
* 1: short, decreasing right |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
747 |
* 2: short, vertical |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
748 |
* 3: short, increasing right |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
749 |
* 4: long, horizontal |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
750 |
* 5: long, decreasing right |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
751 |
* 6: long, vertical |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
752 |
* 7: long, increasing right |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
753 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
754 |
|
412 | 755 |
|
756 |
==== <tt>!AddPoint(x, y [, width [, erase] ])</tt> (0.9.21) ==== |
|
757 |
This function is used to draw your own maps using Lua. The maps drawn with this are of type “hand-drawn”. |
|
758 |
||
759 |
The function takes a `x`,`y` location, a `width` (means start of a new line) and `erase` (if `false`, this function will draw normally, if `true`, this function will erase drawn stuff). |
|
760 |
||
761 |
This function must be called within `onGameInit`, where `MapGen` has been set to `mgDrawn`. You also should call `FlushPoints` when you are finished with drawing. |
|
762 |
||
763 |
==== <tt>!FlushPoints()</tt> (0.9.21) ==== |
|
764 |
Makes sure that all the points/lines specified using `AddPoint` are actually applied to the map. This function must be called within `onGameInit`. |
|
765 |
||
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
766 |
=== Current hedgehog === |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
767 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
768 |
==== <tt>!GetCurAmmoType()</tt> (0.9.16) ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
769 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
770 |
<blockquote>Returns the currently selected [AmmoTypes Ammo Type]. |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
771 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
772 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
773 |
==== <tt>!SwitchHog(gearUid)</tt> (0.9.16) ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
774 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
775 |
<blockquote>This function will switch to the hedgehog with the specified Uid.</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
776 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
777 |
==== <tt>!SetInputMask(mask)</tt> ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
778 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
779 |
<blockquote>Masks specified player input. |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
780 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
781 |
Example: |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
782 |
<code lang="lua"> -- masks the long and high jump commands |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
783 |
SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump))) |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
784 |
-- clears input mask, allowing player to take actions |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
785 |
SetInputMask(0xFFFFFFFF) |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
786 |
</code> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
787 |
Note: Using the input mask is an effective way to script uninterrupted cinematics, or create modes such as No Jumping. |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
788 |
|
405 | 789 |
==== <tt>!GetInputMask()</tt> ==== |
790 |
||
791 |
Returns the current input mask of the player. |
|
792 |
||
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
793 |
=== Randomness === |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
794 |
==== <tt>!GetRandom(number)</tt> ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
795 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
796 |
<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. |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
797 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
798 |
|
413
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
799 |
=== Clans and teams === |
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
800 |
==== <tt>!AddTeam(teamname, color, grave, fort, voicepack, flag)</tt> ==== |
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
801 |
|
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
802 |
<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. |
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
803 |
</blockquote> |
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
804 |
Notice: This works only for singleplayer's training missions for now and will desync multiplayer games. Flag setting is dev only. |
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
805 |
|
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
806 |
Example: |
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
807 |
|
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
808 |
<code lang="lua"> AddTeam("team 1", 0xDD0000, "Simple", "Island", "Default", "hedgewars")</code> |
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
809 |
|
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
810 |
==== <tt>!DismissTeam(teamname)</tt> ==== |
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
811 |
Removes the team with the given team name from the game. |
6d90d6994e95
Add DismissTeam, move AddTeam to new “Clans and teams” section.
almikes@aol.com
parents:
412
diff
changeset
|
812 |
|
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
813 |
==== <tt>!GetClanColor(clan)</tt> ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
814 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
815 |
<blockquote>Returns the colour of the chosen clan by its number. |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
816 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
817 |
==== <tt>!SetClanColor(clan, color)</tt> ==== |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
818 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
819 |
<blockquote>Sets the colour of the chosen clan by its number. |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
820 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
821 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
822 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
823 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
824 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
825 |
== Functions affecting the GUI == |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
826 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
827 |
=== <tt>!AddCaption(text)</tt> === |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
828 |
|
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
829 |
<blockquote>Display event text in the upper part of the screen. |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
830 |
</blockquote> |
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
831 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
832 |
=== <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
|
833 |
|
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
834 |
<blockquote>Use to tell the player what he is supposed to do. |
79 | 835 |
|
836 |
As of (0.9.15), icon currently accepts: |
|
81
a381e4547712
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
80
diff
changeset
|
837 |
* -amBazooka, -amShotgun etc. (and other ammo types) |
a381e4547712
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
80
diff
changeset
|
838 |
* 0 (Gold Crown icon) |
a381e4547712
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
80
diff
changeset
|
839 |
* 1 (Target icon) |
a381e4547712
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
80
diff
changeset
|
840 |
* 2 (Exclamation mark) |
a381e4547712
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
80
diff
changeset
|
841 |
* 3 (Question mark) |
a381e4547712
Edited wiki page LuaAPI through web user interface.
RedGrinner
parents:
80
diff
changeset
|
842 |
* 4 (Gold star) |
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
843 |
</blockquote> |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
844 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
845 |
=== <tt>!HideMission()</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
846 |
|
143
58019b91cd69
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
142
diff
changeset
|
847 |
<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
|
848 |
</blockquote> |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
849 |
|
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
850 |
=== <tt>!SetZoom(zoomLevel)</tt> === |
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
851 |
|
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
852 |
<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 |
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
853 |
</blockquote> |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
854 |
|
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
855 |
=== <tt>!GetZoom()</tt> === |
147
379d7931ffc7
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
146
diff
changeset
|
856 |
|
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
857 |
<blockquote>Returns the current zoom level |
147
379d7931ffc7
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
146
diff
changeset
|
858 |
</blockquote> |
379d7931ffc7
Edited wiki page LuaAPI through web user interface.
RedGrinner@gmail.com
parents:
146
diff
changeset
|
859 |
|
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
860 |
== Sound functions == |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
861 |
=== <tt>!PlaySound(soundId)</tt> === |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
862 |
|
28
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
863 |
<blockquote>Plays the specified sound. |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
864 |
</blockquote> |
026591d95ac6
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
24
diff
changeset
|
865 |
|
181 | 866 |
=== <tt>!PlaySound(soundId, gearUid)</tt> === |
410 | 867 |
/ |
70
ff7d4c176303
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
69
diff
changeset
|
868 |
<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
|
869 |
</blockquote> |
ff7d4c176303
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
69
diff
changeset
|
870 |
|
77 | 871 |
|
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
872 |
== File system functions == |
410 | 873 |
=== <tt>!HedgewarsScriptLoad(scriptPath)</tt> === |
407 | 874 |
Loads a script (i.e. a [LuaLibraries library]) from the specified `scriptPath`. The root directory is here Hedgewars’ data directory. |
875 |
||
876 |
Example: |
|
877 |
{{{ |
|
878 |
HedgewarsScriptLoad("/Scripts/Locale.lua") -- loads locale library |
|
879 |
}}} |
|
880 |
||
181 | 881 |
=== <tt>!GetDataPath()</tt> === |
68
fd230628d72c
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
67
diff
changeset
|
882 |
|
fd230628d72c
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
67
diff
changeset
|
883 |
<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
|
884 |
</blockquote> |
fd230628d72c
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
67
diff
changeset
|
885 |
|
181 | 886 |
=== <tt>!GetUserDataPath()</tt> === |
180
96e6b405bcf6
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
179
diff
changeset
|
887 |
|
96e6b405bcf6
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
179
diff
changeset
|
888 |
<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
|
889 |
</blockquote> |
96e6b405bcf6
Edited wiki page LuaAPI through web user interface.
azizi.054@gmail.com
parents:
179
diff
changeset
|
890 |
|
73
c6623486d077
Edited wiki page LuaAPI through web user interface.
henrik.rostedt
parents:
72
diff
changeset
|
891 |
|
89
caf6544f767a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
87
diff
changeset
|
892 |
|
caf6544f767a
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
87
diff
changeset
|
893 |
|
404
37d44392ad2b
Reorganize the section “other functions” into several logical subunits.
almikes@aol.com
parents:
403
diff
changeset
|
894 |
== Stats functions == |
360 | 895 |
=== <tt>!SendStat(TStatInfoType, statMessage[, teamName])</tt> (0.9.20) === |
328
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
896 |
|
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
897 |
<blockquote>Exposes the uIO SendStat to the lua scripts. Use it to produce custom stat pages. |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
898 |
|
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
899 |
<b>Examples:</b> |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
900 |
|
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
901 |
<code lang="lua"> |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
902 |
-- will automatically change the health icon to a star |
347
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
903 |
SendStat(siGraphTitle,'Custom Graph Title') |
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
904 |
SendStat(siGameResult,'Winner is Team A!') |
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
905 |
SendStat(siCustomAchievement,'This is a custom mesasge posted in the Details section!') |
328
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
906 |
-- Changes the word kill to Point, call it just before sending kills/score for each hog |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
907 |
-- in case you want to change the word i.e. print Point or Points |
347
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
908 |
SendStat(siPointType,'Point') |
328
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
909 |
-- if above function call was not used it will print 3 kills for teamName in Ranking section. |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
910 |
-- if it was used it will print 3 Point for teamName in Ranking section. |
347
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
911 |
SendStat(siPlayerKills,'3',teamName) |
328
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
912 |
-- call siClanHealth to send the "value" of a clan that will be used for the graph creation |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
913 |
-- a good idea is to call it always for every hog by using the runOnGears(function) |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
914 |
-- in normal mode "value" represents clan health |
347
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
915 |
SendStat(siClanHealth, "100",teamName) |
328
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
916 |
-- most hedgehogs killed in a round (hedgeHogName is who killed them) |
347
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
917 |
SendStat(siMaxStepKills, "1 hedgeHogName (teamName)") |
328
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
918 |
-- hog with most damage inflicted to his own team |
347
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
919 |
SendStat(siMaxTeamDamage, "100 hedgeHogName") |
328
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
920 |
-- total number of killed hedgehogs |
347
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
921 |
SendStat(siKilledHHs, "1") |
328
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
922 |
-- increases the wins of local teams in case the given number is greater than 0 |
347
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
923 |
SendStat(siTeamStats, "teamName:0:") |
328
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
924 |
-- best shot award |
347
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
925 |
SendStat(siMaxStepDamage, "30 hedgeHogName (teamName)") |
328
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
926 |
-- team with most kills of own hedgehogs |
347
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
927 |
SendStat(siMaxStepDamage, "2 teamName") |
328
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
928 |
-- team with most skips |
347
edc8d322d02d
Edited wiki page LuaAPI, fixing SendStat
pntanasis@gmail.com
parents:
346
diff
changeset
|
929 |
SendStat(siMaxTurnSkips, "3 teamName") |
328
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
930 |
</code> |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
931 |
|
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
932 |
<b>Important:</b> |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
933 |
|
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
934 |
* As the game engine send stats to the front end at the end of the game one should send her stats when the game is going to finish and right before the call of EndGame(). (Note: Stats are sent from the engine in CheckForWin. If conditions are met(win or draw) then SendStats(uStats) is called.) |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
935 |
* Calling just EndGame() won't produce any stats. |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
936 |
* If one would like to produce a custom graph see also SendHealthStatsOff(). |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
937 |
|
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
938 |
</blockquote> |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
939 |
|
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
940 |
=== <tt>!SendHealthStatsOff()</tt> (0.9.20) === |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
941 |
|
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
942 |
<blockquote>Prevents the engine of sending health stats to the front end. |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
943 |
|
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
944 |
If any health stats haven't been sent before this will cause the health graph to the stats page to be hidden. Use this function in the lua scripts to produce custom graphs by calling it inside onGameStart() and using the SendStat().</blockquote> |
fdc71ac8db83
Updated wiki page LuaAPI with the SendStat() and SendHealthStatsOff() functions.
pntanasis@gmail.com
parents:
313
diff
changeset
|
945 |
|
382 | 946 |
== Math Functions == |
947 |
||
383
6679b75048c0
I really have to get used to using preview on google code wiki...
sheepyluva@gmail.com
parents:
382
diff
changeset
|
948 |
=== <tt>div(dividend, divisor)</tt> === |
382 | 949 |
|
950 |
<blockquote>Performs an integer division and returns the result. |
|
951 |
The result is an integer and has the value of the first parameter (integer) divided by the second parameter (integer), rounded towards zero. |
|
952 |
</blockquote> |
|
953 |
||
401
aee281298267
Documented the following functions: band, bnot, bor.
almikes@aol.com
parents:
400
diff
changeset
|
954 |
=== <tt>band(value1, value2)</tt> === |
aee281298267
Documented the following functions: band, bnot, bor.
almikes@aol.com
parents:
400
diff
changeset
|
955 |
Returns the bitwise logical AND of `value1` and `value2`. |
aee281298267
Documented the following functions: band, bnot, bor.
almikes@aol.com
parents:
400
diff
changeset
|
956 |
|
aee281298267
Documented the following functions: band, bnot, bor.
almikes@aol.com
parents:
400
diff
changeset
|
957 |
=== <tt>bor(value1, value2)</tt> === |
aee281298267
Documented the following functions: band, bnot, bor.
almikes@aol.com
parents:
400
diff
changeset
|
958 |
Returns the bitwise logical OR of `value1` and `value2`. |
aee281298267
Documented the following functions: band, bnot, bor.
almikes@aol.com
parents:
400
diff
changeset
|
959 |
|
aee281298267
Documented the following functions: band, bnot, bor.
almikes@aol.com
parents:
400
diff
changeset
|
960 |
=== <tt>bnot(value)</tt> === |
aee281298267
Documented the following functions: band, bnot, bor.
almikes@aol.com
parents:
400
diff
changeset
|
961 |
Returns the bitwise logical NOT of `value`. |
aee281298267
Documented the following functions: band, bnot, bor.
almikes@aol.com
parents:
400
diff
changeset
|
962 |
|
aee281298267
Documented the following functions: band, bnot, bor.
almikes@aol.com
parents:
400
diff
changeset
|
963 |
|
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
964 |
== Debugging Functions == |
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
965 |
|
394
b2742eb19396
Edited wiki page LuaAPI through web abuser interface.
sheepyluva@gmail.com
parents:
384
diff
changeset
|
966 |
=== <tt>!ParseCommand(string)</tt> === |
b2742eb19396
Edited wiki page LuaAPI through web abuser interface.
sheepyluva@gmail.com
parents:
384
diff
changeset
|
967 |
|
b2742eb19396
Edited wiki page LuaAPI through web abuser interface.
sheepyluva@gmail.com
parents:
384
diff
changeset
|
968 |
<blockquote>Makes the gameclient parse the specified custom command. |
b2742eb19396
Edited wiki page LuaAPI through web abuser interface.
sheepyluva@gmail.com
parents:
384
diff
changeset
|
969 |
|
b2742eb19396
Edited wiki page LuaAPI through web abuser interface.
sheepyluva@gmail.com
parents:
384
diff
changeset
|
970 |
*Note*: Please be aware that the *engine protocol can (and will) change* between releases. |
b2742eb19396
Edited wiki page LuaAPI through web abuser interface.
sheepyluva@gmail.com
parents:
384
diff
changeset
|
971 |
|
b2742eb19396
Edited wiki page LuaAPI through web abuser interface.
sheepyluva@gmail.com
parents:
384
diff
changeset
|
972 |
If you do use ParseCommand to overcome a shortcoming in our Lua API (e.g. a missing Function), please make sure to [https://code.google.com/p/hedgewars/issues/entry report the issue]. |
b2742eb19396
Edited wiki page LuaAPI through web abuser interface.
sheepyluva@gmail.com
parents:
384
diff
changeset
|
973 |
|
b2742eb19396
Edited wiki page LuaAPI through web abuser interface.
sheepyluva@gmail.com
parents:
384
diff
changeset
|
974 |
With your report we can fix the shortcoming in future releases. |
b2742eb19396
Edited wiki page LuaAPI through web abuser interface.
sheepyluva@gmail.com
parents:
384
diff
changeset
|
975 |
This will allow scripts to use the previously missing feature in a way that won't break! |
b2742eb19396
Edited wiki page LuaAPI through web abuser interface.
sheepyluva@gmail.com
parents:
384
diff
changeset
|
976 |
</blockquote> |
b2742eb19396
Edited wiki page LuaAPI through web abuser interface.
sheepyluva@gmail.com
parents:
384
diff
changeset
|
977 |
|
181 | 978 |
=== <tt>!WriteLnToConsole(string)</tt> === |
12
74ead59b6c64
LuaAPI page + GearTypes,AmmoTypes,Sounds,States listing pages
Tobias Neumann <mail@tobias-neumann.eu>
parents:
diff
changeset
|
979 |
|
184
346bf9196f84
Edited wiki page LuaAPI through web user interface.
henrik.rostedt@gmail.com
parents:
183
diff
changeset
|
980 |
<blockquote>Writes (string) to the game0.log, found in the user data directory. |
181 | 981 |
</blockquote> |