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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Nemireck
Beginner


Joined: 15 Feb 2009
Posts: 10

PostPosted: Sat Feb 20, 2021 12:06 am   

#ALARMS firing off without waiting
 
Any time I place an alarm within an alarm, it's causing this issue, firing off some commands immediately instead of waiting. It will work on my initial few tests, but then invariably at some point, the alarm stops working and commands start firing off without pause...

Maybe it's just not designed to work this way, but it made logical sense to me to use an alarm in this way to achieve very basic timed loops without creating counters and everything

Example, I just wanted to go somewhere, repeat the same command 9 times with a 2 second delay between each attempt, and then leave. All without bothering to make a counter. So I tried:

go to the place
#alarm +2 {do the thing
#alarm +2 {do the thing
#alarm +2 {do the thing
#alarm +2 {do the thing
#alarm +2 {do the thing
#alarm +2 {do the thing
#alarm +2 {do the thing
#alarm +2 {do the thing
#alarm +2 {do the thing
leave the place}}}}}}}}}


During my initial testing, it worked perfectly fine. But later on, it started firing off "do the thing" immediately, and then sending it twice, every 2 seconds, instead of one at a time... What's happening here?
Not the biggest deal, I can just pull the stacked alarms out and add 2 seconds to each one, no issues when I do that. It's just not as elegant (understanding, of course that my own method is not elegant either). Is there a way to achieve what I'm trying to do here?

That's just one simple example, I'm having the same issue when I try to stack alarms in my path aliases. Sometimes I need to wait for MUD events to take place before moving along, and don't have trigger messages to work off of, so timers are my best option, but I want to say:

#alarm 2 {leave the place
#alarm 3 {go to the next place}}

And I'm getting the same issues.

I have scoured the help files on this and also searched the forums but I can't find anyone who's brought up a similar issue... Hoping someone can give me some direction or explain if there's a better way to do what I'm attempting here.
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Sat Feb 20, 2021 8:02 am   
 
I can't say that I have used this method but I have used no more then 2-3 alarms at once. I had issues with them over-writing if i didn't give them a unique tag, which may be your issue but not 100%.

#loop would be ideal for your enter room do a thing X times, seeing how you don't want to use a 'counter'
Code:
#loop 9 {do the thing;#WA 2000}


I favor using %pop with a stringlist to systematically perform a list of actions. works for doing things like combat combo attacks ((jab, cross, haymaker, uppercut)) or enter a room and record each mob in said room to a kill_list, %pop(@kill_list) to kill first in list, then on death %pop list again, till the whole list is cleared.

Short of that, my past experiences with #alarm was the issue with non-unique ID and it over-writing an existing alarm, then spam of commands once the alarm fully timed out.
Reply with quote
Nemireck
Beginner


Joined: 15 Feb 2009
Posts: 10

PostPosted: Sat Feb 20, 2021 5:37 pm   
 
chaossdragon wrote:
I can't say that I have used this method but I have used no more then 2-3 alarms at once. I had issues with them over-writing if i didn't give them a unique tag, which may be your issue but not 100%.

#loop would be ideal for your enter room do a thing X times, seeing how you don't want to use a 'counter'
Code:
#loop 9 {do the thing;#WA 2000}


I favor using %pop with a stringlist to systematically perform a list of actions. works for doing things like combat combo attacks ((jab, cross, haymaker, uppercut)) or enter a room and record each mob in said room to a kill_list, %pop(@kill_list) to kill first in list, then on death %pop list again, till the whole list is cleared.

Short of that, my past experiences with #alarm was the issue with non-unique ID and it over-writing an existing alarm, then spam of commands once the alarm fully timed out.


Ah yes #loop may be what I'm looking for, not sure #wait is gonna help me because I actually have a trigger that needs to fire off during that 2 second wait, but I can probably put an alarm in a loop anyway.

Will read up on %pop for my path aliases, and what you're saying sounds great for trying to clean up my farming scripts and make them less "brute force" as well, which would be nice.

Thanks!
Reply with quote
hpoonis2010
Adept


Joined: 18 Jun 2019
Posts: 279

PostPosted: Mon Feb 22, 2021 2:09 pm   
 
You COULD set off an onRoomEnter event that will kick off an alarm/series of alarms. Alarms are a bit messy in this context, as @chaossdragon wrote.

Or a similar event to "do the thing" when you enter a room. You could, one supposes, narrow the action criteria (which rooms/areas) by applying logic to the command.

Eg., #IF ((%zonenmum()=x) AND (%roomnum() is in action_room_list)) {"do the thing"}

For the trigger, prior to starting your 2-second delay, make a #TEMP and give it a name. This is supposed to work in that you only create one TEMP trigger. However, I have had issues with cMUD making permanent, multiple triggers of my #TEMP trigger, with the same pattern (which shouldn't happen, of course).
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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