rujuro on 25/10/2005 at 13:26
I'm having an issue with some of my scripts where they're firing when they shouldn't be. I have a couple of inventory items with scripts on them that go like this:
CONDITIONS:
When I am used in any way from the inventory
ACTIONS:
Send trigger messsage blahblah
reset script conditions and actions
I then have other items in the game world which listen for the message and check to see if a certain condition is met (in one case it's a flag, in another case it's a proximity check) before executing.
CONDITIONS:
Received trigger message blahblah
Query if FLAG equals TRUE
ACTIONS:
Set property etc...
Reset script conditions and actions
The problem is that these scripts are meant to run multiple times, and after the first time I run them, any time any trigger message is sent by another script and the other conditions are met, the second script fires. The first script on the object still works, but the object that listens for the trigger message seems to be responding to ANY message, not just the one I told it to listen for. Again this only happens after the trigger message it is supposed to listen for has been sent at least once. Anyone have any ideas, is there something simple here?
Dark Arrow on 25/10/2005 at 14:31
Could this be the problem:
Received trigger message blahblah
I don't know what that condition actually means to the editor, but I could imagine that it checks for an incoming message. When it receives it it marks it as received and the script considers every trigger message after that to be the correct one (ie. it doesn't really check if it is the correct one).
Of course I could be totally wrong here, the problme might not be in the condition and the condition works perfectly.
ascottk on 25/10/2005 at 14:53
Quote Posted by rujuro
CONDITIONS:
When I am used in any way from the inventory
ACTIONS:
Send trigger messsage blahblah
reset script conditions and actions
I then have other items in the game world which listen for the message and check to see if a certain condition is met (in one case it's a flag, in another case it's a proximity check) before executing.
CONDITIONS:
Received trigger message blahblah
Query if FLAG equals TRUEACTIONS:
Set property etc...
Reset script conditions and actions
Do you have a script that toggles the FLAG property? If you don't then the flag will always be true or false. If the flag is always false then the script doesn't fire & you end up with a redundant script.
rujuro on 25/10/2005 at 15:06
Dark Arrow, those were the exact lines I was thinking along, but I also thought that reset conditions and actions should set it back to it's initial state of not having received the message. I'm wondering if there's something weird about trigger messages sent from the inventory (although I can't see what it would be). I may try a different method where it waits for a FLAG to change to trigger instead of the message and see if the problem persists. I'd really like to know what's going on though, since many of my scripts rely on trigger messages. Krypt? You really seem to know the most about scripting, am I missing something?
ascott, I do have actions that set the flags, that part seems to be functioning perfectly.
Krypt on 25/10/2005 at 17:35
So you're using multiple trigger messages with unique names and when other ones fire it activates the "blahblah" one? Or are you sending a trigger message with the same name from different scripts? If it is the same name then both scripts will fire if their other conditions are true. You probably already know that, but just making sure. If it triggers when a differently-named message is sent them you've got me. Trigger messages always just worked for me with no overlap.
I think the answer to this problem may lie in the queries you're pairing with the trigger message checks. What causes that flag to be set to true? Are you sure it has the value you think it should have at the right times? Make sure you have scripts that check the current value at the times you wish to change it and then set the value appropriately. Also use the "debugflags" console command to check your flag values at any time in-game. You can filter the output, so if your flag were named "Blahflag" you could just type "debugflags blah" and it will show you the value.
rujuro on 25/10/2005 at 18:01
Thanks Krypt, and yes, they are all unique names. The flags all work fine, since the scripts all fire when they're supposed to. The problem being that they get set off when other trigger messages are sent (as if they received the required message) the flag conditions are just "Query ifs", so they couldn't start the script on their own (could they?).
When I look at my trigger.log, the strange thing I see is that the script on the inventory item is continually being reset (without the script firing), with different instance numbers on the item next to each event. I think that's because it respawns it everytime I cycle, but still seems strange. Also in the log, I see scripts firing that cause other events, then oddly, the another (one of those triggered by inventory) script fires, without the script that is supposed to trigger it firing.
ascottk on 25/10/2005 at 18:59
Are the objects linked somehow?
rujuro on 25/10/2005 at 21:03
Nope, other than being objects in the inventory. I also set inherit scripts to false, just in case, didn't seem to matter.
EDIT:Also, if I were to delete my T3 edit directory, is there any way to preserve my scripts? I'm worried my Editor install got corrupted somehow and this weirdness is a result.
Krypt on 25/10/2005 at 23:44
If it's firing a bunch of times I think you may want to add something to prevent it from firing constantly. I'm not sure what would be appropriate for this situation since you didn't really give any details on the intended function of these scripts, but I can throw out a few ideas I guess.
If it would be ok to have a delay between script fires then I'd suggest putting a delay in before the "reset conditions and actions" action. Maybe 10 seconds, or whatever is appropriate. You could also do a similar thing by setting a flag that tracks whether the script should be able to fire again, query if it's true in the conditions then set it to false in the actions. Then use another script to set the flag back to true whenever you want your scripts to be able to fire again.
rujuro on 26/10/2005 at 00:18
Well, I tried the delay, and it still happens. Basically all my inventory based trigger messages seem to get sent whenever ANY trigger message is sent. To be more specific about the scripts in question:
I have an inventory object that the player carries around. When they use it, there is an object in the world that becomes visible based on a trigger message(if it isn't already, that's the flag check) and sets the flag to indicate that it is now visible. When the object is used again, it is made invisible, and the flag is then set to reflect this. There are slight delays before the flags are set, because I found that it caused a problem otherwise (scripts tried to both run since the flag was set so quickly).
There is another script on a door, when the door closes, it sends a trigger message that turns on a light. If I have already made the invisible object visible and back to invisible, when the door closes, it makes the object visible (and turns on the intended light), even though the trigger messages are totally different. I'm worried that my game install is somehow broken, but I don't see how it would act like this.