[CF-Devel] python plugin trigger bug?

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Sat Dec 11 02:17:02 CST 2004


Todd Mitchell wrote:
>
     
      I did look at the trigger event hooks for that case you mention and
     
     >
     
      actually thought that it was wrong. I would rather see whoami return
     
     >
     
      the object that contains the trigger script and the activator return
     
     >
     
      the object that caused it to fire.
     
     
I would like it that way, too. But there are some more events for that
WhoAmI() does not return the object that contains the script. I attached
an updated version of the event table: now the objects that contain the
script are written in capitals.

To make WhoAmI/Activator return the "right" object, I'd suggest the
following changes:

 - event attack, line "'hitter' hits 'op'": set WhoAmI=OP.

   This would give:
    - WhoAmI=object that contains the script
    - Activator=hitter
    - Other=object being hit

 - event timer: set Activator=none, WhoAmI=OP

 - event trigger:
    - line "'op' writes 'msg' into 'item'": set Activator=op, WhoAmI=OP,
      Other=item
    - line "'teleporter' moves 'op'": set Activator=none,
      WhoAmI=TELEPORTER, Other=op
    - line "'originator' causes 'victim' to trigger 'trap'":
      Activator=victim, WhoAmI=TRAP, Other=originator

   This would give:
    - WhoAmI=object that contains the script
    - Activator=object that writes the book/causes the "trap" to trigger
    - Other=auxiliary object (book written into/object being
      teleported/originator pushing victim into trap)


>
     
      I don't know how possible it is but it should be doable since it
     
     >
     
      passes the info to the plugin so all adjustments would be in the
     
     >
     
      plugin, no?
     
     
I don't think that it would be very hard to change the code: the events
in different lines in the event table are generated in different places
in the code. Therefore we can adjust them independently.

Note that I think we should change the server code, not the plugin code:
the server code fills a CFParm structure and passes it to the plugin
code. This structure basically says which objects should be
Activator/WhoAmI/Other. Therefore it would be easy to adjust it in the
server code but (very) hard to do it in the plugin code because the
plugin code can't distinguish between (for example) the there different
kinds of trigger events.
-------------- next part --------------
What parameters are available to a script?
------------------------------------------

The object that contains the event script in written in capitals.

event Activator WhoAmI Other Message parm1 parm2 parm3 result comment
----- --------- ------ ----- ------- ----- ----- ----- ------ --------------
apply   op     ALTAR     -      -    0     0     0     yes    'op' prays at 'altar'
apply   op     BOOK      -      -    0     0     0     no     'op' reads 'book'
apply   op     ITEM      -      -    aflag 0     0     yes    'op' applies 'item'
attack  hitter hitter    OP     -    0     dam   wc    no     'hitter' hits 'op'
attack  hitter ITEM      op     -    0     dam   wc    no     'hitter' hits 'op' with 'item'
close   op     CONTAINER -      -    0     0     0     yes    'op' closes 'container'
death   -      PLAYER    -      -    0     0     0     yes    'player' dies
death   hitter OP        -      -    atype 0     0     yes    'hitter' kills 'op'
drop    op     ITEM      -      -    nrof  0     0     yes    'op' drops 'item'
pickup                                                        (not yet implemented)
say     op     ITEM      npc    msg  0     0     0     always 'op' tells 'msg' to 'item' in 'npc''s inventory
say     op     NPC       -      msg  0     0     0     always 'op' tells 'msg' to 'npc'
stop    -      OP        -      -    0     0     0     no     thrown object 'op' is stopped
throw   op     ITEM      -      -    0     0     0     no     'op' throws 'item'
time    -      OP        -      -    0     0     0     no     'op' takes a turn
timer   OP     -         -      -    0     0     0     no     timer of 'op' has expired
trigger OP     item      -      msg  0     0     0     always 'op' writes 'msg' into 'item'
trigger TELEPORTER op    -      -    0     0     0     yes    'teleporter' moves 'op'
trigger TRAP  originator victim -    0     0     0     yes    'originator' causes 'victim' to trigger 'trap'

Notes:
- result column: no=result value is unused; prevent=non-zero result value prevents
  the action; always=prevents the action regardless of result value
- apply event: aflag=always apply flag
- death event: atype=attacktype
- trigger event: originator is unset if the trap (pedestal/button) is left
- parm1..3 are not currently available to the script
- attack event: 'item' can be a weapon or a missile
-------------- next part --------------
_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list