[CF-Devel] Some Python things

crossfire-devel-admin at archives.real-time.com crossfire-devel-admin at archives.real-time.com
Wed Oct 15 04:50:03 CDT 2003


Le Samedi 11 Octobre 2003 15:52, Todd Mitchell a écrit :
>
     
      On Sat, 2003-10-11 at 07:24, Andreas Vogl wrote:
     
     >
     
      > Todd Mitchell wrote:
     
     >
     
      > > [...]
     
     >
     
      > >
     
     >
     
      > Event options are currently not supported because I really had no idea
     
     >
     
      > about it. In the docs ("doc/Developers/pyhton", "doc/Developers/plugins")
     
     >
     
      > event options don't seem to be mentioned, or did I overlook it?
     
     >
     
      >
     
     >
     
      > Currently, the CFJavaEditor would insert the following for a say event
     
     >
     
      > script attached to a map-object:
     
     >
     
      >
     
     >
     
      >    event_say_plugin Python
     
     >
     
      >    event_say WhateverScript.py
     
     >
     
      >
     
     >
     
      > How do event options come into play with this?
     
     >
     
     
     
My bad... I forgot to speak about this. Mea Culpa !

To summarize quickly: event_option is a free string content that was supposed 
to be used by a plugin to set various options (who guessed that ? :)). For 
example, a plugin managing a dialog IA could use event_options to know which 
personality to use (event_options angry, event_options old man, etc.).

CFPython itself doesn't use the event_options. But Python scripts can use it 
as a way to store a string. The functions used for that are:

CFPython.GetEventOptions(who, eventid) : reads the value of the event_options 
field in the object 'who'; the event is specified as its internal integer 
value (the #define EVENT_bla in plugin.h).

CFPython.SetEventOptions(who, eventid, val) : Sets the event_option value of 
object 'who' to 'val'. 

>
     
      Well currently the event options are not working properly as far as I
     
     >
     
      know 
     
     
Correction made in the CVS. Seems that there were Cut&Paste errors in the 
plugin and in the loader code.

>
     
      but from looking at the code for the IPO buliten board and the
     
     >
     
      plugin code you can associate a option (a string I presume) with a
     
     >
     
      script by adding somehting like this:
     
     >
     
     
     >
     
      arch sign
     
     >
     
      name Scorn Message Board
     
     >
     
      event_say_plugin Python
     
     >
     
      event_say /python/IPO/board.py
     
     >
     
      event_say_options ScornBOARD
     
     >
     
     
     >
     
      the board.py script can then use the CFPython.GetOptions(who, event)
     
     >
     
      where who is the object calling the script and event is the type of
     
     >
     
      event, like say (event 6) or apply (event 1?).  This lets you pass a
     
     >
     
      string to the script (one script per event per object allowed) and makes
     
     >
     
      things a lot more reusable by letting you set up different states for
     
     >
     
      the scripts based on the options (like a message board name or insult
     
     >
     
      style.  Yann can hopefully correct me if I am wrong here.
     
     
Sounds mostly correct. the function name is GetEventOptions, and apply is 
indeed event nr. 1.

>
     
      Anyway currently the java editor is reporting the event_say_options
     
     >
     
      field as a new script. Proir to the scripting support you could just
     
     >
     
      edit the text manually in the text window, but now the editor parses
     
     >
     
      these lines so you have to add the options manually to the map file.
     
     >
     
      I think it would be good to have a options field where you can enter
     
     >
     
      this string when you link a script to an object in the editor.  I have
     
     >
     
      seen also the line 'event_say_options_plugin X' but don't know where
     
     >
     
      that fits in with all this and am assuming it is a mistake... (?)
     
     
event_say_options_plugin X is indeed a mistake. Format of event line is always 
the same:

	event_xxx : the event content itself;
	event_xxx_plugin : the plugin used to handle the event;
	event_xxx_options : the options field.

Hope this helps (sorry for the delay - I didn't check the mailing list a lot 
recently)
-- 
Yann Chachkoff
-----------------------
Garden Dwarf's Best Friend
-----------------------
GPG Key    : 
     
     http://pgp.dtype.org:11371/pks/lookup?op=get&search=0x844D25E0
     
     
Fingerprint: 6616 2E02 BAD2 4AEF C90A  F1EB 7E03 AAB9 844D 25E0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url : 
     
     http://shadowknight.real-time.com/pipermail/crossfire/attachments/20031015/61a719ea/attachment.pgp
     
     
    


More information about the crossfire mailing list