[CF-Devel] python plugin trigger bug?
crossfire-devel at archives.real-time.com
crossfire-devel at archives.real-time.com
Thu Dec 9 04:07:24 CST 2004
Todd Mitchell wrote:
>
Ah, the activator is the switch in this case, I thought it should be
>
referencing the player activating the trigger as it is in other
>
events. Whoami is the object itself usually, no?
The comment in the source (located somewhere in the server code, just
before the plugin code is called) says: originator (WhoAmI) is the
object that caused victim (Other) to move onto trap (Activator).
Therefore I'd say Other is the object on the trigger.
I did a quick survey for the events used in the server code (see the
attachment). I'll add this information to doc/Developers/python.
>
My script had whoami to determine the object being activated - whoami
>
is not valid causing a segfault...
I'm currently fixing the plugin code to prevent (or at least reduce)
such crashes. The current plugin code has at least the following
problems:
- It does not always check if a valid object is present and therefore
passes NULL objects to the plugin code. On the other hand, it does
not check objects passed in from the plugin code, using these NULL
objects.
The solution I implemented is: pass the Python-value "None" for
NULL-objects. But your script revealed a problem: I get the
(misleading) error message "TypeError: an integer is required". (But
the server does not crash.)
Is this behavior acceptable or should I pass the integer 0 to the
script for NULL objects and raise a Python exception if such a value
is used by the script?
- The internal stack for WhoAmI (and other values) is not always
completely cleared. Therefore you may get invalid (read "left over")
values if you call (for example) WhoAmI from an event script that
does not set this value.
>
Try this for the script:
[...]
Did that: I got a server crash, too.
-------------- next part --------------
events generated for objects
============================
event activator who other msg result value comment
------- ------ --------- ----- --- -------------------------- -----------------
APPLY op book -- -- -- op reads book
APPLY pl_ob altar -- -- !=0:do not pray at altar
APPLY pl_ob op -- -- !=0:do not apply object aflag=always apply flag
ATTACK hitter hitter op -- --
ATTACK hitter op victim -- (value read but ignored)
ATTACK hitter weapon op -- --
CLOSE pl_ob container -- -- !=0:do not close container
DEATH -- pl_ob -- -- !=0:pl_ob should not die
DEATH hitter op -- -- !=0:do not kill object atype=attacktype
DROP who op -- -- !=0:do not drop object op is already removed
PICKUP never generated
SAY op inv-obj npc txt !=0:do not say inv-obj is an object in npc's inventory
SAY op npc -- txt !=0:do not say
STOP -- op -- -- -- thrown object op is stopped
TELL never generated
THROW op throw_ob -- -- --
TIME -- op -- -- --
TIMER never generated
TIMER op -- -- -- --
TRIGGER pl_ob item -- msg -- pl_ob writes msg into item
TRIGGER teleporter op -- -- !=0:do not move object teleporter/player changer moves op
TRIGGER trap originator victim -- !=0:do not activate trap originator is the object that caused victim
to move onto trap; originator (who) seems
not to be set when leaving the trigger object
global events
==============
event activator who other msg result value comment
-------- --------- ---- ----- -------- ------------ ---------------------------
BORN pl_ob -- -- -- --
CLOCK -- -- -- -- --
GDEATH never generated
GKILL never generated
KICK pl_ob -- -- param --
LOGIN pl_ob pl_ob -- hostname -- activator=who
LOGOUT pl_ob pl_ob -- hostname -- activator=who
MAPENTER pl_ob -- -- -- --
MAPLEAVE pl_ob -- -- -- --
MAPRESET -- -- map-path --
MUZZLE pl_ob -- -- param -- param is the (possibly partial) player name
REMOVE pl_ob -- -- -- -- pl_ob quits the game
SHOUT pl_ob -- -- message --
Notes:
- pl_ob=player object
- the value "--" means that the value is not set in the current code.
- the TRIGGER event for writing messages always skips the "normal" writing code
if a script is present
-------------- 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