~fkmclane/armagetronad/armagetron.py

« back to all changes in this revision

Viewing changes to api.html

  • Committer: Foster McLane
  • Date: 2018-06-24 17:03:05 UTC
  • Revision ID: fkmclane@gmail.com-20180624170305-gvu8wk5gm6a82qbg
add initial files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html>
 
2
<html>
 
3
        <head>
 
4
                <title>Scripting Library</title>
 
5
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 
6
                <link href="/res/common.css" rel="stylesheet" type="text/css"/>
 
7
                <style>
 
8
                        .content table {
 
9
                                width: 100%;
 
10
                        }
 
11
 
 
12
                        .content table td:first-child {
 
13
                                width: 200px;
 
14
                        }
 
15
 
 
16
                        .content pre {
 
17
                                background: rgba(60, 110, 80, 0.6);
 
18
                                border: 2px solid #000;
 
19
                                padding: 0px 40px 0px 40px;
 
20
                        }
 
21
                </style>
 
22
        </head>
 
23
        <body>
 
24
                <div class="header">
 
25
                        <img src="/res/aalogo.png" alt="" class="logo"/>
 
26
                        <span class="title">Scripting Library</span>
 
27
                </div>
 
28
                <div class="content">
 
29
                        To use the library, you must first use <code>import armagetron</code> at the beginning of your python script.  You must also call <code>armagetron.run()</code> after all of your handler initialization.  This function will then go into a loop and parse all of the ladderlog commands for you.  Examples are available at the bottom.
 
30
                        <br/>
 
31
                        <br/>
 
32
                        <h1>Namespace <code>armagetron</code>:</h1>
 
33
                        <table border="1">
 
34
                                <tr>
 
35
                                        <td rowspan="2"><code>run()</code></td>
 
36
                                        <td>Description:</td>
 
37
                                        <td>Let the library listen to the ladderlog.</td>
 
38
                                </tr>
 
39
                                <tr>
 
40
                                </tr>
 
41
                                <tr>
 
42
                                        <td rowspan="2"><code>send_command(command)</code></td>
 
43
                                        <td>Description:</td>
 
44
                                        <td>Sends a command to the server.</td>
 
45
                                </tr>
 
46
                                <tr>
 
47
                                        <td>Parameters:</td>
 
48
                                        <td><code>command</code> (string) - Command to send to the server.  A newline is added automatically.</td>
 
49
                                </tr>
 
50
                                <tr>
 
51
                                        <td rowspan="2"><code>add_handler(command, handler)</code></td>
 
52
                                        <td>Description:</td>
 
53
                                        <td>Adds a handler that will be called when the specified ladderlog command is received.</td>
 
54
                                </tr>
 
55
                                <tr>
 
56
                                        <td>Parameters:</td>
 
57
                                        <td><code>command</code> (string) - Ladderlog command to attach the handler.<br/><br/>
 
58
                                        <code>handler</code> (function) - A callback function in the form of <code>handler(command)</code> where command is a list representing the parameters of the command where the first parameter is the command itself.</td>
 
59
                                </tr>
 
60
                                <tr>
 
61
                                        <td rowspan="2"><code>remove_handler(command, handler)</code></td>
 
62
                                        <td>Description:</td>
 
63
                                        <td>Removes a handler from a ladderlog command.</td>
 
64
                                </tr>
 
65
                                <tr>
 
66
                                        <td>Parameters:</td>
 
67
                                        <td><code>command</code> (string) - Ladderlog command of the handler.<br/><br/>
 
68
                                        <code>handler</code> (function) - The handler to remove.</td>
 
69
                                </tr>
 
70
                                <tr>
 
71
                                        <td rowspan="2"><code>set_chat_handler(command, handler)</code></td>
 
72
                                        <td>Description:</td>
 
73
                                        <td>Sets the handler for a chat command.</td>
 
74
                                </tr>
 
75
                                <tr>
 
76
                                        <td>Parameters:</td>
 
77
                                        <td><code>command</code> (string) - Chat command (including the beginning slash) to attach the handler.<br/><br/>
 
78
                                        <code>handler</code> (function) - A callback function in the form of <code>handler(command)</code> where command is a list representing the command where the first element is the command itself (including the beginning slash), the second element is the player's name who issued the command, the third element is the player's IP address, the fourth element is the player's access level, and the rest are the command arguments.</td>
 
79
                                </tr>
 
80
                                <tr>
 
81
                                        <td rowspan="2"><code>remove_chat_handler(command)</code></td>
 
82
                                        <td>Description:</td>
 
83
                                        <td>Removes a handler from a chat command (making the command unknown).</td>
 
84
                                </tr>
 
85
                                <tr>
 
86
                                        <td>Parameters:</td>
 
87
                                        <td><code>command</code> (string) - Chat command to remove the handler from (including the beginning slash).</td>
 
88
                                </tr>
 
89
                                <tr>
 
90
                                        <td rowspan="2"><code>say(message)</code></td>
 
91
                                        <td>Description:</td>
 
92
                                        <td>Sends the SAY command with the message.  Appears as "<code><span style="color: red">Admin</span>: message</code>" in each player's console.</td>
 
93
                                </tr>
 
94
                                <tr>
 
95
                                        <td>Parameters:</td>
 
96
                                        <td><code>message</code> (string) - Message to say.</td>
 
97
                                </tr>
 
98
                                <tr>
 
99
                                        <td rowspan="2"><code>console_message(message)</code></td>
 
100
                                        <td>Description:</td>
 
101
                                        <td>Prints <code>message</code> to every player's console.</td>
 
102
                                </tr>
 
103
                                <tr>
 
104
                                        <td>Parameters:</td>
 
105
                                        <td><code>message</code> (string) - Message to send.</td>
 
106
                                </tr>
 
107
                                <tr>
 
108
                                        <td rowspan="2"><code>center_message(message)</code></td>
 
109
                                        <td>Description:</td>
 
110
                                        <td>Prints <code>message</code> on everybody's screens.</td>
 
111
                                </tr>
 
112
                                <tr>
 
113
                                        <td>Parameters:</td>
 
114
                                        <td><code>message</code> (string) - Message to send.</td>
 
115
                                </tr>
 
116
                                <tr>
 
117
                                        <td rowspan="2"><code>send_message(player, message)</code></td>
 
118
                                        <td>Description:</td>
 
119
                                        <td>Prints <code>message</code> to the specified player's console.</td>
 
120
                                </tr>
 
121
                                <tr>
 
122
                                        <td>Parameters:</td>
 
123
                                        <td><code>player</code> (string or Player) - Player to send the message.<br/><br/>
 
124
                                        <code>message</code> (string) - Message to send.</td>
 
125
                                </tr>
 
126
                                <tr>
 
127
                                        <td rowspan="2"><code>pause_round()</code></td>
 
128
                                        <td>Description:</td>
 
129
                                        <td>Tell the server to wait before starting a new round.</td>
 
130
                                </tr>
 
131
                                <tr>
 
132
                                </tr>
 
133
                                <tr>
 
134
                                        <td rowspan="2"><code>continue_round()</code></td>
 
135
                                        <td>Description:</td>
 
136
                                        <td>Tell the server to start the round (if it was paused).</td>
 
137
                                </tr>
 
138
                                <tr>
 
139
                                </tr>
 
140
                                <tr>
 
141
                                        <td rowspan="2"><code>set_repository(address)</code></td>
 
142
                                        <td>Description:</td>
 
143
                                        <td>Sets the resource server.</td>
 
144
                                </tr>
 
145
                                <tr>
 
146
                                        <td>Parameters:</td>
 
147
                                        <td><code>address</code> (string) - URI of the resource server.</td>
 
148
                                </tr>
 
149
                                <tr>
 
150
                                        <td rowspan="2"><code>set_map(resource)</code></td>
 
151
                                        <td>Description:</td>
 
152
                                        <td>Sets the current map.</td>
 
153
                                </tr>
 
154
                                <tr>
 
155
                                        <td>Parameters:</td>
 
156
                                        <td><code>resource</code> (string) - Resource of the map.</td>
 
157
                                </tr>
 
158
                                <tr>
 
159
                                        <td rowspan="2"><code>include(config)</code></td>
 
160
                                        <td>Description:</td>
 
161
                                        <td>Includes a configuration file.</td>
 
162
                                </tr>
 
163
                                <tr>
 
164
                                        <td>Parameters:</td>
 
165
                                        <td><code>config</code> (string) - Name of the configuration file to include.</td>
 
166
                                </tr>
 
167
                                <tr>
 
168
                                        <td rowspan="2"><code>rinclude(config)</code></td>
 
169
                                        <td>Description:</td>
 
170
                                        <td>Includes a configuration file from a resource.</td>
 
171
                                </tr>
 
172
                                <tr>
 
173
                                        <td>Parameters:</td>
 
174
                                        <td><code>config</code> (string) - Resource address of the configuration file to include.</td>
 
175
                                </tr>
 
176
                                <tr>
 
177
                                        <td rowspan="2"><code>reload()</code></td>
 
178
                                        <td>Description:</td>
 
179
                                        <td>Reload's the server's configuration by including the default settings.</td>
 
180
                                </tr>
 
181
                                <tr>
 
182
                                </tr>
 
183
                                <tr>
 
184
                                        <td rowspan="2"><code>end_round()</code></td>
 
185
                                        <td>Description:</td>
 
186
                                        <td>Ends the round by spawning the win/death zone immediately.</td>
 
187
                                </tr>
 
188
                                <tr>
 
189
                                </tr>
 
190
                        </table>
 
191
                        <br/>
 
192
                        <br/>
 
193
                        <h1>Class <code>Grid</code> (instantiated at <code>armagetron.grid</code>):</h1>
 
194
                        <table border="1">
 
195
                                <tr>
 
196
                                        <td rowspan="3"><code>get_team(name)</code></td>
 
197
                                        <td>Description:</td>
 
198
                                        <td>Get a Team object by name.</td>
 
199
                                </tr>
 
200
                                <tr>
 
201
                                        <td>Parameters:</td>
 
202
                                        <td><code>name</code> (string) - Name of the team to get.</td>
 
203
                                </tr>
 
204
                                <tr>
 
205
                                        <td>Return:</td>
 
206
                                        <td><code>team</code> (Team) - Team object with the given name.</td>
 
207
                                </tr>
 
208
                                <tr>
 
209
                                        <td rowspan="3"><code>get_player(name)</code></td>
 
210
                                        <td>Description:</td>
 
211
                                        <td>Get a Player object by name.</td>
 
212
                                </tr>
 
213
                                <tr>
 
214
                                        <td>Parameters:</td>
 
215
                                        <td><code>name</code> (string) - Name of the player to get.</td>
 
216
                                </tr>
 
217
                                <tr>
 
218
                                        <td>Return:</td>
 
219
                                        <td><code>player</code> (Player) - Player object with the given name.</td>
 
220
                                </tr>
 
221
                                <tr>
 
222
                                        <td rowspan="3"><code>get_zone(name)</code></td>
 
223
                                        <td>Description:</td>
 
224
                                        <td>Get a Zone object by name.</td>
 
225
                                </tr>
 
226
                                <tr>
 
227
                                        <td>Parameters:</td>
 
228
                                        <td><code>name</code> (string) - Name of the zone to get.</td>
 
229
                                </tr>
 
230
                                <tr>
 
231
                                        <td>Return:</td>
 
232
                                        <td><code>zone</code> (Zone) - Zone object with the given name.</td>
 
233
                                </tr>
 
234
                                <tr>
 
235
                                        <td rowspan="3"><code>create_zone(name, type, x, y, size, growth=0, xdir=0, ydir=0, interactive=None, r=None, g=None, b=None, target_size=None, rubber=None, player=None, owner=None, target_command=None)</code></td>
 
236
                                        <td>Description:</td>
 
237
                                        <td>Create a new zone.</td>
 
238
                                </tr>
 
239
                                <tr>
 
240
                                        <td>Parameters:</td>
 
241
                                        <td><code>name</code> (string) - Name of the new zone.<br/><br/>
 
242
                                        <code>type</code> (string) - Type of the new zone.<br/><br/>
 
243
                                        <code>x</code> (float) - The x coordinate of the new zone.<br/><br/>
 
244
                                        <code>y</code> (float) - The y coordinate of the new zone.<br/><br/>
 
245
                                        <code>size</code> (float) - Size of the new zone.<br/><br/>
 
246
                                        <code>growth</code> (float) - Growth of the new zone. Defaults to 0.<br/><br/>
 
247
                                        <code>xdir</code> (float) - Change in the x direction of the new zone. Defaults to 0.<br/><br/>
 
248
                                        <code>ydir</code> (float) - Change in the y direction of the new zone. Defaults to 0.</td>
 
249
                                </tr>
 
250
                                <tr>
 
251
                                        <td>Return:</td>
 
252
                                        <td><code>zone</code> (Zone) - The newly created zone (also stored internally).</td>
 
253
                                </tr>
 
254
                                <tr>
 
255
                                        <td><code>round</code> (int)</td>
 
256
                                        <td>Description:</td>
 
257
                                        <td>Current round number.</td>
 
258
                                </tr>
 
259
                                <tr>
 
260
                                        <td><code>num_players</code> (int)</td>
 
261
                                        <td>Description:</td>
 
262
                                        <td>Number of people playing.</td>
 
263
                                </tr>
 
264
                        </table>
 
265
                        <br/>
 
266
                        <br/>
 
267
                        <h1>Class <code>Team</code>:</h1>
 
268
                        <table border="1">
 
269
                                <tr>
 
270
                                        <td><code>name</code> (string)</td>
 
271
                                        <td>Description:</td>
 
272
                                        <td>The team's name.</td>
 
273
                                </tr>
 
274
                                <tr>
 
275
                                        <td><code>score</code> (int)</td>
 
276
                                        <td>Description:</td>
 
277
                                        <td>The team's score.</td>
 
278
                                </tr>
 
279
                                <tr>
 
280
                                        <td><code>players</code> (Player[])</td>
 
281
                                        <td>Description:</td>
 
282
                                        <td>Dictionary of the team's players indexed by name.</td>
 
283
                                </tr>
 
284
                                <tr>
 
285
                                        <td><code>positions</code> (int[])</td>
 
286
                                        <td>Description:</td>
 
287
                                        <td>A list of players on the team representing their position. For example, you can get the player in position with <code>positions[0]</code>.</td>
 
288
                                </tr>
 
289
                        </table>
 
290
                        <br/>
 
291
                        <br/>
 
292
                        <h1>Class <code>Player</code>:</h1>
 
293
                        <table border="1">
 
294
                                <tr>
 
295
                                        <td rowspan="2"><code>send_message(message)</code></td>
 
296
                                        <td>Description:</td>
 
297
                                        <td>Sends a message to the player's console.</td>
 
298
                                </tr>
 
299
                                <tr>
 
300
                                        <td>Parameters:</td>
 
301
                                        <td><code>message</code> (string) - The message to send.</td>
 
302
                                </tr>
 
303
                                <tr>
 
304
                                        <td rowspan="2"><code>kill()</code></td>
 
305
                                        <td>Description:</td>
 
306
                                        <td>Kills the player instantly.</td>
 
307
                                </tr>
 
308
                                <tr>
 
309
                                </tr>
 
310
                                <tr>
 
311
                                        <td rowspan="2"><code>kick(reason=None)</code></td>
 
312
                                        <td>Description:</td>
 
313
                                        <td>Kicks a player for a specified reason.</td>
 
314
                                </tr>
 
315
                                <tr>
 
316
                                        <td>Parameters:</td>
 
317
                                        <td><code>reason</code> (string) - The message displayed when the player is kicked.  Defaults to None.</td>
 
318
                                </tr>
 
319
                                <tr>
 
320
                                        <td rowspan="2"><code>ban(time=None, reason=None)</code></td>
 
321
                                        <td>Description:</td>
 
322
                                        <td>Bans a player for the specified time and reason.</td>
 
323
                                </tr>
 
324
                                <tr>
 
325
                                        <td>Parameters:</td>
 
326
                                        <td><code>time</code> (int) - The amount of minutes to ban the player.  Defaults to Armagetron's decision.<br/><br/>
 
327
                                        <code>reason</code> (string) - The message displayed when the player is banned.  Defaults to None.</td>
 
328
                                </tr>
 
329
                                <tr>
 
330
                                        <td rowspan="2"><code>ban_ip(time=None, reason=None)</code></td>
 
331
                                        <td>Description:</td>
 
332
                                        <td>Bans a player's IP address for a specified time and reason.</td>
 
333
                                </tr>
 
334
                                <tr>
 
335
                                        <td>Parameters:</td>
 
336
                                        <td><code>time</code> (int) - The amount of minutes to ban the player.  Defaults to Armagetron's decision.<br/><br/>
 
337
                                        <code>reason</code> (string) - The message displayed when the player is banned.  Defaults to None.</td>
 
338
                                </tr>
 
339
                                <tr>
 
340
                                        <td rowspan="2"><code>declare_winner()</code></td>
 
341
                                        <td>Description:</td>
 
342
                                        <td>Sets the player as the winner and ends the round.</td>
 
343
                                </tr>
 
344
                                <tr>
 
345
                                </tr>
 
346
                                <tr>
 
347
                                        <td rowspan="2"><code>teleport(x, y, xdir, ydir)</code></td>
 
348
                                        <td>Description:</td>
 
349
                                        <td>Teleport the player to the specified location.  Note: This function works in sty+ct only.</td>
 
350
                                </tr>
 
351
                                <tr>
 
352
                                        <td>Parameters:</td>
 
353
                                        <td><code>x</code> (float) - The x coordinate of the player.<br/><br/>
 
354
                                        <code>y</code> (float) - The y coordinate of the player.<br/><br/>
 
355
                                        <code>xdir</code> (int) - The x direction of the player.  Its value is based on the current axis system.  For example, you could put 1 here in four axes to mean go forward on the x axis.<br/><br/>
 
356
                                        <code>ydir</code> (int) - The y direction of the player.  Its value is based on the current axis system.  For example, you could put 1 here in four axes to mean go forward on the y axis.</td>
 
357
                                </tr>
 
358
                                <tr>
 
359
                                        <td rowspan="2"><code>respawn(x, y, xdir, ydir)</code></td>
 
360
                                        <td>Description:</td>
 
361
                                        <td>Respawns the player at the specified location.  Note: This function works in sty+ct only.</td>
 
362
                                </tr>
 
363
                                <tr>
 
364
                                        <td>Parameters:</td>
 
365
                                        <td><code>x</code> (float) - The x coordinate of the player.<br/><br/>
 
366
                                        <code>y</code> (float) - The y coordinate of the player.<br/><br/>
 
367
                                        <code>xdir</code> (int) - The x direction of the player.  Its value is based on the current axis system.  For example, you could put 1 here in four axes to mean go forward on the x axis.<br/><br/>
 
368
                                        <code>ydir</code> (int) - The y direction of the player.  Its value is based on the current axis system.  For example, you could put 1 here in four axes to mean go forward on the y axis.</td>
 
369
                                </tr>
 
370
                                <tr>
 
371
                                        <td><code>name</code> (string)</td>
 
372
                                        <td>Description:</td>
 
373
                                        <td>The player's internal name or login.</td>
 
374
                                </tr>
 
375
                                <tr>
 
376
                                        <td><code>screenname</code> (string)</td>
 
377
                                        <td>Description:</td>
 
378
                                        <td>The player's visible name, UTF-8 (Python's native) encoded in the case of special characters.</td>
 
379
                                </tr>
 
380
                                <tr>
 
381
                                        <td><code>ip</code> (string)</td>
 
382
                                        <td>Description:</td>
 
383
                                        <td>The player's IP address.</td>
 
384
                                </tr>
 
385
                                <tr>
 
386
                                        <td><code>score</code> (int)</td>
 
387
                                        <td>Description:</td>
 
388
                                        <td>The player's score.</td>
 
389
                                </tr>
 
390
                                <tr>
 
391
                                        <td><code>alive</code> (bool)</td>
 
392
                                        <td>Description:</td>
 
393
                                        <td>Whether or not the player is alive.</td>
 
394
                                </tr>
 
395
                        </table>
 
396
                        <br/>
 
397
                        <br/>
 
398
                        <h1>Class <code>Zone</code>:</h1>
 
399
                        <table border="1">
 
400
                                <tr>
 
401
                                        <td rowspan="2"><code>change_color(r, g, b)</code></td>
 
402
                                        <td>Description:</td>
 
403
                                        <td>Sets the zone's color from an RGB triplet.</td>
 
404
                                </tr>
 
405
                                <tr>
 
406
                                        <td>Parameters:</td>
 
407
                                        <td><code>r</code> (int) - Red part of color.<br/><br/>
 
408
                                        <code>g</code> (int) - Green part of color.<br/><br/>
 
409
                                        <code>b</code> (int) - Blue part of color.</td>
 
410
                                </tr>
 
411
                                <tr>
 
412
                                        <td rowspan="2"><code>change_expansion(growth)</code></td>
 
413
                                        <td>Description:</td>
 
414
                                        <td>Sets the zone's growth factor.</td>
 
415
                                </tr>
 
416
                                <tr>
 
417
                                        <td>Parameters:</td>
 
418
                                        <td><code>growth</code> (float) - The zone's growth factor.</td>
 
419
                                </tr>
 
420
                                <tr>
 
421
                                        <td rowspan="2"><code>change_position(x, y)</code></td>
 
422
                                        <td>Description:</td>
 
423
                                        <td>Sets the zone's position.</td>
 
424
                                </tr>
 
425
                                <tr>
 
426
                                        <td>Parameters:</td>
 
427
                                        <td><code>x</code> (float) - The x coordinate of zone.<br/><br/>
 
428
                                        <code>y</code> (float) - The y coordinate of zone.</td>
 
429
                                </tr>
 
430
                                <tr>
 
431
                                        <td rowspan="2"><code>change_size(size, growth=None)</code></td>
 
432
                                        <td>Description:</td>
 
433
                                        <td>Sets the zone's size and a growth rate to it.</td>
 
434
                                </tr>
 
435
                                <tr>
 
436
                                        <td>Parameters:</td>
 
437
                                        <td><code>size</code> (float) - The zone's size.<br/><br/>
 
438
                                        <code>growth</code> (float) - The zone's growth rate to get to that size.  Defaults to instantly.</td>
 
439
                                </tr>
 
440
                                <tr>
 
441
                                        <td rowspan="2"><code>change_speed(xdir, ydir)</code></td>
 
442
                                        <td>Description:</td>
 
443
                                        <td>Set the zone's speed by components.</td>
 
444
                                </tr>
 
445
                                <tr>
 
446
                                        <td>Parameters:</td>
 
447
                                        <td><code>xdir</code> (float) - The zone's x component of the velocity.<br/><br/>
 
448
                                        <code>ydir</code> (float) - The zone's y component of the velocity.</td>
 
449
                                </tr>
 
450
                                <tr>
 
451
                                        <td rowspan="2"><code>set_command(command)</code></td>
 
452
                                        <td>Description:</td>
 
453
                                        <td>Set the command of the target zone.</td>
 
454
                                </tr>
 
455
                                <tr>
 
456
                                        <td>Parameters:</td>
 
457
                                        <td><code>command</code> (string) - Armagetron command to be called when the target zone is entered.</td>
 
458
                                </tr>
 
459
                                <tr>
 
460
                                        <td><code>name</code> (string)</td>
 
461
                                        <td>Description:</td>
 
462
                                        <td>The zone's name.</td>
 
463
                                </tr>
 
464
                                <tr>
 
465
                                        <td><code>type</code> (string)</td>
 
466
                                        <td>Description:</td>
 
467
                                        <td>The zone's type.</td>
 
468
                                </tr>
 
469
                                <tr>
 
470
                                        <td><code>x</code> (float)</td>
 
471
                                        <td>Description:</td>
 
472
                                        <td>The (set) x coordinate of the zone.  Note: This will change if xdir is set.</td>
 
473
                                </tr>
 
474
                                <tr>
 
475
                                        <td><code>y</code> (float)</td>
 
476
                                        <td>Description:</td>
 
477
                                        <td>The (set) y coordinate of the zone.  Note: This will change if the ydir is set.</td>
 
478
                                </tr>
 
479
                                <tr>
 
480
                                        <td><code>size</code> (float)</td>
 
481
                                        <td>Description:</td>
 
482
                                        <td>The (set) size of the zone.</td>
 
483
                                </tr>
 
484
                                <tr>
 
485
                                        <td><code>growth</code> (float)</td>
 
486
                                        <td>Description:</td>
 
487
                                        <td>The growth of the zone.</td>
 
488
                                </tr>
 
489
                                <tr>
 
490
                                        <td><code>xdir</code> (float)</td>
 
491
                                        <td>Description:</td>
 
492
                                        <td>The x component of the velocity of the zone.</td>
 
493
                                </tr>
 
494
                                <tr>
 
495
                                        <td><code>ydir</code> (float)</td>
 
496
                                        <td>Description:</td>
 
497
                                        <td>The y component of the velocity of the zone.</td>
 
498
                                </tr>
 
499
                                <tr>
 
500
                                        <td colspan="3">Note: If these parameters are changed outside of the zone's functions (i.e. an Armagetron command), these values will not be accurate.</td>
 
501
                                </tr>
 
502
                                <tr>
 
503
                                        <td colspan="3">On destruction, the zone is simply set to collapse.</td>
 
504
                                </tr>
 
505
                        </table>
 
506
                        <br/>
 
507
                        <br/>
 
508
                        <h1>Examples:</h1>
 
509
                        <br/>
 
510
                        <h2>Reset the settings when everyone leaves the game:</h2>
 
511
                        <pre><code>
 
512
import armagetron
 
513
 
 
514
def reload(command):
 
515
  armagetron.reload()
 
516
 
 
517
armagetron.add_handler("GAME_END", reload)
 
518
 
 
519
armagetron.run()
 
520
                        </code></pre>
 
521
                        <br/>
 
522
                        <h2>Simple echo chat command:</h2>
 
523
                        <pre><code>
 
524
import armagetron
 
525
 
 
526
def echo(command):
 
527
  armagetron.send_message(command[1], " ".join(command[4:]))
 
528
 
 
529
armagetron.set_chat_handler("/echo", echo)
 
530
 
 
531
armagetron.run()
 
532
                        </code></pre>
 
533
                        <br/>
 
534
                        <h2>Map rotation:</h2>
 
535
                        <pre><code>
 
536
import armagetron
 
537
 
 
538
maps = [ "Anonymous/polygon/regular/square-1.0.1.aamap.xml", "Anonymous/polygon/regular/40-gon-0.2.aamap.xml", "kyle/other/maze-0.0.1.aamap.xml" ]
 
539
 
 
540
index = 0
 
541
 
 
542
def change_map(command):
 
543
  global index
 
544
 
 
545
  armagetron.pause_round()
 
546
  index++
 
547
  if index &gt; len(maps):
 
548
    index = 0
 
549
  armagetron.set_map(maps[index])
 
550
  armagetron.continue_round()
 
551
 
 
552
armagetron.add_handler("NEW_ROUND", change_map)
 
553
 
 
554
armagetron.run()
 
555
                        </code></pre>
 
556
                </div>
 
557
        </body>
 
558
</html>