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
Belmyrddyn
Magician


Joined: 17 Oct 2001
Posts: 371
Location: USA

PostPosted: Fri May 03, 2002 1:20 am   

Alarm Every Second
 
Okay, I want an alarm to execute every second, or at least every second for a certain number of seconds.

Okay, so I get a Roundtime of say 8 seconds... Now I've got 2 variables: @RT and @RTBuffer. When I get the Roundtime line, I have the variables set to
[b]#VAR RT -8
#VAR RTBuffer -8

Now, every second I want to add 1 to each of these variables, until RT = 0, but then I want it to continue adding to RTBuffer until it reaches 2. Now, when I set up an alarm that executes each second with if statements checking to see if they need to add to either alarms, I get a error, which I'm assuming is a memory leak. I assumed that would be a problem with this sort of thing. Any suggestions? Using the tick timer is hard due to the complexity of this execution. Is there a way to cut the alarm off and on when needed?

Btw, this is for the game Dragonrealms, so any other DR players who do this, I'd appreciate you telling me how you resolved this problem.

Belmyrddyn
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri May 03, 2002 1:33 am   
 
#ALARM *1 {#IF (@RT < 0) {#ADD RT 1};#IF (@RTBuffer < 2) {#ADD RTBuffer 1}}

LightBulb
Vague questions get vague answers
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Fri May 03, 2002 1:33 am   
 
Edited:(and Lightbulb beats me by 40 Sec, plus the browser won't let me kill my post. *sigh*)
Reply with quote
Belmyrddyn
Magician


Joined: 17 Oct 2001
Posts: 371
Location: USA

PostPosted: Fri May 03, 2002 9:16 pm   
 
Your sure that isn't gonna cause a memory leak or something? I'm running the latest beta version, btw.

Belmyrddyn
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat May 04, 2002 1:15 am   
 
No, I'm not sure. If you want an alarm that's going to fire every second, you need to expect that it's going to consume resources. You might consider moving it to a separate class, where you can disable it when it's not in use.

LightBulb
Vague questions get vague answers
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