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

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Sat Aug 16 03:29:08 CDT 2008


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

Date        : 2008/08/16 03:29
User        : techolous
Edit Summary: add a section for examples

@@ -141,8 +141,10 @@
  Returns the ''Crossfire.Object'' from which the event being handled was raised, corresponds to the ''[[server_plugin#Hooking to an object-specific event|op]]'' parameter of the event. Can be ''None''. For a map event, this is a ''Crossfire.Map''
  
  ==== WhoIsActivator ====
  Returns the ''Crossfire.Object'' having caused the event being handled, corresponds to the ''[[server_plugin#Hooking to an object-specific event|activator]]'' parameter of the event. Can be ''None''.
+ === Examples ===
+   * [[cfpython#Move a player onto a map]]
  
  ==== WhoIsOther ====
  Returns the ''Crossfire.Object'' being part of the event, corresponds to the ''[[server_plugin#Hooking to an object-specific event|third]]'' parameter of the event. Can be ''None''.
  ==== WhatIsMessage ====
@@ -235,8 +237,10 @@
    * ''String'', the map path to load
    * ''Number'', flags, optional. Combination of the following values:
      * 2: map is a player's unique map. Path is assumed to be the full path already, and it won't be changed
      * 16: map is reloaded anyway, even if it is already loaded
+ === Examples ===
+   * [[cfpython#Move a player onto a map]]
  
  ==== CreateObject ====
  Returns an empty object which can then be manipulated and inserted in a map.
  
@@ -260,8 +264,9 @@
  
  Use the server logging facilities to output script messages in server console. This is the **recommended** method, instead of using the
  python build-in "print" method. Using this, scripts take advantage of Debug and Monster level which can be hidden at will by server admin (log level), and
  have access to the error level, mentioning to admin serious troubles.
+ 
  Example:
  <code>Crossfire.Log(Crossfire.LogDebug,'Player %s entered guild %s' %obj.Name %guildName)</code>
  ==== RegisterCommand ====
  Parameters:
@@ -465,8 +470,9 @@
    * **NoDamage**: ''Boolean''
    * **RandomMovement**: ''Boolean''
  
  FIXME document all parameters. Link to relevant Crossfire function. Split in "standard function" and "helper function"?
+ 
  
  ==== ActivateRune ====
  Current object springs like a trap, hitting the victim.
  
@@ -733,8 +739,10 @@
    * ''Number'': x coordinates
    * ''Number'': y coordinates
  
  Return value: ''Number'', 0 for success, 1 for failure.
+ === Examples ===
+   * [[cfpython#Move a player onto a map]]
  
  ==== WriteKey ====
  Inserts specified key/value in the object.
  
@@ -749,8 +757,9 @@
    * **Path**: ''String''
    * TempName: ''String''
    * Name: ''String''
    * ResetTime: ''Number''
+ 
    * ResetTimeout: ''Number''
    * Players: ''Number'', number of players on the map
    * Light: ''Number''
    * Darkness: ''Number''
@@ -868,4 +877,24 @@
    * Next: ''Crossfire.Region''
  
  ==== Parent ====
  Return value: a ''Crossfire.Region'', or ''None'' if no parent region.
+ 
+ ====== Example Scripts ======
+ A section
+ === Move a player onto a map ===
+ This script will send its activator to jail, placing them in the 15 minute cell.
+ <code python>
+ import Crossfire
+ 
+ #we get the the object that triggered this script
+ activator = Crossfire.WhoIsActivator()
+ 
+ #make sure that the map is loaded, and get the object representing it
+ #we could get the map's default entry coordinates with 'm.enter_x' and 'm.enter_y'
+ m = Crossfire.ReadyMap('/scorn/misc/jail')
+ 
+ #teleport the activating object to the x:15 y:1 coordinates of the map (m) we just readied
+ activator.Teleport(m, 15, 1)
+ </code>
+ === Object.WriteKey ===
+ FIXME write an example


IP-Address  : 72.88.103.127
Old Revision: http://wiki.metalforge.net/doku.php/cfpython?rev=1218868651
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