[Crossfire-wiki] [Crossfire DokuWiki] page changed: cfpython
no-reply_wiki at metalforge.org
no-reply_wiki at metalforge.org
Fri Nov 24 10:28:48 CST 2006
A page in your DokuWiki was added or changed. Here are the details:
Date : 2006/11/24 10:28
User : ryo
Edit Summary: more info
@@ -78,57 +78,146 @@
Example:
''whoami.Say("%s => %d"%(Crossfire.DirectionName[Crossfire.Direction.NORTH],Crossfire.Direction.NORTH))'' will write ''NORTH => 1''
**Warning**: Python doesn't know about constants, thus scripts can modify those values. Doing this can lead to weird results, and should be avoided at all cost. Note that the C code itself is immune to the changes, only the scripts would suffer.
+
===== Crossfire module methods =====
- * WhoAmI
- * WhoIsActivator
- * WhoIsOther
- * WhatIsMessage
- * ScriptName
- * ScriptParameters
- * MapDirectory
- * UniqueDirectory
- * TempDirectory
- * ConfigDirectory
- * LocalDirectory
- * PlayerDirectory
- * DataDirectory
- * DirectionNorth
- * DirectionNorthEast
- * DirectionEast
- * DirectionSouthEast
- * DirectionSouth
- * DirectionSouthWest
- * DirectionWest
- * DirectionNorthWest
- * CostFlagTrue
- * CostFlagBuy
- * CostFlagSell
- * CostFlagNoBargain
- * CostFlagIdentified
- * CostFlagNotCursed
- * ReadyMap
- * FindPlayer
- * MatchString
- * GetReturnValue
- * SetReturnValue
- * PluginVersion
- * CreateObject
- * CreateObjectByName
- * GetPrivateDictionary
- * GetSharedDictionary
- * GetArchetypes
- * GetMaps
- * GetParties
- * GetRegions
- * RegisterCommand
- * RegisterGlobalEvent
- * UnregisterGlobalEvent
- * GetTime
+ ==== WhoAmI ====
+ Returns the ''Crossfire.Object'' to from which the event being handled was raised. Can be ''NULL''.
+
+ ==== WhoIsActivator ====
+ Returns the ''Crossfire.Object'' having caused the event being handled. Can be ''NULL''.
+
+ ==== WhoIsOther ====
+ ==== WhatIsMessage ====
+ ==== ScriptName ====
+ Returns the path of the currently executing script. Relative to maps directory FIXME check
+
+ ==== ScriptParameters ====
+ ==== MapDirectory ====
+ Returns the system directory containing the maps.
+
+ ==== UniqueDirectory ====
+ Returns the system directory where unique items and maps are stored. FIXME?
+
+ ==== TempDirectory ====
+ Returns the system directory where temporary files are stored.
+
+ ==== ConfigDirectory ====
+ FIXME?
+
+ ==== LocalDirectory ====
+ FIXME?
+
+ ==== PlayerDirectory ====
+ Returns the system directory containing player files.
+
+ ==== DataDirectory ====
+ Returns the system directory containing persistent data.
+
+ ==== DirectionNorth ====
+ ==== DirectionNorthEast ====
+ ==== DirectionEast ====
+ ==== DirectionSouthEast ====
+ ==== DirectionSouth ====
+ ==== DirectionSouthWest ====
+ ==== DirectionWest ====
+ ==== DirectionNorthWest ====
+ ==== CostFlagTrue ====
+ ==== CostFlagBuy ====
+ ==== CostFlagSell ====
+ ==== CostFlagNoBargain ====
+ ==== CostFlagIdentified ====
+ ==== CostFlagNotCursed ====
+ ==== ReadyMap ====
+ Parameter:
+ * map name (string)
+
+ Loads specified map, and returns a ''Crossfire.Map'' object wrapping it. Will return ''NULL'' if map couldn't be found.
+
+ FIXME what about unique player map? Or only maps in /maps?
+
+ ==== FindPlayer ====
+ Parameter:
+ * player name (string) FIXME partial?
+
+ Returns a ''Crossfire.Player'' object for specified player, based on name, or ''NULL'' if not found.
+
+ ==== MatchString ====
+ Parameters: FIXME check order
+ * string to be searched
+ * pattern to search for
+
+ Returns ''1'' if string matches the pattern, ''0'' else.
+
+ Pattern can be a regular expression FIXME specifications
+
+ ==== GetReturnValue ====
+ Return current return value.
+
+ ==== SetReturnValue ====
+ Parameters:
+ * return value (integer)
+
+ Sets the value the plugin will return to the server when the script exits. Value and effect depend on the event being handled.
+
+ ==== PluginVersion ====
+ Returns an integer representing the Python plugin version.
+
+ ==== CreateObject ====
+ Returns an empty object which can then be manipulated and inserted in map.
+
+ ==== CreateObjectByName ====
+ Parameters:
+ * archetype name (string) FIXME make sure
+
+ Returns object of specified archetype, or ''null'' if archetype wasn't found.
+
+ ==== GetPrivateDictionary ====
+ Returns a Python ''dictionary'' the script can use to store data between runs. This data is not shared with other scripts.
+
+ Note that data will be lost in case of server restart.
+
+ ==== GetSharedDictionary ====
+ Returns a Python ''dictionary'' the script can use to share data with other scripts.
+
+ Note that data will be lost in case of server restart.
+
+ ==== GetArchetypes ====
+ Returns a Python ''list'' containing ''Crossfire.Archetype'' objects representing all archetypes the server knows. Should not be called lightly, as this can take some time.
+
+ ==== GetMaps ====
+ Returns a Python ''list'' containing ''Crossfire.Map'' objects, one for each map currently being loaded. This includes random and unique maps.
+
+ ==== GetParties ====
+ Returns a Python ''list'' containing ''Crossfire.Party'' objects, one for each existing party on the server.
+
+ ==== GetRegions ====
+ Returns a Python ''list'' containing ''Crossfire.Region'' objects, one for each region.
+
+ ==== RegisterCommand ====
+ Parameters:
+ * command name (string)
+ * script (string)
+ * speed (decimal, must be positive or 0)
+
+ Registers a server command which will be mapped to specified script. See [[server plugin#Registering a command]] for more information.
+
+ ==== RegisterGlobalEvent ====
+ ==== UnregisterGlobalEvent ====
+ ==== GetTime ====
+ Returns a Python ''list'' corresponding to the in-game server time. Fields are (start at ''0'' to access):
+ - year
+ - month
+ - day
+ - hour
+ - minute
+ - day of week
+ - week of month
+ - season
===== Crossfire.Object methods and attributes =====
Properties in **bold** are read-write, others are readonly.
IP-Address : 213.174.127.3
Old Revision: http://wiki.metalforge.net/doku.php/cfpython?rev=1164383666
New Revision: http://wiki.metalforge.net/doku.php/cfpython
--
This mail was generated by DokuWiki at
http://wiki.metalforge.net/
More information about the crossfire-wiki
mailing list