User Tools

Site Tools


cfpython:tod

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
cfpython:tod [2013/02/03 09:39]
127.0.0.1 external edit
cfpython:tod [2018/03/30 08:54] (current)
karl point internal links to new locations, few formattings
Line 1: Line 1:
 ====== Time based python scripts ====== ====== Time based python scripts ======
 +
 ===== Common conventions ===== ===== Common conventions =====
-The folder [[http://​crossfire.svn.sourceforge.net/​viewvc/​crossfire/​maps/​trunk/​python/​tod|python/​tod]] in crossfire maps contains several scripts ready to be linked to event_xxxx object in map editor. All those scripts use common naming and parameters conventions. ​+The folder [[http://​crossfire.svn.sourceforge.net/​viewvc/​crossfire/​maps/​trunk/​python/​tod|python/​tod]] in crossfire maps contains several scripts ​\\ 
 +ready to be linked to //event_xxxx// object in a [[:​crossfireeditor|map editor]] \\ 
 +All those scripts use common naming and parameters conventions. ​ 
 ==== JSON parameters ==== ==== JSON parameters ====
-All parameters are passed as arguments in //Message// of event, using JSON (JavaScript Object Notation). Basically, it takes the forms of "​key"​ : "​value"​ list enclosed in braces. Example:<​code javascript>​+All parameters are passed as arguments in //Message// of event, using JSON (JavaScript Object Notation). ​\\ 
 +Basically, it takes the forms of "​key"​ : "​value"​ list enclosed in braces. ​\\ 
 +Example:<​code javascript>​
 { {
   "​key1"​ : "​value1",​   "​key1"​ : "​value1",​
Line 10: Line 16:
   "​key3"​ : "​value3"​   "​key3"​ : "​value3"​
 }</​code>​ }</​code>​
-For boolean type, the possible values are ''​True''​ and ''​False'',​ other type are, for now, only String between double quotes. Some script parameters accept list of value. A list uses square bracket and separate it's value by comas. Example: +For boolean type, the possible values are ''​True''​ and ''​False'',​ other type are, for now, only String between double quotes. ​\\ 
-<code javascript>​+Some script parameters accept list of value. ​\\ 
 +A list uses square bracket and separate it's value by comas. ​\\ 
 +Example:<​code javascript>​
 { {
     "​key" ​  : "​skeleton kills"     "​key" ​  : "​skeleton kills"
Line 20: Line 28:
 } }
 </​code>​ </​code>​
-I hope to see gridarta ​editor be able to edit such structure for you, but until then you will have to do it by hand. It's not very complex to understand anyway.+I hope to see the [[:​Gridarta]] ​editor be able to edit such structure for you, but until then you will have to do it by hand. It's not very complex to understand anyway.
  
 ==== Period type parameter values ==== ==== Period type parameter values ====
Line 62: Line 70:
 |Dusk| Between 6:00 pm and 9:00 pm | |Dusk| Between 6:00 pm and 9:00 pm |
  
-For demonstration of the scripts, mapmakers are invited to take a look at the demo maps at [[http://​crossfire.svn.sourceforge.net/​viewvc/​crossfire/​maps/​trunk/​test/​tod|/​test/​tod]] and [[http://​crossfire.svn.sourceforge.net/​viewvc/​crossfire/​maps/​trunk/​test/​tod2|/​test/​tod2]] in the default crossfire maps+For demonstration of the scripts, mapmakers are invited to take a look at the demo maps \\  
 +at [[http://​crossfire.svn.sourceforge.net/​viewvc/​crossfire/​maps/​trunk/​test/​tod|/​test/​tod]] and [[http://​crossfire.svn.sourceforge.net/​viewvc/​crossfire/​maps/​trunk/​test/​tod2|/​test/​tod2]] ​\\ 
 +in the default crossfire maps.
  
 ===== Available scripts ===== ===== Available scripts =====
Line 73: Line 83:
 **Parameters** **Parameters**
   * **when**(list):​ periods of day when this filter lets event it is attached to happen.   * **when**(list):​ periods of day when this filter lets event it is attached to happen.
-  * **match**: "​one"​ or "​all", ​whethever ​only one match in list is needed or all must match current time +  * **match**: "​one"​ or "​all", ​whenever ​only one match in list is needed or all must match current time 
-  * **inverse**:​ if true, a match is seen as a non-match and a non-match is seen as a match. See that as a "everytime ​except when ...." rule+  * **inverse**:​ if true, a match is seen as a non-match and a non-match is seen as a match. See that as a "every time except when ...." rule
  
  
Line 86: Line 96:
 **Parameters** **Parameters**
   * **when**(list):​ periods of day when this script will stay "​pushed"​.   * **when**(list):​ periods of day when this script will stay "​pushed"​.
-  * **match**: one or all, whethever ​only one match in list is needed or all list must match current time +  * **match**: one or all, whenever ​only one match in list is needed or all list must match current time 
-  * **inverse**:​ if true, a match is seen as a non-match and vice version. See that as a "everytime ​except when ...." rule+  * **inverse**:​ if true, a match is seen as a non-match and vice version. See that as a "every time except when ...." rule
   * **connected**:​ connection number to push/​release in map   * **connected**:​ connection number to push/​release in map
  
Line 93: Line 103:
 **Script** /​python/​tod/​replace.py **Script** /​python/​tod/​replace.py
  
-**Description**: ​ Makes the object is is attached to swap at given periods of day with a specifc ​object in the event'​s inventory. To use it, give this event'​s parameters a period an a match rule. Put also in the inventory the swapped object (owner of event) the object that will replace it. The swap is reversed when leaving the swap matching period. This work both on map items and on inventory items. Typically this script would be attached to the event_time of the object to transform.+**Description**: ​ Makes the object is is attached to swap at given periods of day with a specific ​object in the event'​s inventory. To use it, give this event'​s parameters a period an a match rule. Put also in the inventory the swapped object (owner of event) the object that will replace it. The swap is reversed when leaving the swap matching period. This work both on map items and on inventory items. Typically this script would be attached to the event_time of the object to transform.
  
 **Parameters** **Parameters**
   * **when**(list):​ periods when this script'​s owner will stay transformed.   * **when**(list):​ periods when this script'​s owner will stay transformed.
-  * **match**: one or all, whethever ​only one match in list is needed or all list must match current time +  * **match**: one or all, whenever ​only one match in list is needed or all list must match current time 
-  * **inverse**:​ if true, a match is seen as a non-match and vice version. See that as a "everytime ​except when ...." rule+  * **inverse**:​ if true, a match is seen as a non-match and vice version. See that as a "every time except when ...." rule
  
  
Line 105: Line 115:
 **Script** /​python/​tod/​replace_in_map.py **Script** /​python/​tod/​replace_in_map.py
  
-**Description**: ​ Scan the current map of objects matching some criterias ​and transform them into another specific object. Like for Object Transforming,​ the transformation is reverted at end of specified period. This work ony on map items. Typically this script would be attached to the event_time of guardian object.+**Description**: ​ Scan the current map of objects matching some criteria ​and transform them into another specific object. Like for Object Transforming,​ the transformation is reverted at end of specified period. This works only on map items. Typically this script would be attached to the event_time of guardian object.
  
 **Parameters** **Parameters**
   * **when**(list):​ periods when this script'​s owner will stay transformed.   * **when**(list):​ periods when this script'​s owner will stay transformed.
-  * **match**: one or all, whethever ​only one match in list is needed or all list must match current time +  * **match**: one or all, whenever ​only one match in list is needed or all list must match current time 
-  * **inverse**:​ if true, a match is seen as a non-match and vice version. See that as a "everytime ​except when ...." rule +  * **inverse**:​ if true, a match is seen as a non-match and vice version. See that as a "every time except when ...." rule 
-  * **from**(list):​ possible names a map object can match to be transformed. This is the name as given by [[:​cfpython#​object|the Name field]] +  * **from**(list):​ possible names a map object can match to be transformed. This is the name as given by [[:cfpython:#object|the Name field]] 
-  * **to**(list):​ name of objects that will be created to replace transformed object. The newly created objects will be made unpickable so they stay on the map. If more than one, a random is chosen for each transformed ​objet.+  * **to**(list):​ name of objects that will be created to replace transformed object. The newly created objects will be made unpickable so they stay on the map. If more than one, a random is chosen for each transformed ​object.
   * **key**: a keyword used to keep track of transformed object when time comes to untransform them. This is used to prevent clash if several transformation script are working on same map   * **key**: a keyword used to keep track of transformed object when time comes to untransform them. This is used to prevent clash if several transformation script are working on same map
cfpython/tod.1359905971.txt.gz · Last modified: 2018/03/30 08:54 (external edit)