[Crossfire-wiki] [Crossfire DokuWiki] page changed: cfpython

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Sun Aug 27 09:19:13 CDT 2006


A page in your DokuWiki was added or changed. Here are the details:



Date        : 2006/08/27 09:19

User        : ryo

Edit Summary: constants



@@ -13,8 +13,24 @@

  

  All scripts should import the ''Crossfire'' module.

  

  ''xxx()'' specifies a method, ''xxx'' specifies a property.

+ 

+ 

+ Constants are available to wrap values used in Crossfire code like objec
t types, movements, ...

+ They are available through ''Crossfire.xxx.value'', where ''xxx'' is the
 constant type.

+ 

+ For each constant group ''xxx'' there exists a ''xxxName'' dictionary ob
ject containing the name of the value as a string.

+ 

+ The following constant types exist:

+   * ''Direction'': contains NORTH, NORTHEAST, ..., NORTHWEST

+   * ''Type'': object type, as defined in ''include/define.h''

+   * ''Move'': movement types, as defined in ''define/define.h''

+ 

+ Example:

+ ''whoami.Say("%s => %d"%(Crossfire.DirectionName[Crossfire.Direction.N
ORTH],Crossfire.Direction.NORTH))'' will write ''NORTH => 1''

+ 

+ **Warning**: Python doesn't know about constants, thus scripts can modif
y those values. Doing this can lead to weird results, and should be avoide
d at all cost. Note that the C code itself is immune to the changes, only 
the scripts would suffer.

  

  ==== Crossfire module methods ====

  

    * WhoAmI





IP-Address  : 82.236.87.204

Old Revision: http://wiki.metalforge.net/doku.php/cfpython?rev=115612680
2

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