|
crycry Apprentice
Joined: 24 Jun 2006 Posts: 169 Location: UK - South Coast
|
Posted: Mon Dec 04, 2006 2:57 pm
alarms. non bug thread |
Hey peoples, need to pick your brain if i may.
Im trying to setup an event that dumps the remaining time of an alarm into a variable, and then onconnect, resets the alarm to the remaining time (as restarting the client resets the alarm to its origional triggered time).
this is what i have so far:
Code: |
onDisconnect event
#var rawTimeRemaining %alarm( lottery) |
Code: |
onConnect event
#NOOP %alarm( lottery, @rawTimeRemaining) |
but its not working at all.. im wondering if im not understanding the workings properly. Any ideas anyone? |
|
_________________ 'Life is what happens, when your too busy doing something else'
_________________
XP Pro SP2
cMud 1.24
_________________ |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Dec 04, 2006 4:03 pm |
You mean it's not working at all as in the %alarm function isn't doing anything?
I did this to test:
#alarm "lottery" +10 {#echo Alarm is out};#alarm +5 {#echo %alarm(lottery)}
and the echo gave back 5 seconds properly.
Then I tried this:
#alarm "lottery" +10 {#echo Alarm is out};#event OnDisconnect {#var TimeRemaining %alarm(lottery);#echo @TimeRemaining};#alarm +5 {#echo %alarm(lottery);#disconnect}
but I'm getting List index errors that stop me from trying it. Is this working? One other thing I'd consider is
#alarm "lottery" +10 {#echo Alarm is out};#event OnDisconnect {#var {TimeRemaining} {%alarm(lottery)};#echo @TimeRemaining};#alarm +5 {#echo %alarm(lottery);#disconnect} |
|
|
|
crycry Apprentice
Joined: 24 Jun 2006 Posts: 169 Location: UK - South Coast
|
Posted: Mon Dec 04, 2006 4:23 pm |
Im finding it hard to track down where its getting to, I tried echoing the contents of rawTimeRemaining at logout, to see if it had fed the right number to the variable, it just contained -1, so Im thinking maybe thats the issue.. when i do it via command line, eg. not in the event, it works fine.
|
|
_________________ 'Life is what happens, when your too busy doing something else'
_________________
XP Pro SP2
cMud 1.24
_________________ |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Dec 04, 2006 7:10 pm |
The following worked just fine for me:
#alarm "lottery" 10 {#echo Alarm is out}
#event OnDisconnect {#var TimeRemaining %alarm(lottery)}
#event OnConnect {#noop %alarm(lottery,@TimeRemaining)}
If your alarm is +nn you need to beware that it'll delete itself once it's gone off once, so you'll need to recreate it in OnConnect. Also, your alarm will continue to run if you are offline but still have CMUD open, which might possibly cause problems. But it works for me. The way I tested it was by creating an alarm +5 at the same time I created the lottery alarm that told me what the current time left on the alarm was and then did #disconnect. Worked fine. |
|
|
|
crycry Apprentice
Joined: 24 Jun 2006 Posts: 169 Location: UK - South Coast
|
Posted: Mon Dec 04, 2006 7:47 pm |
okies, tracked down the problem..
it didnt like the alarm being in a different package, it didnt seem to want to pull the data out of it.
ive moved it to the same package now (sloppy leftovers from my class moving yesterday) and it works fine :) i guess thats a bug |
|
_________________ 'Life is what happens, when your too busy doing something else'
_________________
XP Pro SP2
cMud 1.24
_________________ |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Dec 04, 2006 7:57 pm |
You're sure the Alarm was visible to the event that was trying to pull the value?
|
|
|
|
crycry Apprentice
Joined: 24 Jun 2006 Posts: 169 Location: UK - South Coast
|
Posted: Mon Dec 04, 2006 8:00 pm |
yup, both packages were available to eachother.
edit: i thought for a minute that the alarm hadnt created, but it had. so odd.. it has me all confused now.
the other thing ive noticed, is that sometimes it shows with the trigger icon next to it in the folder list, and sometimes it shows as an alarm. |
|
_________________ 'Life is what happens, when your too busy doing something else'
_________________
XP Pro SP2
cMud 1.24
_________________ |
|
|
|
crycry Apprentice
Joined: 24 Jun 2006 Posts: 169 Location: UK - South Coast
|
Posted: Mon Dec 04, 2006 11:36 pm |
i think i had a corrupted package file, so i restored a backup from yesterday.. works ok now.
it had also duplicated the module for my capture window, which was crazy.. which is what led me to change it. sorry for confusing the hell out of everyone, but thanks for hte points, learned alot today. |
|
_________________ 'Life is what happens, when your too busy doing something else'
_________________
XP Pro SP2
cMud 1.24
_________________ |
|
|
|
|
|