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
adamwalker
Apprentice


Joined: 12 Mar 2005
Posts: 195

PostPosted: Thu Mar 23, 2006 3:54 pm   

Q : Clearing variable entries according to time entered?
 
Currently my curing system works by a variable storing the affliction. another variable storing if a cure has been attempted (so it isnt attempted twice per cycle, eg herb and potion). then the variable is cleared every 6 seconds so they may be attempted again.. eg

Code:
#if (@clearvar = 1) {
  @clearvar = 0
  #var tryafflictions {}
  #alarm +6 {clearvar = 1}
  }


What I need is to change it so that not all the entries in the variablelist @tryafflictions are removed at once. i want the entry cleared 6 secconds after it is entered. so 5 entries could be entered 1 seccond apart.. and they then get deleted 1 seccond apart. not all together as it is currently coded.

one way i thought of doing it was from the name of the affliction to reflect the time...

eg

the alias that adds them is called ADDAFF

#addi myafflictions %time(ns)%1

so then the code to clear the var would do a delete item if the item was added more then 6 secconds ago..

thats the ony idea i could come up with and im yet to get it to work.

anyone have any better/different ideas?

Thanks
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Mar 24, 2006 2:15 pm   
 
You could look into %pop %push ideas.

The other idea is to spin off a temporary alarm that will fire in 6 sections and %delitem the cure attempt.

--

Am I just overly confused today or is this statement wrong:
@clearvar = 0
#var @clearvar 0

And should be:
clearvar = 0
#var clearvar 0
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Fri Mar 24, 2006 3:01 pm   
 
I think people are having a fondess for the @ symbol ;@)
_________________
Taz :)
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