Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Malach
Apprentice


Joined: 03 Nov 2007
Posts: 132

PostPosted: Tue Nov 06, 2007 2:16 pm   

[2.10] Expression Trigger Still Firing When Disabled
 
Have the following code and no other settings created by me at all:

#TRIGGER "TestExpression" (@TestList) {#say testexpression firing;#T+ TestAlarm;#T- TestExpression}

(Note: you will have to manually set this to expression in the settings editor)

#ALARM "TestAlarm" *1 {#IF (@TestList) {#say testalarm firing} {#T+ TestExpression;#T- TestAlarm}

Then on the command line I just do #ADDITEM TestList item1, #DELITEM TestList item1. The alarm enables and disables properly but the expression trigger keeps firing anytime the variable changes regardless of whether it's disabled or not.


Last edited by Malach on Tue Nov 06, 2007 6:22 pm; edited 1 time in total
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Nov 06, 2007 2:40 pm   
 
While I doubt this part of the problem, it seems strange to use a numerical comparison on a variable that contains a table of strings, no?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Malach
Apprentice


Joined: 03 Nov 2007
Posts: 132

PostPosted: Tue Nov 06, 2007 3:31 pm   
 
Yes but I could just use @TestList or %numitems(@TestList) > 0 and it would be the same result. This was just testing so I used the first "evaluate to true if the string list is not empty" expression that came to mind.
_________________
Intel Core2 Quad CPU @ 2.4 GHZ with Windows Vista Home Premium and 2 GB Ram
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Nov 06, 2007 6:18 pm   
 
Fang is correct though. Using (@TestList > 0) isn't a correct expression because you are comparing a string(list) with a number.

The correct way to do this is just using (@TestList). This will return true if the list has a value, or false if it is null. You can also use (%null(@TestList)) to do the same thing. But do not use > 0 ... that is only defined for numeric values.
Reply with quote
Malach
Apprentice


Joined: 03 Nov 2007
Posts: 132

PostPosted: Tue Nov 06, 2007 6:20 pm   
 
Right, I don't do that for when I'm actually scripting. I could change the test parameters if necessary to change the focus off of the expression being used but the result will be the same. I tested with @TestList and %numitems(@TestList). I can try with %null(@TestList) too (didn't know about that one!) but I imagine the result will be the same.

The expression triggers are still firing when they are disabled.

EDIT: I tested using %null(@TestList) as the expression in the original test case and the expression trigger still fired while disabled whenever TestList changed value.

And as an add on, not only they firing whenever the variable changes while disabled, they are firing regardless of whether the expression is actually true any longer any time the variable changes
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Nov 06, 2007 8:43 pm   
 
OK, yep I see the problem. The expression trigger is looking at the child trigger record instead of the main trigger record (which are stored differently in memory) for the enabled flag. I have this fixed for 2.11.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net