 |
adamwalker Apprentice
Joined: 12 Mar 2005 Posts: 195
|
Posted: 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 |
|
|
 |
TonDiening GURU

Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: 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 |
|
|
 |
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Fri Mar 24, 2006 3:01 pm |
I think people are having a fondess for the @ symbol ;@)
|
|
_________________ Taz :) |
|
|
 |
|
|