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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Greendale
Beginner


Joined: 19 Mar 2004
Posts: 17
Location: Sweden

PostPosted: Sat Apr 10, 2004 11:37 am   

I manage to break a trigger
 
I have a trigger for my prompt, and every now and then it just breaks down and stops firing. It doesn't happen often and can work for 10,000 times in a row before it happens.

The code for the trigger is intricate and I have no doubt that I'm doing something wrong. But still, I think what happens is rather strange. And I have no idea how to debug this.

The trigger just stops firing. I can disable/enable it or the class it is in, no difference. If I look at %trigger(fooTrigger) it shows 1, and %state(fooTrigger) is 0. I can even change the pattern and the value (commands) to whatever but it just refuses to fire. On the other hand, if I use the settings editor to copy and paste the entire trigger, the copy will work just fine!

The only way I've found to get the original trigger to work again is to restart zMUD.

Help?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Apr 10, 2004 12:27 pm   
 
That's strange. Try posting the trigger to see if we find anything.
Reply with quote
Greendale
Beginner


Joined: 19 Mar 2004
Posts: 17
Location: Sweden

PostPosted: Sat Apr 10, 2004 1:36 pm   
 
I don't think that would help any. I have this intricate curing system that ties in to this and depending on certain conditions I will call different aliases from the trigger. I would have to post at least a hundred lines of code, and it would probably still be hard to get the full picture.

As I said, I have no doubt that somewhere I'm doing something that zMUD doesn't like. But how do I go about to find what that is? And what could cause a trigger to stop firing, besides it being disabled?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat Apr 10, 2004 5:14 pm   
 
*ponders even attempting this*

If a trigger doesn't match a pattern it won't fire so more than likely something small is getting changed in the prompt you are recieving and your not capturing it correctly. Your best bet would be to post the prompt trigger and ALSO your mud output at the time that it is not working.
Reply with quote
Greendale
Beginner


Joined: 19 Mar 2004
Posts: 17
Location: Sweden

PostPosted: Sat Apr 10, 2004 8:15 pm   
 
1. Nothing changes in the prompt.
2. If I make an exact copy of the trigger, it works, so nothing can be wrong with the pattern itself.
3. When it breaks down I can use the settings editor to change the pattern of the trigger to something simple like {Foo} and say Foo and it will still not fire.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Apr 11, 2004 1:35 pm   
 
Since you refuse to post the trigger (ther is no need to post the other aliases - if something else was needed, we would ask for it), the only thing I can tell you is to wait until it no longer works and then try using the #SH command to see if you can make the trigger fire and anything else that you think would be a good way to test it. Then, make it work again and test the exact same procedure you did before. Compare the results.

Also, general guidelines for debugging something dictate that you should isolate the various parts of the code and make sure that they work by themselved. Then, you begin putting them together and see if it breaks at some point. You could try this approach too.

Finally, you can turn on the option to Show Triggers in the Preferences under Script Parser and see if the trigger is in fact firing or not.
Reply with quote
Greendale
Beginner


Joined: 19 Mar 2004
Posts: 17
Location: Sweden

PostPosted: Sun Apr 11, 2004 6:46 pm   
 
OK, here it is:

#REGEX "promptTrigger" {^H:(d+) M:(d+) [(.*)]} {#TAG prompt;#VARIABLE promptStatus {%3} _nodef status;#IF (@isProne) {doProne};#IF (@autoHeal) {#IF (@cure=1) {doCure};autoHeal}} "status|prompt" {nocr|prompt|notrig}

When it's broken, I cannot make it fire with #SH and I've tested with Show Triggers and nothing shows. I've also tried putting a #BREAK in it and running the debugger. It just doesn't fire.

The problem with debugging in this case is that it can work for tens of thousands of times before it breaks down. So it's very hard to test the individual parts.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Apr 11, 2004 11:51 pm   
 
Perhaps it's a bug with regex triggers (although normal triggers are converted to regex behind the scenes). Try a normal trigger like:
#TRIGGER "promptTrigger" {^H:(%d) M:(%d) ~[(*)~]} {...}

see if that breaks too after a while.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion 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