Difference for doc/Developers/python from version 1.6 to 1.7


version 1.6 version 1.7
Line 2
 
Line 2
 =================  =================
   
 How do I hook a script to an object ?  How do I hook a script to an object ?
 -------------------------------------  ------------------------------------
 Use the event_xxx to specify the script to use. The base directory for the  
 scripts is the map directory.  The field event_xxx connects a script to an object. It will be executed
 The option field is unused for now.  whenever the event "xxx" occurs. The base directory for the script is the map
 The plugin field should be "Python" of course.  directory. The option field value is available to the script through the
   function GetEventOptions(). The plugin field should be "Python".
   
   For example, to intercept the event "say":
     event_say /python/script-for-say.py
     event_say_plugin Python
     event_say_options Option string
   
 You of course need to write some Python code too... You do as usual, but  You of course need to write some Python code too... You do as usual, but
 remember to add an "import CFPython" to make all crossfire-specific functions  remember to add an "import CFPython" to make all crossfire-specific functions
 available in your scripts.  available in your script.
   
   
 How do I hook a global event ?  How do I hook a global event ?
 ------------------------------  -----------------------------
   
 Each global event is bound to a specific Python script file. Those files are  Each global event is bound to a specific Python script file. Those files are
 located in the python/ subdirectory of your crossfire map directory. They have  located in the python/events/ subdirectory of your crossfire map directory.
 specific names, too: python_xxx.py, where xxx is the name of the global event  They have specific names, too: python_xxx.py, where xxx is the name of the
 you want to intercept. For example, a script that should be run each time a  global event you want to intercept. For example, a script that should be run
 player logs in ("login" event) should be named python_login.py.  each time a player logs in ("login" event) should be named python_login.py.
   
   
 What functions are currently supported ?  What functions are currently supported ?
 ----------------------------------------  ---------------------------------------
   
 A complete list of those functions is given below.  A complete list of those functions is given below.
 Note to Scriptfire users: CFPython implements all the old Scriptfire functions.  
 Although the syntax of Python is quite different from Guile, it should not be a  Last count (2005-03-06) result: 217 functions (not including attack type/event
 problem to port your old code.  type wrapper functions). This of course does not include all the Python
   functions, just the crossfire-specific ones.
 Last count (10/09/2001) result: 181 functions (not counting the various spells  
 and skills wrappers). This of course does not include all the Python functions,  
 just the crossfire-specific ones.  
   
 In the following, I use the following type naming convention:  In the following, I use the following type naming convention:
 int   : An integer;  int   : An integer.
 long  : A long;  long  : A long.
   float : A float.
 object: A crossfire object. (In fact, it is a long).  object: A crossfire object. (In fact, it is a long).
   map   : A crossfire map. (In fact, it is a long).
 string: A character string.  string: A character string.
   
 A  A
 AcquireSpell(object who, object *spell)  AcquireSpell(object who, object spell)
   Makes "who" learn the spell identified by its spellobject.    Make 'who' learn the spell identified by a spell object.
   special_prayer is denotes if this is a special prayer type spell  
   which should be removed when the player changes god  
   Wrappers for all crossfire spellids are available under CFPython.  
   Does not return a value.    Does not return a value.
   
 ActivateRune(object who, object what)    Example:
   Makes "who" trigger the rune "what".      who = CFPython.WhoIsActivator()
       spell = CFPython.CreateObject("spell_large_fireball", (0, 0))
       CFPython.AcquireSpell(who, spell)
       CFPython.RemoveObject(spell)
   
   ActivateRune(object who, object rune)
     Make 'who' trigger the rune. Note that both objects must be in the same or in
     adjacent tiles of the same map.
   Does not return a value.    Does not return a value.
   
     Example:
       who = CFPython.WhoIsActivator()
       pos = (CFPython.GetXPosition(who)+1, CFPython.GetYPosition(who))
       rune = CFPython.CreateObject("rune_burning_hands", pos)
       CFPython.ActivateRune(who, rune)
   
 Apply(object who, object what, int flags)  Apply(object who, object what, int flags)
   Makes object "who" do a manual apply on object "what" with the specified    Make an object 'who' apply an object 'what'. The applying object can be a
   flags. Consult the crossfire source code for all available flags.    player or a monster. The applied object need not be on the same tile as
   Return value: integer.    'who'. 'what' specifies how to apply the object:
      - 0=toggle (apply/unapply) the object
      - 1=always apply the object
      - 2=always unapply the object
     Additionally, you can specify some modifier bits:
      - 16=do not merge an unapplied object with other objects
      - 32=unapply the item even if it is cursed
      - 64=print the object name but do not apply/unapply it
   
     Return value: integer denoting the result:
      - 0=player or monster can't apply an object of that type
      - 1=object has been applied, or there was an error applying the object
      - 2=objects of that type can't be applied if not in inventory
   
     Example:
       who = CFPython.WhoIsActivator()
       pos = (CFPython.GetXPosition(who), CFPython.GetYPosition(who))
   
       # create and apply a trigger object
       trigger = CFPython.CreateObject("trigger", pos)
       result = CFPython.Apply(who, trigger, 0); # returns 1
   
       # create and apply an amulet
       food = CFPython.CreateObject("amulet of sustenance", pos)
       result = CFPython.Apply(who, food, 0); # returns 2
   
       # create and apply/unapply a cursed shield
       shield = CFPython.CreateObjectInside("small shield", who)
       CFPython.SetCursed(shield, 1);
       result = CFPython.Apply(who, shield, 1); # returns 1
       result = CFPython.Apply(who, shield, 2); # returns 1 (it does not unapply the item)
       result = CFPython.Apply(who, shield, 2|32); # returns 1
   
   AttackTypeXxx()
     Wrapper for attack type Xxx. Possible values for Xxx are: Acid Blind
     Cancellation Chaos Cold Confusion Counterspell Death Depletion Disease Drain
     Electricity Fear Fire Ghosthit Godpower HolyWord LifeStealing Magic Paralyze
     Physical Poison Slow TurnUndead Weaponmagic.
     Return value: an integer representing the attack type.
   
 B  B
 BlocksView(object who)  BlocksView(object obj)
   Checks if "who" can block the line-of-sight.    Check if 'obj' can block the line-of-sight.
   Return value: integer.    Return value: test result as in integer - 0 if and only if false.
   
 C  C
 CastAbility(object who, int spellid, int direction, string options)  CanCastSpell(object obj)
   Makes "who" casts a spell, identified by its id, into one direction and with    Test if the object 'obj' can cast spells.
   eventually some options (like "create food booze"). The spell is cast as an  
   ability and thus does not use any mana point.  
   Does not return a value.  
   
 CheckTrigger(object who, object what)  
   Makes "who" test trigger "what".  
   Does not return a value.  
   
 CastSpell(object who, object spellob, int direction, string options)  
   Makes "who" casts a spell, identified by its spell object, into one  
   direction and with eventually some options (like "create food booze").  Does  
   not return a value.  Note that before spellob, this functions  
   second parameter was an integere for spelltype.  
   
 CheckInvisibleObjectInside(object who, string id)  
   Checks for the existence of an invisible object named "id" inside object  
   "who".  
   Return value: The object found, if any.  
   
 CreateInvisibleObjectInside()  
 CreateObjectInside()  
 CheckMap()  
 CheckInventory()  
 CreateObject()  
 CanSeeInvisible(object who)  
   Tests if the object "who" can see invisible things.  
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanRoll(object who)  CanPassThru(object obj)
   Tests if the object "who" can roll.    Test if the object 'obj' has the 'pass through' ability.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanPassThru(object who)  CanPickUp(object who)
   Tests if the object "who" has the 'pass through' ability.    Test if the object 'who' can be pick up stuff.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanPickUp(object who)  CanRoll(object who)
   Tests if the object "who" can be pick up stuff.    Test if the object 'who' can roll.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanCastSpell(object who)  CanSeeInDark(object who)
   Tests if the object "who" can cast spells.    Test if object 'who' has got infravision capabilities.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanUseScroll(object who)  CanSeeInvisible(object who)
   Tests if object "who" can read scrolls.    Test if the object 'who' can see invisible things.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanUseWand(object who)  CanUseArmour(object who)
   Tests if object "who" can use a magical wand.    Test if object 'who' can wear armor.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanUseBow(object who)  CanUseBow(object who)
   Tests if object "who" can use a bow.    Test if object 'who' can use a bow.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanUseArmour(object who)  CanUseHorn(object who)
   Tests if object "who" can wear armour.    Test if object 'who' can use a horn (and other musical instruments).
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanUseWeapon(object who)  CanUseRing(object who)
   Tests if object "who" can use a weapon.    Test if object 'who' can use rings.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanUseRing(object who)  CanUseRod(object who)
   Tests if object "who" can use rings.    Test if object 'who' can use magical rods.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanUseSkill(object who)  CanUseScroll(object who)
   Tests if object "who" can use skills.    Test if object 'who' can read scrolls.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanUseRod(object who)  CanUseSkill(object who)
   Tests if object "who" can use magical rods.    Test if object 'who' can use skills.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanUseHorn(object who)  CanUseWand(object who)
   Tests if object "who" can use a horn (and other musical instruments)    Test if object 'who' can use a magical wand.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 CanSeeInDark(object who)  CanUseWeapon(object who)
   Tests if object "who" has got infravision capabilities.    Test if object 'who' can use a weapon.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
   CastAbility(object who, object caster, string spell, int direction, string
     options)
     Make the object 'caster' cast a 'spell'. 'who' is the owner of the casting
     object; 'who' and 'caster' may be the same item. The spell is identified by
     the spell name and cast into the given direction. 'options' can hold some
     options.
     Does not return a value.
   
     Note: to cast a spell by a spell object, use CastSpell().
   
     Example:
       who = CFPython.WhoIsActivator()
       caster = CFPython.CreateObjectInside("horn of Fire", who)
       CFPython.CastAbility(who, caster, "spell_firebolt", CFPython.DirectionE(), "")
   
     Example:
       who = CFPython.WhoIsActivator()
       CFPython.CastAbility(who, who, "spell_create_food", 0, "booze")
   
   CastSpell(object who, object spell, int direction, string options)
   
     Make 'who' cast a spell, identified by a spell object, into one direction.
     'options' can hold some options.
     Does not return a value.
   
     Note: this function is similar to CastAbility() except that a spell object
     (instead of a spell name) is used and that 'caster' is set to 'who'.
   
     Note: the spell will be cast even if the 'who' has not sufficient spell
     points; in fact, 'who' may end with negative spell points.
   
     Example:
       # make the activator cast a large fireball (if he knows that spell)
       who = CFPython.WhoIsActivator()
       spell = CFPython.DoKnowSpell(who, "large fireball")
       if spell: CFPython.CastSpell(who, spell, CFPython.DirectionSE(), "")
   
   CheckArchInventory(object who, string arch_name)
     Check if 'who' has an object with the archetype 'arch_name' in his inventory.
     Return value: the first matching object or 0 if the archetype was not found.
   
     Example:
       who = CFPython.WhoIsActivator()
       obj = CFPython.CheckArchInventory(who, 'key2')
       if obj: CFPython.Write(CFPython.GetName(obj), who)
   
   CheckInventory(object who, string name)
     Check if 'who' has an object named 'name' in his inventory. It first checks
     for any item with a matching archetype name, then for an object with a name
     beginning with 'name'.
     Return value: the matching object or 0 if no object was found.
   
   CheckInvisibleObjectInside(object who, string id)
     Check for the existence of an force object with a slaying field 'id' inside
     'who'.
     Return value: The force object found or 0.
   
   CheckMap(string what, map map, (int x, int y))
     Check for an item with the archetype name 'what' in a map at a given
     position. The function works for tiled maps.
     Return value: The object found or 0.
   
   CheckTrigger(object trigger, object what)
     Try to trigger an object 'trigger' by 'what'. The object 'what' may be
     destroyed. (For example if 'trigger' is an altar.)
     Does not return a value.
   
     Example:
       # create and trigger an altar
       altar = CFPython.CreateObject("altar_trigger", (0, 0))
       food = CFPython.CreateObject("food", (1, 0))
       CFPython.SetQuantity(food, 5)
       CFPython.CheckTrigger(altar, food)
   
   CostFlagXxx()
     Wrapper for flags to use as the third parameter of GetObjectCost(). You must
     always choose one of FBuy, FSell, or FTrue. You may add any other flags as
     well. Possible Values for Xxx are:
      - FBuy: item value for a player buying the item
      - FSell: item value for a player selling the item
      - FTrue: true value of the item
      - FNoBargain: disable modifications due to bargaining skill
      - FIdentified: pretend the item as identified
      - FNotCursed: pretend the item as not cursed
     Return value: integer integer representing the flag.
   
   CreateInvisibleObjectInside(object where, string name)
     Create a force object with a slaying field of 'name'. The object is placed in
     the inventory of 'where'.
     Return value: the created force object.
   
     Note: The statement "obj = CFPython.CreateInvisibleObjectInside(who, 'slay')"
     is basically the same as:
       obj = CFPython.CreateObjectInside('force', who)
       CFPython.SetSlaying(obj, 'slay')
       CFPython.SetSpeed(obj, 0)
   
   CreateObject(string name, (int x, int y)[, string map])
     Create an object from the archetype 'name', or with the name 'name'. Insert
     it at position (x,y) in the map. If map is omitted, it defaults to
     GetMap(WhoAmI()).
     Return value: the created object. Note that the returned object may have
     nrof>1 if the new item has been merged with other objects.
   
     Note: Not all types of objects can be created; for example, objects of type
     PLAYER will crash the server.
   
     Note: Not all kinds of objects are created correctly; for example, currently
     a "horn of Fire" cannot be created: it creates a working horn but it is blue
     with message "Putting this shell to you ear, you hear a strange and haunting
     melody" and it is god-given.
   
     Note: This function does not work correctly if the object contains a
     "randomitems" field in the archetype.
   
   CreateObjectInside(string name, object where)
     Create an object from the archetype 'name', or with the name 'name'. Insert
     it into the inventory of 'where'.
     Return value: the created object
   
     Note: see CreateObject()
   
     Examples:
       CFPython.CreateObjectInside("stylus", CFPython.WhoAmI()) # archetype name
       CFPython.CreateObjectInside("writing pen", CFPython.WhoAmI()) # object name
       CFPython.CreateObjectInside("levitation boots of mobility", CFPython.WhoAmI()) # artifact object
   
 D  D
 Drop()  DecreaseObjectNr(object ob, int nrof)
     Remove the given number of items from ob. If nrof is equal or more
     than the items left in ob, ob is removed.
     Return value: the object ob if some items are still remaining or 0 if all
     objects are removed.
   
 DirectionN()  DirectionN()
   Wrapper for the North direction.    Wrapper for the North direction.
   Return value: an integer representing the direction.    Return value: an integer representing the direction.
Line 179
 
Line 343
   Wrapper for the North-West direction.    Wrapper for the North-West direction.
   Return value: an integer representing the direction.    Return value: an integer representing the direction.
   
 DoKnowSpell(object *who, char *spell)  DoKnowSpell(object who, string spell)
    Checks to see if 'who' knows the spell by the name of 'spell'.    Check if 'who' knows the spell by the name of 'spell'.
    returns the spell object if they do, null if they don't.    Returns the spell object if 'who' knows the spell or 0 if not.
   
     Example: see CastSpell()
   
   Drop(object who, string name)
     Let 'who' drop the items named 'name'.
     Does not return a value.
   
 E  E
   EventXxx()
     Wrapper for event type Xxx. Possible values are: Apply Attack Close Death
     Drop Pickup Say Stop Throw Time Timer Trigger.
     Return value: an integer representing the event type.
   
 F  F
 FindPlayer()  FindPlayer(string name)
 FixObject()    Check for a player with the given name. Note: the comparison is
     case-sensitive and does not allow for partial matches.
     Return value: the player object or 0 if not found.
   
   FixObject(object who)
     Update all abilities granted by applied objects in the inventory of the
     given object. This functions starts from base values (archetype or player
     object) and then adjusts them according to what the object has equipped.
     Does not return a value.
   
 ForgetSpell(object *who, char *spell)  ForgetSpell(object who, string spell)
    Causes who to forget the spell named 'spell'.  who must be a player.    Cause who to forget the spell named 'spell'.  who must be a player.
     Does not return a value.
   
     Example:
       who = CFPython.WhoIsActivator()
       CFPython.ForgetSpell(who, "large fireball")
   
 G  G
   GetAC(object who)
     Get the Armor Class coefficient associated with the given object.
     Returns the armor class coefficient as an integer.
   
 GetMapDirectory()  GetAttackType(object who)
   Returns the name of the base directory containing the Crossfire maps.    Determine the attack type of an object.
   You need to concatenate the result with the value returned by    Returns the attack type as an integer.
   GetDataDirectory() to get an absolute path.  
   GetCharisma(object who)
 GetUniqueDirectory()    Get the Charisma value of the given object.
   Returns the name of the base directory containing the Crossfire Unique items.    Returns the charisma value as an integer.
   You need to concatenate the result with the value returned by  
   GetLocalDirectory() to get an absolute path.  
   
 GetTempDirectory()  
   Returns the name of the base directory containing temporary Crossfire files  
   (like swapped-out maps)  
   
 GetConfigurationDirectory()  GetConfigurationDirectory()
   Returns the name of the base directory containing Crossfire configuration    Return the name of the base directory containing Crossfire configuration
   files.    files.
     Returns the directory name as a string.
   
   GetConstitution(object who)
     Get the Constitution value of the given object.
     Returns the constitution value as an integer.
   
   GetDamage(object who)
     Get the amount of damage associated with the given object.
     Returns the damage value as an integer.
   
 GetDataDirectory()  GetDataDirectory()
   Returns the name of the base directory containing the Crossfire read only data    Return the name of the base directory containing the Crossfire read only data
   files.    files.
     Returns the directory name as a string.
   
 GetLocalDirectory()  GetDexterity(object who)
   Returns the name of the base directory containing the Crossfire read-write    Get the Dexterity value of the given object.
   data files.    Returns the dexterity value as an integer.
   
   GetDirection(object who)
     Determine the direction an turnable object 'who' is currently facing. Use
     IsTurnable(who) to determine if an object is turnable.
     Returns the direction as an integer.
   
   GetEventHandler(object who, int event)
     Get the event handler of 'who' for the event number 'event'. The parameter
     'event' should be a value returned by EventXxx().
     Returns the event handler name as a string or no object if the handler is not
     used.
   
   GetEventOptions(object who, int event)
     Get the event options of 'who' for the event number 'event'. The parameter
     'event' should be a value returned by EventXxx().
     Returns the event options as a string or no object if the handler is not
     used.
   
   GetEventPlugin(object who, int event)
     Get the event plugin name of 'who' for the event number 'event'. The
     parameter 'event' should be a value returned by EventXxx().
     Returns the event options as a string or no object if the handler is not
     used.
   
 GetPlayerDirectory()  GetExperience(object who)
   Returns the name of the base directory containing the Crossfire players files.    Get the amount of experience associated with the object.
   You need to concatenate the result with the value returned by    Returns the event options as a long.
   GetLocalDirectory() to get an absolute path.  
   
 GetSkillExperience()  GetFirstObjectOnSquare(map map, int x, int y)
 GetMapPath()    Get the first object at position (x,y) in the map 'map'. Use
 GetMapObject()    GetPreviousObject() to find the next item(s).
 GetMessage(object who)    Returns the object or 0 if the position is empty.
   Gets the message contained in the specified object.  
   The message is what appears inside msg...endmsg tags.  GetFood(object who)
     Get the food level of the given object.
     Returns the food level as an integer.
   
 GetGod(object who)  GetGod(object who)
   Gets the name of the god associated with the given object.    Get the name of the god associated with the given object. Usually, this will
   Usually, this will be the god "who" is worshipping.    be the god 'who' is worshipping.
     Return value: the god name as a string or no object if 'who' has no god.
   
   GetGrace(object obj)
     Get the grace amount of the given object.
     Returns the grace amount as an integer.
   
 GetWeight(object who)  GetHP(object who)
   Gets the weight of the given object.    Get the amount of Hit Points associated with the given object.
     Returns the amount of hit points as an integer.
   
 GetMap()  GetHumidity(int x, int y, map map)
 GetNextObject()    Get the humidity level of a given square of a map.
 GetPreviousObject()    Returns the humidity level as an integer.
 GetFirstObjectOnSquare()  
 GetQuantity()    Remark: not implemented. Always returns zero.
 GetExperience(object who)  
   Gets the amount of experience associated with the object.  GetIntelligence(object who)
     Get the Intelligence value of the given object.
     Returns the intelligence value as an integer.
   
   GetInternalName(object who)
     Get the name of 'who' without any modifications.
     Returns the object name as a string.
   
   GetInventory(object who)
     Get the first inventory object of 'who'. Use GetNextObject() to find the next
     inventory objects.
     Returns the object or 0 if the inventory is empty.
   
   GetIP(object player)
     Get the ip address of 'player'. The given object should be a player object.
     Returns the ip address as a string or no value if the object is not a player
     object.
   
 GetSpeed(object who)  GetLastGrace(object who)
   Gets the speed of the given object.    Get the last_grace parameter value associated with the given object.
     Returns the last_grace value as an integer.
   
 GetFood(object who)  GetLastSP(object who)
   Gets the food level of the given object.    Get the last_sp parameter value associated with the given object.
     Returns the last_sp value as an integer.
   
 GetGrace(object who)  GetLocalDirectory()
   Gets the grace amount of the given object.    Return the name of the base directory containing the Crossfire read-write
     data files.
     Returns the directory name as a string.
   
 GetReturnValue()  GetMap(object who)
 GetDirection()    Determine the map the object 'who' is currently in.
 GetLastSP(object who)    Returns the map as a map or 0 if the items is not part of a map.
   Gets the last_sp parameter value associated with the given object.  
   
 GetLastGrace(object who)  GetMapDirectory()
   Gets the last_grace parameter value associated with the given object.    Return the name of the base directory containing the Crossfire maps. You need
     to concatenate the result with the value returned by GetDataDirectory() to
     get an absolute path.
     Returns the directory as a string.
   
   GetMapHeight(map map)
     Get the height (the number of tiles) of a map.
     Returns the height as an integer.
   
 GetAttackType()  GetMapObject()
 GetDamage(object who)    This function should not be used anymore. It always throws an exception.
   Gets the amount of damage associated with the given object.  
   GetMapPath(map map)
     Get the path name of the map.
     Returns the path name as a string.
   
   GetMapWidth(map map)
     Get the width (the number of tiles) of a map.
     Returns the width as an integer.
   
   GetMaxHP(object who)
     Get the maximum amount of Hit Points the given object can get.
     Returns the amount of hit points as an integer.
   
   GetMaxSP(object who)
     Get the maximum amount of mana the given object can get.
     Returns the maximum amount of mana as an integer.
   
   GetMessage(object obj)
     Get the message contained in the specified object. The message is what
     appears inside msg...endmsg tags.
     Returns the message as a string.
   
 GetName(object who)  GetName(object who)
   Gets the 'clear name' of the given object.    Get the 'clear name' of the given object.
     Returns the name as a string.
   
 GetEventOptions()  GetNextObject(object obj)
 GetEventPlugin()    Get the next object below 'obj'.
 GetType(object who)    Returns the next object or 0 if 'obj' is the last object.
   Gets the type of a given object, as a numerical identifier.  
   GetObjectAt(map map, int x, int y)
     Get the first object at position (x,y) in the map.
     Returns the object or 0 if the position is empty.
   
   GetObjectCost(object who, object obj, int type)
     Determine the cost of an object 'obj' if 'who' would buy or sell it. The
     parameter 'type' should be one or more values returned by CostFlagXxx().
     Returns the cost in silver coins as an integer.
   
   GetObjectMoney(object who)
     Determine how much money 'who' is carrying, including what is in containers.
     Returns the amount in silver coins as an integer.
   
 GetEventHandler()  GetPlayerDirectory()
 GetIP()    Return the name of the base directory containing the Crossfire players files.
 GetInventory()    You need to concatenate the result with the value returned by
 GetInternalName()    GetLocalDirectory() to get an absolute path.
 GetAC(object who)    Returns the directory as a string.
   Gets the Armor Class coefficient associated with the given object.  
   
 GetCha(object who)  GetPower(object who)
   Gets the Charisma value of the given object.    Get the Power value of the given object.
     Returns the power value as an integer.
   
 GetCon(object who)  GetPressure(int x, int y, map map)
   Gets the Constitution value of the given object.    Get the humidity level of a given square of a map.
     Returns the humidity level as an integer.
   
 GetDex(object who)    Remark: not implemented. Always returns zero.
   Gets the Dexterity value of the given object.  
   
 GetHP(object who)  GetPreviousObject(object obj)
   Gets the amount of Hit Points associated with the given object.    Get the object before 'obj'.
     Returns the previous object or 0 if 'obj' is the first object.
   
   GetQuantity(object obj)
     Return the number of items this object represents.
     Returns the number as a long.
   
 GetInt(object who)  GetReturnValue()
   Gets the Intelligence value of the given object.    Return the current exit status of the event script as an integer. See below
     for an overview of events that use the exit value.
   
 GetPow(object who)  GetSkillExperience(object who, string skill)
   Gets the Power value of the given object.    Get the experience of skill 'skill' the object 'who' has. 'skill' should
     skill name.
     Returns the skill experience as a long or no value if 'who' does not know the
     skill.
     Example:
       who = CFPython.WhoIsActivator()
       exp = CFPython.GetSkillExperience(who, "alchemy")
       if exp != None:
           CFPython.Write("Alchemy experience %d"%(exp), who)
       else:
           CFPython.Write("Alchemy skill is unknown", who)
   
   GetSlaying(object obj)
     Get the "slaying" field of an object.
     Returns the slaying value as a string.
   
 GetSP(object who)  GetSP(object who)
   Gets the amount of Mana possessed by the given object.    Get the amount of mana possessed by the given object.
     Returns the amount of mana as an integer.
   
 GetStr(object who)  GetSpeed(object who)
   Gets the Strength value of the given object.    Get the speed of the given object.
     Returns the speed as a float.
   
 GetWis(object who)  GetStrength(object who)
   Gets the Wisdom value of the given object.    Get the Strength value of the given object.
     Returns the strength as an integer.
   
 GetMaxHP(object who)  GetTempDirectory()
   Gets the Maximum amount of Hit Points the given object can get.    Return the name of the base directory containing temporary Crossfire files
     (for example swapped-out maps).
     Returns the directory as a string.
   
   GetTemperature(int x, int y, map map)
     Get the temperature of a given square of a map.
     Returns the temperature as an integer.
   
     Remark: not implemented. Always returns zero.
   
   GetTitle(object who)
     Get the title of 'who'. The "title" is the artifact suffix of in item. For
     example, an "gauntlets of the Titans" has the title "of the Titans".
     Returns the title as a string or no value if the object has no title.
   
 GetMaxSP(object who)    Note: this function does not return the title the player has chosen for
   Gets the Maximum amount of Mana the given object can get.    himself.
   
 GetXPos()  GetType(object who)
 GetYPos()    Get the type of a given object, as a numerical identifier.
     Returns the type as an integer.
   
   GetUniqueDirectory()
     Return the name of the base directory containing the Crossfire Unique items.
     You need to concatenate the result with the value returned by
     GetLocalDirectory() to get an absolute path.
     Returns the directory as a string.
   
   GetValue(object who)
     Get the "value" field of an object.
     Returns the value as an integer.
   
   GetWC(object who)
     Get the Weapon Class coefficient associated with the given object.
     Returns the weapon class coefficient as an integer.
   
   GetWeight(object who)
     Determine the weight of the given object. The weight does not include the
     inventory.
     Returns the weight in grams as an integer.
   
   GetWisdom(object who)
     Get the Wisdom value of the given object.
     Returns the wisdom value as an integer.
   
   GetXPosition(object obj)
     Get the x-position of an object in its map.
     Returns the x-position as an integer.
   
   GetYPosition()
     Get the y-position of an object in its map.
     Returns the y-position as an integer.
   
 H  H
 HitBack()  HasBeenApplied(object obj)
     Check whether the object has been applied before.
     Return value: test result as an integer - 0 if and only if false.
   
   HasStealth(object obj)
     Check whether the object is stealthy.
     Return value: test result as an integer - 0 if and only if false.
   
 HasXRays()  HasXRays()
 HasStealth()    Check whether the object uses or grants x-rays.
 HasBeenApplied()    Return value: test result as an integer - 0 if and only if false.
   
   HitBack()
     Check whether the object has the hitback flag set.
     Return value: test result as an integer - 0 if and only if false.
   
 I  I
 IsOutOfMap()  InsertObjectInside(object obj, object environment)
 IsCanBePicked(object who)    Insert the object 'obj' into 'environment'.
   Tests if "who" can be picked up.    Does not return a value.
   
     Example: see SetSlaying()
   
   IsAlive(object who)
     Test if the given object is alive.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 InsertObjectInside()  IsApplied(object who)
 IsInvisible(object who)    Test if the given object is applied.
   Tests if the given object is invisible.  
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsAlive(object who)  IsBlind(object who)
   Tests if the given object is alive.    Test if the given object causes blindness. For players, tests if he is blind.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsWiz(object who)  IsCanBePicked(object who)
   Tests if the given object is a DM.    Test if on object can be picked up.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsApplied(object who)  IsConfused(object who)
   Tests if the given object is applied.    Test if the given object is confused.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsUnpaid(object who)  IsCursed(object who)
   Tests if the given object is paid.    Test if the given object is cursed. Not that not all "damned" objects are
     cursed as well.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsFlying(object who)  IsDamned(object who)
   Tests if the given object is flying.    Test if the given object is damned.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsMonster(object who)  IsDungeonMaster(object who)
   Tests if the given object is a monster.    Test if the given object is a DM.
     Return value: test result as an integer - 0 if and only if false.
   
   IsFloor(object who)
     Test if the given object is a floor tile.
     Return value: test result as an integer - 0 if and only if false.
   
   IsFlying(object who)
     Test if the given object is flying.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsFriendly(object who)  IsFriendly(object who)
   Tests if the given object is in friendly mode.    Test if the given object is in friendly mode.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsGenerator(object who)  IsGenerator(object who)
   Tests if the given object is a generator.    Test if the given object is a generator.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsThrown(object who)  IsIdentified(object who)
   Tests if the given object can be thrown.    Test if the given object is identified.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsTurnable(object who)  IsInvisible(object who)
   Tests if the given object is Turnable.    Test if the given object is invisible.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsUsedUp(object who)  IsKnownCursed(object who)
   Tests if the given object is used up.    Test if the given object is known to be a cursed one.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsIdentified(object who)  IsKnownMagical(object who)
   Tests if the given object is identified.    Test if the given object is known to be a magical one.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsSplitting(object who)  IsLifesaver(object who)
   Tests if the given object can split.    Test if the given object is a Lifesaver. For players, tests if he wears an
     object that is a Lifesaver.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsUndead(object who)  IsMonster(object who)
   Tests if the given object is an undead.    Test if the given object is a monster.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsScared(object who)  IsOfType(object obj, int type)
   Tests if the given object is scared.    Check if the object is of the given type.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsUnaggressive(object who)    Note: There is no function to determine the type values by name.
   Tests if the given object is in unaggressive mode.  
     Example:
       if CFPython.IsOfType(CFPython.CreateObject("ring", (0, 0)), 70): # 70=RING
         # item is a ring
   
   IsOutOfMap(object obj, int x, int y)
     Check if the object would be outside of the current map if moved to (x,y).
     This function works for tiled maps.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsOfType()  
 IsRunningAway(object who)  IsRunningAway(object who)
   Tests if the given object is running away.    Test if the given object is running away.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsUnique(object who)  IsScared(object who)
   Tests if the given object is unique.    Test if the given object is scared.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsFloor(object who)  IsSleeping(object who)
   Tests if the given object is a floor tile.    Test if the given object is sleeping.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsLifeSaver(object who)  IsSplitting(object who)
   Tests if the given object is a LifeSaver.    Test if the given object can split.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsSleeping(object who)  IsThrown(object who)
   Tests if the given object is sleeping.    Test if the given object is designed to be thrown.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsConfused(object who)  IsTurnable(object who)
   Tests if the given object is confused.    Test if the given object can change its face with direction.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsCursed(object who)    Note: use SetDirection(who) to change the direction of turnable objects.
   Tests if the given object is cursed.  
   IsUnaggressive(object who)
     Test if the given object is in unaggressive mode.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsDamned(object who)  IsUndead(object who)
   Tests if the given object is damned.    Test if the given object is an undead.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsKnownMagical(object who)  IsUnique(object who)
   Tests if the given object is known to be a magical one.    Test if the given object is unique.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsKnownCursed(object who)  IsUnpaid(object who)
   Tests if the given object is known to be a cursed one.    Test if the given object is paid.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
 IsBlind(object who)  IsUsedUp(object who)
   Tests if the given object is blind.    Test if the given object has the flag "FLAG_IS_USED_UP" set.
   Return value: test result as an integer - 0 if and only if false.    Return value: test result as an integer - 0 if and only if false.
   
     Example:
       who = CFPython.WhoIsActivator()
       obj = CFPython.CreateObject("burning item", (0, 0))
       CFPython.Write("IsUsedUp(%s)=%d"%(CFPython.GetName(obj), CFPython.IsUsedUp(obj)), who)
   
   
 J  J
 K  K
 KillObject()  KillObject(object who, object what, int type)
     Kill the object 'what' in an combat-like fashion. 'who' is the object killing
     'what'. 'type' is the attack type; it should be one or more values returned
     by AttackTypeXxx().
     Does not return a value.
   
     Note: the death event of 'what' will be called.
   
 L  L
 LoadObject()  LoadObject(string str)
     Construct an object from its string representation. Use SaveObject() to
     convert an object into its string representation.
     Returns the created object or 0 if the object could no be created.
   
 M  M
 MatchString()  MakeInvisible(object obj)
 Message()    Test if the given object makes the wielder invisible. For players, tests if
 MakeInvisible()    he is invisible.
     Return value: test result as an integer - 0 if and only if false.
   
   MatchString(string str, string regex)
     Try to match the string 'str' to a regular expression 'regex'.
     Return value: test result as an integer - 0 if and only if false.
   
   Message(string text, object who[, int color])
     Write the message 'text' to the map of 'who'. 'color' determines the color
     and flags to use. (Consult the crossfire source code for all available flags
     NDI_*.) If 'color' if omitted, NDI_BLUE|NDI_UNIQUE is used.
     Does not return a value.
   
     Note: to write a message to just one player, use Write().
   
 N  N
 O  O
 OnlyAttack()  OnlyAttack(object who)
     Test if the given object evaporates if it has no enemy.
     Return value: test result as an integer - 0 if and only if false.
   
 P  P
 PickUp()  PayAmount(object buyer, int silver)
     Remove a given amount of silver coins from the buyer object. It uses money
     from the inventory or from pouches in the inventory of 'buyer'.
     Returns an integer, 1 for success or 0 for failure.
   
   PayForItem(object buyer, object what)
     Make 'buyer' to buy the object 'what'. Removes the necessary money from the
     inventory or from pouches in the inventory. It grants bargaining experience
     for a successful completion.
     Returns an integer, 1 for success or 0 for failure.
   
   PickUp(object who, object what)
     Make 'who' pick up the object 'what'.
     Does not return a value.
   
 Q  Q
 R  R
 ReadyMap()  ReadyMap(string mapname)
 ReflectMissiles()    Return the map with the name 'mapname'. The functions loads (or swaps in) the
 ReflectSpells()    map if necessary.
 RemoveObject()    Returns the map or 0 if the map could not be loaded.
 RegisterCommand()  
     Example:
       # teleport activator to another map
       map = CFPython.ReadyMap("/scorn/misc/beginners")
       CFPython.Teleport(CFPython.WhoIsActivator(), map, 10, 10)
   
   ReflectMissiles(object obj)
     Test if the given object reflects missiles. For players, tests if he reflects
     missiles.
     Return value: test result as an integer - 0 if and only if false.
   
   ReflectSpells(object obj)
     Test if the given object reflects spells. For players, tests if he reflects
     spells.
     Return value: test result as an integer - 0 if and only if false.
   
   RegisterCommand(string command, string script, float speed)
     Define a new command that players can call. 'script' is the Python script to
     execute if a player issues 'command'. 'speed' determines how long the command
     will paralyze the player.
   
     When the script is run, WhoAmI() will return the player that issued the
     command. WhatIsMessage() returns the command parameters (if any).
     Throws an exception if the command is already registered or if 'speed' is
     negative.
     If the script fails, it should call SetReturnValue(0).
   
     Note: It is possible to overwrite internal commands.
   
   RemoveObject(object obj)
     Remove an object from its environment (and frees it).
     Does not return a value.
   
     Note: do not use the object 'obj' afterwards.
   
     Note: if the removed object is a container, the objects inside are not freed,
     they are dropped to the ground.
   
 S  S
 SetQuantity()  SaveObject(object obj)
 SetName()    Convert an object into its string representation. Use LoadObject() to
 SetMessage()    reconstruct the object.
 SetSkillExperience()    Returns the string representation.
 SetCursed()  
 SetUnaggressive()  Say(object who, message text)
 SetGod()    Make 'who' say 'text'.
 SetWeight()    Does not return a value.
 Say()  
 SetInvisible()  SendCustomCommand(object player, string cmd)
 SetSpeed()    Send 'cmd' to the crossfire client of 'player'. Consult the crossfire
 SetFood()    protocol specification for valid commands. 'player' must be a player object.
 SetGrace()    Does not return a value.
 SetReturnValue()  
 SetDirection()    Example:
 SetLastSP()      CFPython.SendCustomCommand(CFPython.WhoIsActivator(), "drawinfo 1 text")
 SetLastGrace()  
 SetFace()  SetAC(object obj, int value)
 SetAttackType()    Set the Armor Class coefficient if the given object to 'value'.
 SetDamage()    Does not return a value.
 SetBeenApplied()    Throws an exception if the value is less than -120 or higher than 120.
 SetIdentified()  
 SaveObject()  SetAttackType(object obj, int type)
 SetEventHandler()    Sets the attack type of an object. The type can be one or more return values
 SetEventPlugin()    of AttackTypeXxx().
 SetEventOptions()    Does not return a value.
 SetPosition()  
 SetNickname()    Example:
 SetAC()      # create a sword with fire and cold attack type
 SetCha()      sword = CFPython.CreateObject("sword", (1, 3))
 SetCon()      CFPython.SetAttackType(sword, CFPython.AttackTypeFire()|CFPython.AttackTypeCold())
 SetDex()      CFPython.SetIdentified(sword, 1)
 SetHP()  
 SetInt()  SetBeenApplied(object obj, int flag)
 SetMaxHP()    Mark the object as been applied before (flag != 0) or has never been applied
 SetMaxSP()    (flag = 0).
 SetPow()    Does not return a value.
 SetSP()  
 SetStr()  SetCharisma(object obj, int value)
 SetWis()    Set the Charisma value of the given object.
 StandStill()    Does not return a value.
     Throws an exception if the value is less than -30 or higher than 30.
   
   SetConstitution(object obj, int value)
     Set the Constitution value of the given object.
     Does not return a value.
     Throws an exception if the value is less than -30 or higher than 30.
   
   SetCursed(object obj, int flag)
     Make the object cursed (flag != 0) or removes a curse (flag = 0).
     Does not return a value.
   
     Note: does not remove the damned flag - use SetDamned() to change the damned
     status.
   
   SetDamage(object obj, int value)
     Set the amount of damage associated with the given object.
     Does not return a value.
     Throws an exception if the value is negative or higher than 120.
   
   SetDamned(object obj, int flag)
     Make the object damned (flag != 0) or removes a damnation (flag = 0).
     Does not return a value.
   
     Note: does not affect the cursed flag - use SetCursed() to change the cursed
     status.
   
   SetDexterity(object obj, int value)
     Set the Dexterity value of the given object.
     Does not return a value.
     Throws an exception if the value is less than -30 or higher than 30.
   
   SetDirection(object who, int dir)
     Set the direction 'who' is currently facing.
     Does not return a value.
   
   SetEventHandler(object who, int event, string script)
     Change the event handler (the script file name) of 'who' for the event number
     'event' to 'script'. The parameter 'event' should be a value returned by
     EventXxx(). Does not return a value.
   
     Note: This function cannot add a new event handler to an object without one.
   
   SetEventOptions(object who, int event, string options)
     Change the event options of 'who' for the event number 'event' to 'options'.
     The parameter 'event' should be a value returned by EventXxx().
     Does not return a value.
   
     Note: This function cannot add a new event handler to an object without one.
   
   SetEventPlugin(object who, int event, string plugin)
     Change the event plugin name of 'who' for the event number 'event' to
     'plugin'. The parameter 'event' should be a value returned by EventXxx().
     The Python plugin has the plugin name "Python".
     Does not return a value.
   
     Note: This function cannot add a new event handler to an object without one.
   
   SetFace(object obj, string anim)
     Set the face of an object 'obj' to 'anim'. 'anim' is an animation name.
     Does not return a value.
   
     Example:
       # make a pair of speed boots look like Idaten boots
       obj = CFPython.CreateObject("speedboots", (1, 3))
       CFPython.SetFace(obj, "idaten")
   
   SetFood(object who, int food)
     Set the food level of the given object.
     Does not return a value.
     Throws an exception if the value is negative or higher than 999.
   
   SetGod(object who, string god)
     Make 'who' to become a follower of 'god'.
     Does not return a value.
     Throws an exception if 'god' is invalid.
   
     Note: Does nothing if 'who' does not know the skill 'praying'.
   
   SetGrace(object obj, int value)
     Set the grace amount of the given object.
     Does not return a value.
     Throws an exception if the value is less than -32000 or higher than 32000.
   
   SetHP(object obj, int value)
     Set the amount of Hit Points associated with the given object.
     Does not return a value.
     Throws an exception if the value is negative or higher than 32000.
   
   SetIdentified(object obj, int flag)
     Mark the object as identified (flag != 0) or not identified (flag = 0).
     Does not return a value.
   
   SetIntelligence(object who, int value)
     Set the Intelligence value of the given object.
     Does not return a value.
     Throws an exception if the value is less than -30 or higher than 30.
   
   SetInvisible(object obj, int flag)
     Set (flag != 0) or clears (flag = 0) the invisible flag of the object.
     Does not return a value.
   
   SetLastGrace(object who, int value)
     Set the last_grace parameter value associated with the given object.
     Does not return a value.
     Throws an exception if the value is negative or higher than 32000.
   
   SetLastSP(object who, int value)
     Set the last_sp parameter value associated with the given object.
     Does not return a value.
     Throws an exception if the value is negative or higher than 32000.
   
   SetMaxHP(object who, int value)
     Set the maximum amount of Hit Points the given object can get.
     Does not return a value.
     Throws an exception if the value is negative or higher than 32000.
   
   SetMaxSP(object who, int value)
     Set the maximum amount of mana the given object can get.
     Does not return a value.
     Throws an exception if the value is negative or higher than 32000.
   
   SetMessage(object obj, string msg)
     Set the message contained in the specified object. The message is what
     appears inside msg...endmsg tags.
     Does not return a value.
   
   SetName(object name, string name[, string name_pl])
     Set the 'clear name' of the given object. If 'name_pl' (name to use for
     multiple objects) is not given, 'name' is used.
     Does not return a value.
   
     Example:
       # create a scroll with a custom name
       key = CFPython.CreateObject("scroll", (0, 0))
       CFPython.SetName(key, "warning scroll", "warning scrolls")
       CFPython.SetMessage(key, "<unreadable text>")
   
   SetNickname(object obj, string name)
     Set the title of a player or an object.
     Does not return a value.
   
   SetPosition(object obj, (int x, int y))
     Move an object to another spot on the same map. The object must not be part
     of an inventory. Places the item in a nearby spot if the destination spot is
     blocked. The object will no be moved if no free spot can be found.
     Does not return a value.
   
   SetPower(object obj, int value)
     Set the Power value of the given object.
     Does not return a value.
     Throws an exception if the value is less than -30 or higher than 30.
   
   SetQuantity(object obj, int nrof)
     Set the number of items this object represents.
     Does not return a value.
     Throws an exception if the value is negative.
   
     Note: the object should not be in a player's inventory because the client
     view will not be updated.
   
     Note: "nrof=0" does not mean "destroy the item".
   
   SetReturnValue(int value)
     Set the current exit status of the event script. See below for an overview of
     events that use the exit value.
     Does not return a value.
   
   SetSkillExperience(object who, string skill, long exp)
     Set the experience of skill 'skill' the object 'who' has. 'skill' should be a
     skill name.
     Does not return a value.
     Throws an exception if 'who' does not know the 'skill'.
     Throws an exception if the value is negative.
   
     Note: If the new experience value is less than the current value, 'who'
     looses the difference from his total experience.
   
   SetSlaying(object obj, string value)
     Set the "slaying" field of an object.
     Does not return a value.
   
     Example:
       # create a key and set its lock-code
       key = CFPython.CreateObject("key2", (0, 0))
       CFPython.SetName(key, "treasure key")
       CFPython.SetSlaying(key, "treasure-code")
       CFPython.InsertObjectInside(key, CFPython.WhoIsActivator())
   
   SetSP(object obj, int value)
     Set the amount of mana possessed by the given object.
     Does not return a value.
     Throws an exception if the value is negative or higher than 32000.
   
   SetSpeed(object obj, float value)
     Set the speed value of the given object.
     Does not return a value.
     Throws an exception if the speed value is less than -9.99 or higher than
     9.99.
   
   SetStrength(object obj, int value)
     Set the Strength value of the given object.
     Does not return a value.
     Throws an exception if the value is less than -30 or higher than 30.
   
   SetTitle(object obj, string title)
     Set the title of the given object.
     Note: to set the title of a player, use SetNickname() instead.
     Does not return a value.
   
   SetUnaggressive(object obj, int flag)
     Make the given object unaggressive (flag != 0) or aggressive (flag = 0).
     Does not return a value.
   
   SetValue(object obj, int silver)
     Set the "value" field of an object in silver coins.
     Does not return a value.
     Throws an exception if the value is negative.
   
   SetVariable(object obj, string value)
     Change an object according to an argument string. It is equivalent of the DM
     patch command.
     Does not return a value.
   
   SetWC(object obj. int value)
     Set the Weapon Class coefficient associated with the given object.
     Does not return a value.
     Throws an exception if the value is less than -120 or higher than 120.
   
   SetWeight(object obj, long weight)
     Set the weight (in grams) of the given object.
     Does not return a value.
     Throws an exception if the value is negative or higher than 1000000000.
   
   SetWisdom(object obj, int value)
     Set the Wisdom value of the given object.
     Does not return a value.
     Throws an exception if the value is less than -30 or higher than 30.
   
   StandStill(object obj)
     Test if the given object has the flag "FLAG_STAND_STILL" set.
     Return value: test result as an integer - 0 if and only if false.
   
 T  T
 Take()  Take(object who, string what)
 Teleport()    Make 'who' to pick up 'what'. The syntax of 'what' is the same as what is
     allowed for the client command 'get'.
     Does not return a value.
   
   Teleport(object who, map map, int x, int y)
     Move the given object to (x,y) in map 'map'. The object to be moved may be
     part of a map or in some object's inventory. If the destination position is
     blocked, the object is placed in a nearby space.
     Does not return a value.
   
     Note: if the destination coordinates are outside of the map or if no free
     space could be found, this function does not move the object.
   
     Note: the object to be moved should not be part of a player's inventory.
   
 U  U
 V  V
 W  W
   WasDungeonMaster(object who)
     Test if the given object is or has been a DM.
     Return value: test result as an integer - 0 if and only if false.
   
   WhatIsMessage()
     Return the message related to the current event as a string or no object if
     no message is applicable.
   
     Note: see below for an overview of events with messages.
   
 WhoAmI()  WhoAmI()
     Return the object related to the current event or 0 if not applicable.
   
     Note: the related object is frequently (but not always) the object containing
     the script. See below for an overview of events with related objects.
   
 WhoIsActivator()  WhoIsActivator()
 WhatIsMessage()    Return the object that caused the script to run or 0 if not applicable.
 Write()    Note: See below for an overview of events with activator objects.
   
 WhoIsOther()  WhoIsOther()
 WasWiz()    Return an auxiliary object for the current event or 0 if not applicable.
   
     Note: See below for an overview of events with auxiliary objects.
   
   Write(string text, object who[, int color])
     Write the message 'text' to the player 'who'. 'color' determines the color
     and flags to use. (Consult the crossfire source code for all available flags
     NDI_*.) If 'color' if omitted, NDI_BLUE|NDI_UNIQUE is used.
     Does not return a value.
   
     Note: to write a message to all players in a map, use Message().
   
 X  X
 Y  Y
 Z  Z
   
 Chachkoff Y.  
   
 yann.chachkoff@mailandnews.com  What parameters are available to a script?
   ------------------------------------------
   
   The following table contains all events that can be tied to objects.
   
   event Activator WhoAmI Other Message parm1 parm2 parm3 result comment
   ----- --------- ------ ----- ------- ----- ----- ----- ------ --------------
   apply   op     ALTAR     -      -    0     0     0     yes    'op' prays at 'altar'
   apply   op     BOOK      -      -    0     0     0     no     'op' reads 'book'
   apply   op     ITEM      -      -    aflag 0     0     yes    'op' applies 'item'
   attack  hitter hitter    OP     -    0     dam   wc    no     'hitter' hits 'op'
   attack  hitter ITEM      op     -    0     dam   wc    no     'hitter' hits 'op' with 'item'
   close   op     CONTAINER -      -    0     0     0     yes    'op' closes 'container'
   death   -      PLAYER    -      -    0     0     0     yes    'player' dies
   death   hitter OP        -      -    atype 0     0     yes    'hitter' kills 'op'
   drop    op     ITEM      -      -    nrof  0     0     yes    'op' drops 'item'
   pickup                                                        (not implemented)
   say     op     ITEM      npc    msg  0     0     0     always 'op' tells 'msg' to 'item' in 'npc''s inventory
   say     op     NPC       -      msg  0     0     0     always 'op' tells 'msg' to 'npc'
   stop    -      OP        -      -    0     0     0     no     thrown object 'op' is stopped
   throw   op     ITEM      -      -    0     0     0     no     'op' throws 'item'
   time    -      OP        -      -    0     0     0     no     'op' takes a turn
   timer   OP     -         -      -    0     0     0     no     timer of 'op' has expired
   trigger OP     item      -      msg  0     0     0     always 'op' writes 'msg' into 'item'
   trigger TELEPORTER op    -      -    0     0     0     yes    'teleporter' moves 'op'
   trigger TRAP  originator victim -    0     0     0     yes    'originator' causes 'victim' to trigger 'trap'
   
   Notes:
   - the object that contains the event script is written in capitals.
   - result column: indicates how the result value set by SetReturnValue() is
     used: no=result value is not used; yes=non-zero result value prevents the
     normal action; always=prevents the normal action regardless of result value.
   - apply event: aflag: Consult the crossfire source code for all available flags
     AP_*.
   - death event: atype=attacktype
   - trigger event: originator is unset if the trap (pedestal/button) someone left
     it.
   - parm1..3 are not currently available to the script.
   - attack event: 'item' can be a weapon or a missile.
   
   
   The following table contains all global events.
   
   event Activator WhoAmI Other Message  comment
   ----- --------- ------ ----- -------- --------------
   born     op     -      -     -        new player 'op' was created
   clock    -      -      -     -        called each tick
   crash                                 (not implemented)
   gdeath                                player 'op' dies (not implemented)
   gkill                                 'hitter' kills 'op' (not implemented)
   kick     op     -      -     name     player 'op' named 'name' is kicked out of the game
   login    op     op     -     ip       player 'op' logged in from IP address 'ip'
   logout   op     op     -     ip       player 'op' logged out from IP address 'ip'
   mapenter op     -      -     -        player 'op' has entered a new map
   mapleave op     -      -     -        player 'op' is leaving a map
   mapreset -      -      -     mappath  map 'mappath' is resetting
   muzzle   op     -      -     name     player 'op' named 'name' is muzzled
   remove   op     -      -     -        player 'op' quits the game
   shout    op     -      -     message  player 'op' shouts 'message'
   tell                                  (not implemented)
   
   Notes:
   - kick event: param is either the player name or None if all players are
     kicked.
   - login event: this event is also called when a new player was created.


Legend:
line(s) removed in v.1.6 
line(s) changed
 line(s) added in v.1.7

File made using version 1.98 of cvs2html by leaf at 2011-07-21 19:42