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
Eyeless
Wanderer


Joined: 02 Dec 2001
Posts: 80
Location: Canada

PostPosted: Tue Jan 27, 2004 12:57 pm   

Some sort of Coding error? (me, zMUD?)
 
for some reason I can get one instance of a similar piece of code to work but this one creates an alarm that fires, then disables itself... as you can guess this eventually means I get lots and lots of it in my triggers and even it eventually shuts down a script I run...

everything here works fine except what I just described... but Ill give you whole line that seems bugged

#if (@countwaiting > 15) {#alarm +%eval( @blah+1) {#EC Finished Waiting}
} {
appraise %item( @appraise, %random( 1, 10))
#add countwaiting 1
}

I usta have {#alarm +%eval( @blah+1) in the false part of the #if, but this was not needed... (but it worked fine) as opposed to the first one...

Any ideas what Im doing wrong?
Reply with quote
Valint
Wanderer


Joined: 12 Nov 2003
Posts: 70
Location: USA

PostPosted: Tue Jan 27, 2004 4:44 pm   
 
Without knowing where these variables come from, or what is triggering the above, it's tough to say.

I'm also not sure of what the problem is. An alarm of the type #ALARM +X {blah} is *supposed* to fire and then delete itself, which your first paragraph indicates is a problem.

If you're seeing lots of these alarms, my guess would be that whatever is calling the above line is doing so multiple times (rather than being disabled while the alarm is running) and that you're therefore seeing multiple alarms.
Reply with quote
Eyeless
Wanderer


Joined: 02 Dec 2001
Posts: 80
Location: Canada

PostPosted: Wed Jan 28, 2004 2:06 am   
 
The #if statement is inside an alias, so it is triggered when I or zmud activates... @blah is just a number selected by mud to count time, @countwaiting is a counting variable that when this alias is run... moves up one each time until reaching 16 when it rests to 1.

That statement only becomes true, and therefore fires, once every min and half (when running.) The alarm actually starts out active, but after it echos Finished Waiting (which triggers something) then the alarm becomes disabled. Normally it should delete itself, but for some reason it is not.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jan 28, 2004 8:05 am   
 
If the alarm is disabled it can't finish running and therefore can't delete itself.

If you really want help, please post the alias which contains the #IF statement, any triggers or other settings which call that alias, the triggers and other settings which control @blah, and the triggers which respond to the #ECHO. If "appraise" is an alias, also post that. Making us guess how your script works, and where it goes wrong, isn't necessary when you can just show it to us.
Reply with quote
Eyeless
Wanderer


Joined: 02 Dec 2001
Posts: 80
Location: Canada

PostPosted: Wed Jan 28, 2004 10:54 am   
 
#alias a1 {#if (@countwaiting < 1) {#var countwaiting 1}
#if (@countwaiting > 15) {#alarm +%eval( @blah+1) {#EC Finished Waiting}
} {appraise %item( @appraise, %random( 1, 10))
#add countwaiting 1
}}

#TR {----------ROUND TIME COMPLETE----------} {a1
#if (@countwaiting > 14) {#temp {Finished Waiting} {
#t+ Powerwalk
#t- Waiting
#var countwaiting 1
}}}

#TR {Roundtime: (%d)} {#co red,bold
#var blah %1
#alarm +@blah {
#ec ----------ROUND TIME COMPLETE----------
}}

Well I gave you this information for possible personal gain, but I was able to solve my problem by deleting the #temp and just creating a new trigger that did what temp did. The temp would have been nice) but its ok that I cant get it to work.

If I had to wager on a guess it was in my use of brackets and the #if/#temp (some conflict there)
Reply with quote
Valint
Wanderer


Joined: 12 Nov 2003
Posts: 70
Location: USA

PostPosted: Wed Jan 28, 2004 3:42 pm   
 
This seems the longest way possible. Is there a reason not to use something like:

#TRIG {Roundtime: (%d)} {#CO red,bold;#VAR blah %1;#ALARM +@blah {a1}}
#AL a1 {#IF (@countwaiting < 1) {#VAR countwaiting 1};#IF (@countwaiting > 15) {#ALARM +%max(%eval(@blah+1),1) {#T+ Powerwalk;#T- Waiting;#VAR countwaiting 1;a1}} {appraise %item(@appraise, %random(1, 10));#ADD countwaiting 1}}

The only non-cosmetic change from the above is to check whether @blah+1 is positive before setting it as an alarm (as I don't know if anything changes the blah variables between the trigger and the alias), as setting alarms on zero or negative variables will either not fire or become repeating alarms.
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