Debian Codegraph @

doc/Developers/python

raw
1 This documentation is not uptodate. Latest version is in the python.ps file,
2 or available online from http://wiki.metalforge.net/doku.php/cfpython
3
4
5
6 THE PYTHON PLUGIN, VERSION 2.0
7 ===============================
8
9 What is the Python Plugin ?
10 ---------------------------
11 It is a plugin part of the Crossfire server that allows map-makers to create
12 object behaviors using Python scripts instead of having to hardcode them in C.
13
14
15 Converting from CFPython 0.x and 1.0
16 ------------------------------------
17 A lot of things have changed which hopefully make your Python coder's life a
18 little more comfortable.
19
20 1. The library name is now "Crossfire", instead of the previous "CFPython". No,
21 that's not to annoy you without purpose. It will force you to think about
22 reading your old Python code and make the necessary conversions.
23 2. Objects and Maps are now wrapped into Python objects. It means that instead
24 of writing "CFPython.Teleport(object,map,x,y)", you'll now have to write
25 "object.Teleport(map,x,y)". It is somewhat more logical and contributes to
26 cleaner Python code.
27 3. The plugin event hook mechanism is now based on event objects contained in
28 WhoAmI's inventory.
29
30 To make the transition as easy as possible, most functions of CFPython were
31 converted using the following rules:
32 - If the function was a getter/setter of an object or map attribute, it is now
33 available as a Python object attribute.
34 Examples: print CFPython.GetDamage(object) --> print object.Damage
35 CFPython.SetDamage(object, value) --> object.Damage = value
36 - If the function was an action performed by an object/a map, or related to a
37 specific object/map, it is now available as a Python object method.
38 Examples: CFPython.Take(object, what) --> object.Take(what)
39 CFPython.CheckMap(what, map, x, y) --> map.Check(what,x,y)
40
41 Only a few methods/attributes have changed names (this is the case for the seven
42 base attributes STR,DEX,CON,INT,WIS,POW,CHA for example).
43
44 Note that although it may seem that converting your old scripts to the new
45 format will be a huge job, it is rather straightforward in most cases. It only
46 took me an afternoon to convert and test all the scripts supplied with the
47 default map set, and I wasn't even their original author.
48
49
50 How do I hook a script to an object?
51 ------------------------------------
52
53 There are special archetypes named event_xxx available. You need to put those in
54 the inventory of the objects to which you want to connect your script.
55
56 Some fields of the event_xxx archetypes have a special meaning:
57
58 - name: all parameters you want to pass to the scripts should go there;
59 - title: this is the plugin identifier. For the Python plugin, it is "Python"
60 (without the quotes);
61 - slaying: the name of the script file to execute when the event is triggered.
62 Note that this name is relative to the map base directory.
63
64 Example:
65
66 arch event_apply
67 name parms
68 title Python
69 slaying test.py
70 end
71
72 The event will be triggered when the container object is applied and will run
73 share/crossfire/maps/test.py, passing "parms" as a parameter string to the
74 script.
75
76 You of course need to write some Python code too... You do as usual, but
77 remember to add an "import Crossfire" to make all crossfire-specific functions
78 available in your script.
79
80
81 How do I hook a global event?
82 -----------------------------
83
84 Each global event is bound to a specific Python script file. Those files are
85 located in the python/events/ subdirectory of your crossfire map directory.
86 They have specific names, too: python_xxx.py, where xxx is the name of the
87 global event you want to intercept. For example, a script that should be run
88 each time a player logs in ("login" event) should be named python_login.py.
89
90
91 What functions are currently supported?
92 ---------------------------------------
93
94 A complete list of those functions is given below.
95
96 Last count (2005-03-06) result: 217 functions (not including attack type/event
97 type wrapper functions). This of course does not include all the Python
98 functions, just the crossfire-specific ones.
99
100 In the following, I use the following type naming convention:
101 int : An integer.
102 long : A long.
103 float : A float.
104 object: A crossfire object. (In fact, it is a long).
105 map : A crossfire map. (In fact, it is a long).
106 string: A character string.
107
108 1. Global Methods
109 +++++++++++++++++
110
111 Those are provided by the Crossfire library directly, so to call them, you have
112 to write something like: Crossfire.Method().
113
114 ConfigDirectory() (1.x name: GetConfigurationDirectory())
115 Return the name of the base directory containing Crossfire configuration
116 files.
117 Returns the directory name as a string.
118
119 DirectionN()
120 Wrapper for the North direction.
121 Return value: an integer representing the direction.
122
123 DirectionNE()
124 Wrapper for the North-East direction.
125 Return value: an integer representing the direction.
126
127 DirectionE()
128 Wrapper for the East direction.
129 Return value: an integer representing the direction.
130
131 DirectionSE()
132 Wrapper for the South-East direction.
133 Return value: an integer representing the direction.
134
135 DirectionS()
136 Wrapper for the South direction.
137 Return value: an integer representing the direction.
138
139 DirectionSW()
140 Wrapper for the South-West direction.
141 Return value: an integer representing the direction.
142
143 DirectionW()
144 Wrapper for the West direction.
145 Return value: an integer representing the direction.
146
147 DirectionNW()
148 Wrapper for the North-West direction.
149 Return value: an integer representing the direction.
150
151 2. Object-Specific Methods
152 ++++++++++++++++++++++++++
153
154 Those are provided by the Python object wrapper.
155
156 ActivateRune(object activator)
157 Trigger the rune. Note that both the rune and its activator must be in the
158 same or in adjacent tiles of the same map.
159 Does not return a value.
160
161 Example:
162 who = Crossfire.WhoIsActivator()
163 rune = who.Map.CreateObject("rune_burning_hands", who.X, who.Y)
164 rune.ActivateRune(who)
165
166 Apply(object what, int flags)
167 Make the object apply an object 'what'. The applying object can be a
168 player or a monster. The applied object need not be on the same tile as
169 the applier. 'flags' specifies how to apply the object:
170 - 0=toggle (apply/unapply) the object
171 - 1=always apply the object
172 - 2=always unapply the object
173 Additionally, you can specify some modifier bits:
174 - 16=do not merge an unapplied object with other objects
175 - 32=unapply the item even if it is cursed
176 - 64=print the object name but do not apply/unapply it
177
178 Return value: integer denoting the result:
179 - 0=player or monster can't apply an object of that type
180 - 1=object has been applied, or there was an error applying the object
181 - 2=objects of that type can't be applied if not in inventory
182
183 Example:
184 who = Crossfire.WhoIsActivator()
185
186 # create and apply a trigger object
187 trigger = who.Map.CreateObject("trigger", who.X, who.Y)
188 result = who.Apply(trigger, 0); # returns 1
189
190 # create and apply an amulet
191 food = who.Map.CreateObject("amulet of sustenance", who.X, who.Y)
192 result = who.Apply(food, 0); # returns 2
193
194 # create and apply/unapply a cursed shield
195 shield = who.CreateObject("small shield")
196 shield.Cursed = 1;
197 result = who.Apply(shield, 1); # returns 1
198 result = who.Apply(shield, 2); # returns 1 (it does not unapply the item)
199 result = who.Apply(shield, 2|32); # returns 1
200
201 LearnSpell(object spell) (1.x name: AcquireSpell)
202 Learn the spell identified by a spell object.
203 Does not return a value.
204
205 Example:
206 who = Crossfire.WhoIsActivator()
207 spell = Crossfire.CreateObjectByName("spell_large_fireball")
208 who.LearnSpell(spell)
209 spell.Remove()
210
211 Say(message text)
212 Say 'text'.
213 Does not return a value.
214
215 3. Object-Specific Attributes
216 +++++++++++++++++++++++++++++
217
218 CanCastSpell
219 Test if the object can cast spells.
220 Return value: test result as an integer - 0 if and only if false.
221
222 CanPassThru
223 Test if the object has the 'pass through' ability.
224 Return value: test result as an integer - 0 if and only if false.
225
226 CanPickUp
227 Test if the object can pick up stuff.
228 Return value: test result as an integer - 0 if and only if false.
229
230 CanRoll
231 Test if the object can roll.
232 Return value: test result as an integer - 0 if and only if false.
233
234 CanSeeInDark
235 Test if object has got infravision capabilities.
236 Return value: test result as an integer - 0 if and only if false.
237
238 CanSeeInvisible
239 Test if the object can see invisible things.
240 Return value: test result as an integer - 0 if and only if false.
241
242 CanUseArmour
243 Test if the object can wear armor.
244 Return value: test result as an integer - 0 if and only if false.
245
246 CanUseBow
247 Test if the object can use a bow.
248 Return value: test result as an integer - 0 if and only if false.
249
250 CanUseHorn
251 Test if the object can use a horn (and other musical instruments).
252 Return value: test result as an integer - 0 if and only if false.
253
254 CanUseRing
255 Test if the object can use rings.
256 Return value: test result as an integer - 0 if and only if false.
257
258 CanUseRod
259 Test if the object can use magical rods.
260 Return value: test result as an integer - 0 if and only if false.
261
262 CanUseScroll
263 Test if the object can read scrolls.
264 Return value: test result as an integer - 0 if and only if false.
265
266 CanUseSkill
267 Test if the object can use skills.
268 Return value: test result as an integer - 0 if and only if false.
269
270 CanUseWand
271 Test if the object can use a magical wand.
272 Return value: test result as an integer - 0 if and only if false.
273
274 CanUseWeapon
275 Test if the object can use a weapon.
276 Return value: test result as an integer - 0 if and only if false.
277
278
279 4. Map-Specific Methods
280 +++++++++++++++++++++++
281
282 Those are provided by the Python map wrapper.
283
284 5. Map-Specific Attributes
285 ++++++++++++++++++++++++++
286
287
288 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
289 TODO: Finish converting the 1.x docs.
290 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
291
292
293 A
294 AttackTypeXxx()
295 Wrapper for attack type Xxx. Possible values for Xxx are: Acid Blind
296 Cancellation Chaos Cold Confusion Counterspell Death Depletion Disease Drain
297 Electricity Fear Fire Ghosthit Godpower HolyWord LifeStealing Magic Paralyze
298 Physical Poison Slow TurnUndead Weaponmagic.
299 Return value: an integer representing the attack type.
300
301 B
302 BlocksView(object obj)
303 Check if 'obj' can block the line-of-sight.
304 Return value: test result as in integer - 0 if and only if false.
305
306 C
307
308 CastAbility(object who, object caster, string spell, int direction, string
309 options)
310 Make the object 'caster' cast a 'spell'. 'who' is the owner of the casting
311 object; 'who' and 'caster' may be the same item. The spell is identified by
312 the spell name and cast into the given direction. 'options' can hold some
313 options.
314 Does not return a value.
315
316 Note: to cast a spell by a spell object, use CastSpell().
317
318 Example:
319 who = CFPython.WhoIsActivator()
320 caster = CFPython.CreateObjectInside("horn of Fire", who)
321 CFPython.CastAbility(who, caster, "spell_firebolt", CFPython.DirectionE(), "")
322
323 Example:
324 who = CFPython.WhoIsActivator()
325 CFPython.CastAbility(who, who, "spell_create_food", 0, "booze")
326
327 CastSpell(object who, object spell, int direction, string options)
328
329 Make 'who' cast a spell, identified by a spell object, into one direction.
330 'options' can hold some options.
331 Does not return a value.
332
333 Note: this function is similar to CastAbility() except that a spell object
334 (instead of a spell name) is used and that 'caster' is set to 'who'.
335
336 Note: the spell will be cast even if the 'who' has not sufficient spell
337 points; in fact, 'who' may end with negative spell points.
338
339 Example:
340 # make the activator cast a large fireball (if he knows that spell)
341 who = CFPython.WhoIsActivator()
342 spell = CFPython.DoKnowSpell(who, "large fireball")
343 if spell: CFPython.CastSpell(who, spell, CFPython.DirectionSE(), "")
344
345 CheckArchInventory(object who, string arch_name)
346 Check if 'who' has an object with the archetype 'arch_name' in his inventory.
347 Return value: the first matching object or 0 if the archetype was not found.
348
349 Example:
350 who = CFPython.WhoIsActivator()
351 obj = CFPython.CheckArchInventory(who, 'key2')
352 if obj: CFPython.Write(CFPython.GetName(obj), who)
353
354 CheckInventory(object who, string name)
355 Check if 'who' has an object named 'name' in his inventory. It first checks
356 for any item with a matching archetype name, then for an object with a name
357 beginning with 'name'.
358 Return value: the matching object or 0 if no object was found.
359
360 CheckInvisibleObjectInside(object who, string id)
361 Check for the existence of an force object with a slaying field 'id' inside
362 'who'.
363 Return value: The force object found or 0.
364
365 CheckMap(string what, map map, (int x, int y))
366 Check for an item with the archetype name 'what' in a map at a given
367 position. The function works for tiled maps.
368 Return value: The object found or 0.
369
370 CheckTrigger(object trigger, object what)
371 Try to trigger an object 'trigger' by 'what'. The object 'what' may be
372 destroyed. (For example if 'trigger' is an altar.)
373 Does not return a value.
374
375 Example:
376 # create and trigger an altar
377 altar = CFPython.CreateObject("altar_trigger", (0, 0))
378 food = CFPython.CreateObject("food", (1, 0))
379 CFPython.SetQuantity(food, 5)
380 CFPython.CheckTrigger(altar, food)
381
382 CostFlagXxx()
383 Wrapper for flags to use as the third parameter of GetObjectCost(). You must
384 always choose one of FBuy, FSell, or FTrue. You may add any other flags as
385 well. Possible Values for Xxx are:
386 - FBuy: item value for a player buying the item
387 - FSell: item value for a player selling the item
388 - FTrue: true value of the item
389 - FNoBargain: disable modifications due to bargaining skill
390 - FIdentified: pretend the item as identified
391 - FNotCursed: pretend the item as not cursed
392 Return value: integer integer representing the flag.
393
394 CreateInvisibleObjectInside(object where, string name)
395 Create a force object with a slaying field of 'name'. The object is placed in
396 the inventory of 'where'.
397 Return value: the created force object.
398
399 Note: The statement "obj = CFPython.CreateInvisibleObjectInside(who, 'slay')"
400 is basically the same as:
401 obj = CFPython.CreateObjectInside('force', who)
402 CFPython.SetSlaying(obj, 'slay')
403 CFPython.SetSpeed(obj, 0)
404
405 CreateObject(string name, (int x, int y)[, string map])
406 Create an object from the archetype 'name', or with the name 'name'. Insert
407 it at position (x,y) in the map. If map is omitted, it defaults to
408 GetMap(WhoAmI()).
409 Return value: the created object. Note that the returned object may have
410 nrof>1 if the new item has been merged with other objects.
411
412 Note: Not all types of objects can be created; for example, objects of type
413 PLAYER will crash the server.
414
415 Note: Not all kinds of objects are created correctly; for example, currently
416 a "horn of Fire" cannot be created: it creates a working horn but it is blue
417 with message "Putting this shell to you ear, you hear a strange and haunting
418 melody" and it is god-given.
419
420 Note: This function does not work correctly if the object contains a
421 "randomitems" field in the archetype.
422
423 CreateObjectInside(string name, object where)
424 Create an object from the archetype 'name', or with the name 'name'. Insert
425 it into the inventory of 'where'.
426 Return value: the created object
427
428 Note: see CreateObject()
429
430 Examples:
431 CFPython.CreateObjectInside("stylus", CFPython.WhoAmI()) # archetype name
432 CFPython.CreateObjectInside("writing pen", CFPython.WhoAmI()) # object name
433 CFPython.CreateObjectInside("levitation boots of mobility", CFPython.WhoAmI()) # artifact object
434
435 D
436 DecreaseObjectNr(object ob, int nrof)
437 Remove the given number of items from ob. If nrof is equal or more
438 than the items left in ob, ob is removed.
439 Return value: the object ob if some items are still remaining or 0 if all
440 objects are removed.
441
442 DoKnowSpell(object who, string spell)
443 Check if 'who' knows the spell by the name of 'spell'.
444 Returns the spell object if 'who' knows the spell or 0 if not.
445
446 Example: see CastSpell()
447
448 Drop(object who, string name)
449 Let 'who' drop the items named 'name'.
450 Does not return a value.
451
452 E
453 EventXxx()
454 Wrapper for event type Xxx. Possible values are: Apply Attack Close Death
455 Drop Pickup Say Stop Throw Time Timer Trigger.
456 Return value: an integer representing the event type.
457
458 F
459 FindPlayer(string name)
460 Check for a player with the given name. Note: the comparison is
461 case-sensitive and does not allow for partial matches.
462 Return value: the player object or 0 if not found.
463
464 FixObject(object who)
465 Update all abilities granted by applied objects in the inventory of the
466 given object. This functions starts from base values (archetype or player
467 object) and then adjusts them according to what the object has equipped.
468 Does not return a value.
469
470 ForgetSpell(object who, string spell)
471 Cause who to forget the spell named 'spell'. who must be a player.
472 Does not return a value.
473
474 Example:
475 who = CFPython.WhoIsActivator()
476 CFPython.ForgetSpell(who, "large fireball")
477
478 G
479 GetAC(object who)
480 Get the Armor Class coefficient associated with the given object.
481 Returns the armor class coefficient as an integer.
482
483 GetArchType(object who)
484 Get the archtype name of an object.
485 Returns the archtype as a string.
486
487 GetAttackType(object who)
488 Determine the attack type of an object.
489 Returns the attack type as an integer.
490
491 GetCharisma(object who)
492 Get the Charisma value of the given object.
493 Returns the charisma value as an integer.
494
495 GetConstitution(object who)
496 Get the Constitution value of the given object.
497 Returns the constitution value as an integer.
498
499 GetDamage(object who)
500 Get the amount of damage associated with the given object.
501 Returns the damage value as an integer.
502
503 GetDataDirectory()
504 Return the name of the base directory containing the Crossfire read only data
505 files.
506 Returns the directory name as a string.
507
508 GetDexterity(object who)
509 Get the Dexterity value of the given object.
510 Returns the dexterity value as an integer.
511
512 GetDirection(object who)
513 Determine the direction an turnable object 'who' is currently moving. Use
514 IsTurnable(who) to determine if an object is turnable.
515 Returns the direction as an integer.
516
517 GetEventHandler(object who, int event)
518 Get the event handler of 'who' for the event number 'event'. The parameter
519 'event' should be a value returned by EventXxx().
520 Returns the event handler name as a string or no object if the handler is not
521 used.
522
523 GetEventOptions(object who, int event)
524 Get the event options of 'who' for the event number 'event'. The parameter
525 'event' should be a value returned by EventXxx().
526 Returns the event options as a string or no object if the handler is not
527 used.
528
529 GetEventPlugin(object who, int event)
530 Get the event plugin name of 'who' for the event number 'event'. The
531 parameter 'event' should be a value returned by EventXxx().
532 Returns the event options as a string or no object if the handler is not
533 used.
534
535 GetExperience(object who)
536 Get the amount of experience associated with the object.
537 Returns the event options as a long.
538
539 GetFacing(object who)
540 Determine the direction an turnable object 'who' is currently facing. It
541 is similar to GetDirection except it works for non-moving objects too. See
542 GetDirection for details.
543 Returns the direction as an integer.
544
545 GetFirstObjectOnSquare(map map, int x, int y)
546 Get the first object at position (x,y) in the map 'map'. Use
547 GetPreviousObject() to find the next item(s).
548 Returns the object or 0 if the position is empty.
549
550 GetFood(object who)
551 Get the food level of the given object.
552 Returns the food level as an integer.
553
554 GetGod(object who)
555 Get the name of the god associated with the given object. Usually, this will
556 be the god 'who' is worshipping.
557 Return value: the god name as a string or no object if 'who' has no god.
558
559 GetGrace(object obj)
560 Get the grace amount of the given object.
561 Returns the grace amount as an integer.
562
563 GetHP(object who)
564 Get the amount of Hit Points associated with the given object.
565 Returns the amount of hit points as an integer.
566
567 GetHumidity(int x, int y, map map)
568 Get the humidity level of a given square of a map.
569 Returns the humidity level as an integer.
570
571 Remark: not implemented. Always returns zero.
572
573 GetIntelligence(object who)
574 Get the Intelligence value of the given object.
575 Returns the intelligence value as an integer.
576
577 GetInternalName(object who)
578 Get the name of 'who' without any modifications.
579 Returns the object name as a string.
580
581 GetInventory(object who)
582 Get the first inventory object of 'who'. Use GetNextObject() to find the next
583 inventory objects.
584 Returns the object or 0 if the inventory is empty.
585
586 GetIP(object player)
587 Get the ip address of 'player'. The given object should be a player object.
588 Returns the ip address as a string or no value if the object is not a player
589 object.
590
591 GetLastGrace(object who)
592 Get the last_grace parameter value associated with the given object.
593 Returns the last_grace value as an integer.
594
595 GetLastSP(object who)
596 Get the last_sp parameter value associated with the given object.
597 Returns the last_sp value as an integer.
598
599 GetLevel(object who)
600 Get the level of a given object.
601 Returns the level as an integer.
602
603 GetLocalDirectory()
604 Return the name of the base directory containing the Crossfire read-write
605 data files.
606 Returns the directory name as a string.
607
608 GetMap(object who)
609 Determine the map the object 'who' is currently in.
610 Returns the map as a map or 0 if the items is not part of a map.
611
612 GetMapDirectory()
613 Return the name of the base directory containing the Crossfire maps. You need
614 to concatenate the result with the value returned by GetDataDirectory() to
615 get an absolute path.
616 Returns the directory as a string.
617
618 GetMapHeight(map map)
619 Get the height (the number of tiles) of a map.
620 Returns the height as an integer.
621
622 GetMapObject()
623 This function should not be used anymore. It always throws an exception.
624
625 GetMapPath(map map)
626 Get the path name of the map.
627 Returns the path name as a string.
628
629 GetMapWidth(map map)
630 Get the width (the number of tiles) of a map.
631 Returns the width as an integer.
632
633 GetMaxHP(object who)
634 Get the maximum amount of Hit Points the given object can get.
635 Returns the amount of hit points as an integer.
636
637 GetMaxSP(object who)
638 Get the maximum amount of mana the given object can get.
639 Returns the maximum amount of mana as an integer.
640
641 GetMessage(object obj)
642 Get the message contained in the specified object. The message is what
643 appears inside msg...endmsg tags.
644 Returns the message as a string.
645
646 GetName(object who)
647 Get the 'clear name' of the given object.
648 Returns the name as a string.
649
650 GetNextObject(object obj)
651 Get the next object below 'obj'.
652 Returns the next object or 0 if 'obj' is the last object.
653
654 GetObjectAt(map map, int x, int y)
655 Get the first object at position (x,y) in the map.
656 Returns the object or 0 if the position is empty.
657
658 GetObjectCost(object who, object obj, int type)
659 Determine the cost of an object 'obj' if 'who' would buy or sell it. The
660 parameter 'type' should be one or more values returned by CostFlagXxx().
661 Returns the cost in silver coins as an integer.
662
663 GetObjectMoney(object who)
664 Determine how much money 'who' is carrying, including what is in containers.
665 Returns the amount in silver coins as an integer.
666
667 GetPlayerDirectory()
668 Return the name of the base directory containing the Crossfire players files.
669 You need to concatenate the result with the value returned by
670 GetLocalDirectory() to get an absolute path.
671 Returns the directory as a string.
672
673 GetPower(object who)
674 Get the Power value of the given object.
675 Returns the power value as an integer.
676
677 GetPressure(int x, int y, map map)
678 Get the humidity level of a given square of a map.
679 Returns the humidity level as an integer.
680
681 Remark: not implemented. Always returns zero.
682
683 GetPreviousObject(object obj)
684 Get the object before 'obj'.
685 Returns the previous object or 0 if 'obj' is the first object.
686
687 GetQuantity(object obj)
688 Return the number of items this object represents.
689 Returns the number as a long.
690
691 GetReturnValue()
692 Return the current exit status of the event script as an integer. See below
693 for an overview of events that use the exit value.
694
695 GetSkillExperience(object who, string skill)
696 Get the experience of skill 'skill' the object 'who' has. 'skill' should
697 skill name.
698 Returns the skill experience as a long or no value if 'who' does not know the
699 skill.
700 Example:
701 who = CFPython.WhoIsActivator()
702 exp = CFPython.GetSkillExperience(who, "alchemy")
703 if exp != None:
704 CFPython.Write("Alchemy experience %d"%(exp), who)
705 else:
706 CFPython.Write("Alchemy skill is unknown", who)
707
708 GetSlaying(object obj)
709 Get the "slaying" field of an object.
710 Returns the slaying value as a string.
711
712 GetSP(object who)
713 Get the amount of mana possessed by the given object.
714 Returns the amount of mana as an integer.
715
716 GetSpeed(object who)
717 Get the speed of the given object.
718 Returns the speed as a float.
719
720 GetStrength(object who)
721 Get the Strength value of the given object.
722 Returns the strength as an integer.
723
724 GetTempDirectory()
725 Return the name of the base directory containing temporary Crossfire files
726 (for example swapped-out maps).
727 Returns the directory as a string.
728
729 GetTemperature(int x, int y, map map)
730 Get the temperature of a given square of a map.
731 Returns the temperature as an integer.
732
733 Remark: not implemented. Always returns zero.
734
735 GetTitle(object who)
736 Get the title of 'who'. The "title" is the artifact suffix of in item. For
737 example, an "gauntlets of the Titans" has the title "of the Titans".
738 Returns the title as a string or no value if the object has no title.
739
740 Note: this function does not return the title the player has chosen for
741 himself.
742
743 GetType(object who)
744 Get the type of a given object, as a numerical identifier.
745 Returns the type as an integer.
746
747 GetUniqueDirectory()
748 Return the name of the base directory containing the Crossfire Unique items.
749 You need to concatenate the result with the value returned by
750 GetLocalDirectory() to get an absolute path.
751 Returns the directory as a string.
752
753 GetValue(object who)
754 Get the "value" field of an object.
755 Returns the value as an integer.
756
757 GetWC(object who)
758 Get the Weapon Class coefficient associated with the given object.
759 Returns the weapon class coefficient as an integer.
760
761 GetWeight(object who)
762 Determine the weight of the given object. The weight does not include the
763 inventory.
764 Returns the weight in grams as an integer.
765
766 GetWisdom(object who)
767 Get the Wisdom value of the given object.
768 Returns the wisdom value as an integer.
769
770 GetXPosition(object obj)
771 Get the x-position of an object in its map.
772 Returns the x-position as an integer.
773
774 GetYPosition()
775 Get the y-position of an object in its map.
776 Returns the y-position as an integer.
777
778 H
779 HasBeenApplied(object obj)
780 Check whether the object has been applied before.
781 Return value: test result as an integer - 0 if and only if false.
782
783 HasStealth(object obj)
784 Check whether the object is stealthy.
785 Return value: test result as an integer - 0 if and only if false.
786
787 HasXRays()
788 Check whether the object uses or grants x-rays.
789 Return value: test result as an integer - 0 if and only if false.
790
791 HitBack()
792 Check whether the object has the hitback flag set.
793 Return value: test result as an integer - 0 if and only if false.
794
795 I
796 InsertObjectInside(object obj, object environment)
797 Insert the object 'obj' into 'environment'.
798 Does not return a value.
799
800 Example: see SetSlaying()
801
802 IsAlive(object who)
803 Test if the given object is alive.
804 Return value: test result as an integer - 0 if and only if false.
805
806 IsApplied(object who)
807 Test if the given object is applied.
808 Return value: test result as an integer - 0 if and only if false.
809
810 IsBlind(object who)
811 Test if the given object causes blindness. For players, tests if he is blind.
812 Return value: test result as an integer - 0 if and only if false.
813
814 IsCanBePicked(object who)
815 Test if on object can be picked up.
816 Return value: test result as an integer - 0 if and only if false.
817
818 IsConfused(object who)
819 Test if the given object is confused.
820 Return value: test result as an integer - 0 if and only if false.
821
822 IsCursed(object who)
823 Test if the given object is cursed. Not that not all "damned" objects are
824 cursed as well.
825 Return value: test result as an integer - 0 if and only if false.
826
827 IsDamned(object who)
828 Test if the given object is damned.
829 Return value: test result as an integer - 0 if and only if false.
830
831 IsDungeonMaster(object who)
832 Test if the given object is a DM.
833 Return value: test result as an integer - 0 if and only if false.
834
835 IsFloor(object who)
836 Test if the given object is a floor tile.
837 Return value: test result as an integer - 0 if and only if false.
838
839 IsFlying(object who)
840 Test if the given object is flying.
841 Return value: test result as an integer - 0 if and only if false.
842
843 IsFriendly(object who)
844 Test if the given object is in friendly mode.
845 Return value: test result as an integer - 0 if and only if false.
846
847 IsGenerator(object who)
848 Test if the given object is a generator.
849 Return value: test result as an integer - 0 if and only if false.
850
851 IsIdentified(object who)
852 Test if the given object is identified.
853 Return value: test result as an integer - 0 if and only if false.
854
855 IsInvisible(object who)
856 Test if the given object is invisible.
857 Return value: test result as an integer - 0 if and only if false.
858
859 IsKnownCursed(object who)
860 Test if the given object is known to be a cursed one.
861 Return value: test result as an integer - 0 if and only if false.
862
863 IsKnownMagical(object who)
864 Test if the given object is known to be a magical one.
865 Return value: test result as an integer - 0 if and only if false.
866
867 IsLifesaver(object who)
868 Test if the given object is a Lifesaver. For players, tests if he wears an
869 object that is a Lifesaver.
870 Return value: test result as an integer - 0 if and only if false.
871
872 IsMonster(object who)
873 Test if the given object is a monster.
874 Return value: test result as an integer - 0 if and only if false.
875
876 IsOfType(object obj, int type)
877 Check if the object is of the given type.
878 Return value: test result as an integer - 0 if and only if false.
879
880 Note: There is no function to determine the type values by name.
881
882 Example:
883 if CFPython.IsOfType(CFPython.CreateObject("ring", (0, 0)), 70): # 70=RING
884 # item is a ring
885
886 IsOutOfMap(object obj, int x, int y)
887 Check if the object would be outside of the current map if moved to (x,y).
888 This function works for tiled maps.
889 Return value: test result as an integer - 0 if and only if false.
890
891 IsRunningAway(object who)
892 Test if the given object is running away.
893 Return value: test result as an integer - 0 if and only if false.
894
895 IsScared(object who)
896 Test if the given object is scared.
897 Return value: test result as an integer - 0 if and only if false.
898
899 IsSleeping(object who)
900 Test if the given object is sleeping.
901 Return value: test result as an integer - 0 if and only if false.
902
903 IsSplitting(object who)
904 Test if the given object can split.
905 Return value: test result as an integer - 0 if and only if false.
906
907 IsThrown(object who)
908 Test if the given object is designed to be thrown.
909 Return value: test result as an integer - 0 if and only if false.
910
911 IsTurnable(object who)
912 Test if the given object can change its face with direction.
913 Return value: test result as an integer - 0 if and only if false.
914
915 Note: use SetDirection(who) to change the direction of turnable objects.
916
917 IsUnaggressive(object who)
918 Test if the given object is in unaggressive mode.
919 Return value: test result as an integer - 0 if and only if false.
920
921 IsUndead(object who)
922 Test if the given object is an undead.
923 Return value: test result as an integer - 0 if and only if false.
924
925 IsUnique(object who)
926 Test if the given object is unique.
927 Return value: test result as an integer - 0 if and only if false.
928
929 IsUnpaid(object who)
930 Test if the given object is paid.
931 Return value: test result as an integer - 0 if and only if false.
932
933 IsUsedUp(object who)
934 Test if the given object has the flag "FLAG_IS_USED_UP" set.
935 Return value: test result as an integer - 0 if and only if false.
936
937 Example:
938 who = CFPython.WhoIsActivator()
939 obj = CFPython.CreateObject("burning item", (0, 0))
940 CFPython.Write("IsUsedUp(%s)=%d"%(CFPython.GetName(obj), CFPython.IsUsedUp(obj)), who)
941
942
943 J
944 K
945 KillObject(object who, object what, int type)
946 Kill the object 'what' in an combat-like fashion. 'who' is the object killing
947 'what'. 'type' is the attack type; it should be one or more values returned
948 by AttackTypeXxx().
949 Does not return a value.
950
951 Note: the death event of 'what' will be called.
952
953 L
954 LoadObject(string str)
955 Construct an object from its string representation. Use SaveObject() to
956 convert an object into its string representation.
957 Returns the created object or 0 if the object could no be created.
958
959 M
960 MakeInvisible(object obj)
961 Test if the given object makes the wielder invisible. For players, tests if
962 he is invisible.
963 Return value: test result as an integer - 0 if and only if false.
964
965 MatchString(string str, string regex)
966 Try to match the string 'str' to a regular expression 'regex'.
967 Return value: test result as an integer - 0 if and only if false.
968
969 Message(string text, object who[, int color])
970 Write the message 'text' to the map of 'who'. 'color' determines the color
971 and flags to use. (Consult the crossfire source code for all available flags
972 NDI_*.) If 'color' if omitted, NDI_BLUE|NDI_UNIQUE is used.
973 Does not return a value.
974
975 Note: to write a message to just one player, use Write().
976
977 N
978 O
979 OnlyAttack(object who)
980 Test if the given object evaporates if it has no enemy.
981 Return value: test result as an integer - 0 if and only if false.
982
983 P
984 PayAmount(object buyer, int silver)
985 Remove a given amount of silver coins from the buyer object. It uses money
986 from the inventory or from pouches in the inventory of 'buyer'.
987 Returns an integer, 1 for success or 0 for failure.
988
989 PayForItem(object buyer, object what)
990 Make 'buyer' to buy the object 'what'. Removes the necessary money from the
991 inventory or from pouches in the inventory. It grants bargaining experience
992 for a successful completion.
993 Returns an integer, 1 for success or 0 for failure.
994
995 PickUp(object who, object what)
996 Make 'who' pick up the object 'what'.
997 Does not return a value.
998
999 Q
1000 R
1001 ReadyMap(string mapname)
1002 Return the map with the name 'mapname'. The functions loads (or swaps in) the
1003 map if necessary.
1004 Returns the map or 0 if the map could not be loaded.
1005
1006 Example:
1007 # teleport activator to another map
1008 map = CFPython.ReadyMap("/scorn/misc/beginners")
1009 CFPython.Teleport(CFPython.WhoIsActivator(), map, 10, 10)
1010
1011 ReflectMissiles(object obj)
1012 Test if the given object reflects missiles. For players, tests if he reflects
1013 missiles.
1014 Return value: test result as an integer - 0 if and only if false.
1015
1016 ReflectSpells(object obj)
1017 Test if the given object reflects spells. For players, tests if he reflects
1018 spells.
1019 Return value: test result as an integer - 0 if and only if false.
1020
1021 RegisterCommand(string command, string script, float speed)
1022 Define a new command that players can call. 'script' is the Python script to
1023 execute if a player issues 'command'. 'speed' determines how long the command
1024 will paralyze the player.
1025
1026 When the script is run, WhoAmI() will return the player that issued the
1027 command. WhatIsMessage() returns the command parameters (if any).
1028 Throws an exception if the command is already registered or if 'speed' is
1029 negative.
1030 If the script fails, it should call SetReturnValue(0).
1031
1032 Note: It is possible to overwrite internal commands.
1033
1034 RemoveObject(object obj)
1035 Remove an object from its environment (and frees it).
1036 Does not return a value.
1037
1038 Note: do not use the object 'obj' afterwards.
1039
1040 Note: if the removed object is a container, the objects inside are not freed,
1041 they are dropped to the ground.
1042
1043 S
1044
1045
1046 SendCustomCommand(object player, string cmd)
1047 Send 'cmd' to the crossfire client of 'player'. Consult the crossfire
1048 protocol specification for valid commands. 'player' must be a player object.
1049 Does not return a value.
1050
1051 Example:
1052 CFPython.SendCustomCommand(CFPython.WhoIsActivator(), "drawinfo 1 text")
1053
1054 SetAC(object obj, int value)
1055 Set the Armor Class coefficient if the given object to 'value'.
1056 Does not return a value.
1057 Throws an exception if the value is less than -120 or higher than 120.
1058
1059 SetAttackType(object obj, int type)
1060 Sets the attack type of an object. The type can be one or more return values
1061 of AttackTypeXxx().
1062 Does not return a value.
1063
1064 Example:
1065 # create a sword with fire and cold attack type
1066 sword = CFPython.CreateObject("sword", (1, 3))
1067 CFPython.SetAttackType(sword, CFPython.AttackTypeFire()|CFPython.AttackTypeCold())
1068 CFPython.SetIdentified(sword, 1)
1069
1070 SetBeenApplied(object obj, int flag)
1071 Mark the object as been applied before (flag != 0) or has never been applied
1072 (flag = 0).
1073 Does not return a value.
1074
1075 SetCharisma(object obj, int value)
1076 Set the Charisma value of the given object.
1077 Does not return a value.
1078 Throws an exception if the value is less than -30 or higher than 30.
1079
1080 SetConstitution(object obj, int value)
1081 Set the Constitution value of the given object.
1082 Does not return a value.
1083 Throws an exception if the value is less than -30 or higher than 30.
1084
1085 SetCursed(object obj, int flag)
1086 Make the object cursed (flag != 0) or removes a curse (flag = 0).
1087 Does not return a value.
1088
1089 Note: does not remove the damned flag - use SetDamned() to change the damned
1090 status.
1091
1092 SetDamage(object obj, int value)
1093 Set the amount of damage associated with the given object.
1094 Does not return a value.
1095 Throws an exception if the value is negative or higher than 120.
1096
1097 SetDamned(object obj, int flag)
1098 Make the object damned (flag != 0) or removes a damnation (flag = 0).
1099 Does not return a value.
1100
1101 Note: does not affect the cursed flag - use SetCursed() to change the cursed
1102 status.
1103
1104 SetDexterity(object obj, int value)
1105 Set the Dexterity value of the given object.
1106 Does not return a value.
1107 Throws an exception if the value is less than -30 or higher than 30.
1108
1109 SetDirection(object who, int dir)
1110 Set the direction 'who' is currently moving.
1111 Does not return a value.
1112
1113 SetFace(object obj, string anim)
1114 Set the face of an object 'obj' to 'anim'. 'anim' is an animation name.
1115 Does not return a value.
1116
1117 Example:
1118 # make a pair of speed boots look like Idaten boots
1119 obj = CFPython.CreateObject("speedboots", (1, 3))
1120 CFPython.SetFace(obj, "idaten")
1121
1122 SetFood(object who, int food)
1123 Set the food level of the given object.
1124 Does not return a value.
1125 Throws an exception if the value is negative or higher than 999.
1126
1127 SetGod(object who, string god)
1128 Make 'who' to become a follower of 'god'.
1129 Does not return a value.
1130 Throws an exception if 'god' is invalid.
1131
1132 Note: Does nothing if 'who' does not know the skill 'praying'.
1133
1134 SetGrace(object obj, int value)
1135 Set the grace amount of the given object.
1136 Does not return a value.
1137 Throws an exception if the value is less than -32000 or higher than 32000.
1138
1139 SetHP(object obj, int value)
1140 Set the amount of Hit Points associated with the given object.
1141 Does not return a value.
1142 Throws an exception if the value is negative or higher than 32000.
1143
1144 SetIdentified(object obj, int flag)
1145 Mark the object as identified (flag != 0) or not identified (flag = 0).
1146 Does not return a value.
1147
1148 SetIntelligence(object who, int value)
1149 Set the Intelligence value of the given object.
1150 Does not return a value.
1151 Throws an exception if the value is less than -30 or higher than 30.
1152
1153 SetInvisible(object obj, int flag)
1154 Set (flag != 0) or clears (flag = 0) the invisible flag of the object.
1155 Does not return a value.
1156
1157 SetLastGrace(object who, int value)
1158 Set the last_grace parameter value associated with the given object.
1159 Does not return a value.
1160 Throws an exception if the value is negative or higher than 32000.
1161
1162 SetLastSP(object who, int value)
1163 Set the last_sp parameter value associated with the given object.
1164 Does not return a value.
1165 Throws an exception if the value is negative or higher than 32000.
1166
1167 SetMaxHP(object who, int value)
1168 Set the maximum amount of Hit Points the given object can get.
1169 Does not return a value.
1170 Throws an exception if the value is negative or higher than 32000.
1171
1172 SetMaxSP(object who, int value)
1173 Set the maximum amount of mana the given object can get.
1174 Does not return a value.
1175 Throws an exception if the value is negative or higher than 32000.
1176
1177 SetMessage(object obj, string msg)
1178 Set the message contained in the specified object. The message is what
1179 appears inside msg...endmsg tags.
1180 Does not return a value.
1181
1182 SetName(object name, string name[, string name_pl])
1183 Set the 'clear name' of the given object. If 'name_pl' (name to use for
1184 multiple objects) is not given, 'name' is used.
1185 Does not return a value.
1186
1187 Example:
1188 # create a scroll with a custom name
1189 key = CFPython.CreateObject("scroll", (0, 0))
1190 CFPython.SetName(key, "warning scroll", "warning scrolls")
1191 CFPython.SetMessage(key, "<unreadable text>")
1192
1193 SetNickname(object obj, string name)
1194 Set the title of a player or an object.
1195 Does not return a value.
1196
1197 SetPosition(object obj, (int x, int y))
1198 Move an object to another spot on the same map. The object must not be part
1199 of an inventory. Places the item in a nearby spot if the destination spot is
1200 blocked. The object will no be moved if no free spot can be found.
1201 Does not return a value.
1202
1203 SetPower(object obj, int value)
1204 Set the Power value of the given object.
1205 Does not return a value.
1206 Throws an exception if the value is less than -30 or higher than 30.
1207
1208 SetQuantity(object obj, int nrof)
1209 Set the number of items this object represents.
1210 Does not return a value.
1211 Throws an exception if the value is negative.
1212
1213 Note: the object should not be in a player's inventory because the client
1214 view will not be updated.
1215
1216 Note: "nrof=0" does not mean "destroy the item".
1217
1218 SetReturnValue(int value)
1219 Set the current exit status of the event script. See below for an overview of
1220 events that use the exit value.
1221 Does not return a value.
1222
1223 SetSkillExperience(object who, string skill, long exp)
1224 Set the experience of skill 'skill' the object 'who' has. 'skill' should be a
1225 skill name.
1226 Does not return a value.
1227 Throws an exception if 'who' does not know the 'skill'.
1228 Throws an exception if the value is negative.
1229
1230 Note: If the new experience value is less than the current value, 'who'
1231 looses the difference from his total experience.
1232
1233 SetSlaying(object obj, string value)
1234 Set the "slaying" field of an object.
1235 Does not return a value.
1236
1237 Example:
1238 # create a key and set its lock-code
1239 key = CFPython.CreateObject("key2", (0, 0))
1240 CFPython.SetName(key, "treasure key")
1241 CFPython.SetSlaying(key, "treasure-code")
1242 CFPython.InsertObjectInside(key, CFPython.WhoIsActivator())
1243
1244 SetSP(object obj, int value)
1245 Set the amount of mana possessed by the given object.
1246 Does not return a value.
1247 Throws an exception if the value is negative or higher than 32000.
1248
1249 SetSpeed(object obj, float value)
1250 Set the speed value of the given object.
1251 Does not return a value.
1252 Throws an exception if the speed value is less than -9.99 or higher than
1253 9.99.
1254
1255 SetStrength(object obj, int value)
1256 Set the Strength value of the given object.
1257 Does not return a value.
1258 Throws an exception if the value is less than -30 or higher than 30.
1259
1260 SetTitle(object obj, string title)
1261 Set the title of the given object.
1262 Note: to set the title of a player, use SetNickname() instead.
1263 Does not return a value.
1264
1265 SetUnaggressive(object obj, int flag)
1266 Make the given object unaggressive (flag != 0) or aggressive (flag = 0).
1267 Does not return a value.
1268
1269 SetValue(object obj, int silver)
1270 Set the "value" field of an object in silver coins.
1271 Does not return a value.
1272 Throws an exception if the value is negative.
1273
1274 SetVariable(object obj, string value)
1275 Change an object according to an argument string. It is equivalent of the DM
1276 patch command.
1277 Does not return a value.
1278
1279 SetWC(object obj. int value)
1280 Set the Weapon Class coefficient associated with the given object.
1281 Does not return a value.
1282 Throws an exception if the value is less than -120 or higher than 120.
1283
1284 SetWeight(object obj, long weight)
1285 Set the weight (in grams) of the given object.
1286 Does not return a value.
1287 Throws an exception if the value is negative or higher than 1000000000.
1288
1289 SetWisdom(object obj, int value)
1290 Set the Wisdom value of the given object.
1291 Does not return a value.
1292 Throws an exception if the value is less than -30 or higher than 30.
1293
1294 StandStill(object obj)
1295 Test if the given object has the flag "FLAG_STAND_STILL" set.
1296 Return value: test result as an integer - 0 if and only if false.
1297
1298 T
1299 Take(object who, string what)
1300 Make 'who' to pick up 'what'. The syntax of 'what' is the same as what is
1301 allowed for the client command 'get'.
1302 Does not return a value.
1303
1304 Teleport(object who, map map, int x, int y)
1305 Move the given object to (x,y) in map 'map'. The object to be moved may be
1306 part of a map or in some object's inventory. If the destination position is
1307 blocked, the object is placed in a nearby space.
1308 Does not return a value.
1309
1310 Note: if the destination coordinates are outside of the map or if no free
1311 space could be found, this function does not move the object.
1312
1313 Note: the object to be moved should not be part of a player's inventory.
1314
1315 U
1316 V
1317 W
1318 WasDungeonMaster(object who)
1319 Test if the given object is or has been a DM.
1320 Return value: test result as an integer - 0 if and only if false.
1321
1322 WhatIsMessage()
1323 Return the message related to the current event as a string or no object if
1324 no message is applicable.
1325
1326 Note: see below for an overview of events with messages.
1327
1328 WhoAmI()
1329 Return the object related to the current event or 0 if not applicable.
1330
1331 Note: the related object is frequently (but not always) the object containing
1332 the script. See below for an overview of events with related objects.
1333
1334 WhoIsActivator()
1335 Return the object that caused the script to run or 0 if not applicable.
1336 Note: See below for an overview of events with activator objects.
1337
1338 WhoIsOther()
1339 Return an auxiliary object for the current event or 0 if not applicable.
1340
1341 Note: See below for an overview of events with auxiliary objects.
1342
1343 Write(string text, object who[, int color])
1344 Write the message 'text' to the player 'who'. 'color' determines the color
1345 and flags to use. (Consult the crossfire source code for all available flags
1346 NDI_*.) If 'color' if omitted, NDI_BLUE|NDI_UNIQUE is used.
1347 Does not return a value.
1348
1349 Note: to write a message to all players in a map, use Message().
1350
1351 X
1352 Y
1353 Z
1354
1355
1356 What parameters are available to a script?
1357 ------------------------------------------
1358
1359 The following table contains all events that can be tied to objects.
1360
1361 event Activator WhoAmI Other Message parm1 parm2 parm3 result comment
1362 ----- --------- ------ ----- ------- ----- ----- ----- ------ --------------
1363 apply op ALTAR - - 0 0 0 yes 'op' prays at 'altar'
1364 apply op BOOK - - 0 0 0 no 'op' reads 'book'
1365 apply op ITEM - - aflag 0 0 yes 'op' applies 'item'
1366 attack hitter hitter OP - 0 dam wc no 'hitter' hits 'op'
1367 attack hitter ITEM op - 0 dam wc no 'hitter' hits 'op' with 'item'
1368 close op CONTAINER - - 0 0 0 yes 'op' closes 'container'
1369 death - PLAYER - - 0 0 0 yes 'player' dies
1370 death hitter OP - - atype 0 0 yes 'hitter' kills 'op'
1371 drop op ITEM - - nrof 0 0 yes 'op' drops 'item'
1372 pickup (not implemented)
1373 say op ITEM npc msg 0 0 0 always 'op' tells 'msg' to 'item' in 'npc''s inventory
1374 say op NPC - msg 0 0 0 always 'op' tells 'msg' to 'npc'
1375 stop - OP - - 0 0 0 no thrown object 'op' is stopped
1376 throw op ITEM - - 0 0 0 no 'op' throws 'item'
1377 time - OP - - 0 0 0 no 'op' takes a turn
1378 timer OP - - - 0 0 0 no timer of 'op' has expired
1379 trigger OP item - msg 0 0 0 always 'op' writes 'msg' into 'item'
1380 trigger TELEPORTER op - - 0 0 0 yes 'teleporter' moves 'op'
1381 trigger TRAP originator victim - 0 0 0 yes 'originator' causes 'victim' to trigger 'trap'
1382
1383 Notes:
1384 - the object that contains the event script is written in capitals.
1385 - result column: indicates how the result value set by SetReturnValue() is
1386 used: no=result value is not used; yes=non-zero result value prevents the
1387 normal action; always=prevents the normal action regardless of result value.
1388 - apply event: aflag: Consult the crossfire source code for all available flags
1389 AP_*.
1390 - death event: atype=attacktype
1391 - trigger event: originator is unset if the trap (pedestal/button) someone left
1392 it.
1393 - parm1..3 are not currently available to the script.
1394 - attack event: 'item' can be a weapon or a missile.
1395
1396
1397 The following table contains all global events.
1398
1399 event Activator WhoAmI Other Message comment
1400 ----- --------- ------ ----- -------- --------------
1401 born op - - - new player 'op' was created
1402 clock - - - - called each tick
1403 crash (not implemented)
1404 gdeath player 'op' dies (not implemented)
1405 gkill 'hitter' kills 'op' (not implemented)
1406 kick op - - name player 'op' named 'name' is kicked out of the game
1407 login op op - ip player 'op' logged in from IP address 'ip'
1408 logout op op - ip player 'op' logged out from IP address 'ip'
1409 mapenter op - - - player 'op' has entered a new map
1410 mapleave op - - - player 'op' is leaving a map
1411 mapreset - - - mappath map 'mappath' is resetting
1412 muzzle op - - name player 'op' named 'name' is muzzled
1413 remove op - - - player 'op' quits the game
1414 shout op - - message player 'op' shouts 'message'
1415 tell (not implemented)
1416
1417 Notes:
1418 - kick event: param is either the player name or None if all players are
1419 kicked.
1420 - login event: this event is also called when a new player was created.