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
zema
Wanderer


Joined: 22 Jun 2005
Posts: 79

PostPosted: Mon Dec 24, 2007 1:10 am   

timer
 
Been awhile since i messed with zmuds scripting i made plenty of notes on my old timer script, but i guess it was not enough..My problem is the @wallseconds variable is going into negative values instead of subtracting from the @wallmins variable.

Variables
@wallseconds
@wallmins
@wallhours


Timer
#ALARM {*1}
#ADD wallseconds -1;#IF (@wallseconds >= 60) {#ADD mins -1;#VAR wallseconds 0};#IF (@wallmins >= 60)
{#ADD wallhours -1;#VAR wallmins 0};#IF (@wallhours >= 24) {#VAR wallhours 0}

Triggers that start the timer
The multi-colored barrier leaves you. #T- *1
You form a multi-colored barrier around your body. #T+ *1
_________________
There are 3 things i hate kids, animals, and women with attitudes..

Last edited by zema on Mon Dec 24, 2007 1:43 am; edited 1 time in total
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Mon Dec 24, 2007 1:16 am   
 
You can't disable/enable the timer unless you have name for it.
*1 is just a pattern value such as for a usual trigger (as by essence, alarm actually is like a trigger in the first place).

#alarm "WallAlarm" {*1} {do your stuff}
#T- WallAlarm
#T+ WallAlarm

will work.


Prog
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
zema
Wanderer


Joined: 22 Jun 2005
Posts: 79

PostPosted: Mon Dec 24, 2007 1:46 am   
 
I edited this it's supposed to be -1 for mins hours and seconds, but yea the funny thing is it works fine, it disables itself and enables itself just fine, as i said the @seconds variable goes into a negative value instead of reseting to 59 and decreasing the min variable. I tried your way and it's just acting weird now. Creates a new vairable 04 a uses that to count down instead of the @wallseconds..hmm.
_________________
There are 3 things i hate kids, animals, and women with attitudes..
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Mon Dec 24, 2007 2:47 am   
 
I'm reading your script, and unless I'm mistaken, how does it ever get to a positive? You say to add -1 to @wallseconds, but then you check if @wallseconds is greater than or equal to 60. If you're always subtracting, how are you getting to 60 for @wallseconds?

Shouldn't it be something like:

Code:
 #TRIGGER {You form a multi-colored barrier around your body.} {#VARIABLE wallhours 6;#VARIABLE wallmins 60;#VARIABLE wallseconds 60;#T+ WallAlarm}
#TRIGGER {The multi-colored barrier leaves you.} {#T- WallAlarm}
#ALARM "WallAlarm" {*1} {#ADD wallseconds -1;#IF (@wallseconds <= 0) {#ADD mins -1;#VAR wallseconds 60};#IF (@wallmins <= 0) {#ADD wallhours -1;#VAR wallmins 60};#IF (@wallhours <= 0) {#VAR wallhours 24}}


Untested code, but if you're always subtracting, then this looks closer to your goal.

Heh, stealth edits!


Last edited by iljhar on Mon Dec 24, 2007 3:00 am; edited 3 times in total
Reply with quote
zema
Wanderer


Joined: 22 Jun 2005
Posts: 79

PostPosted: Mon Dec 24, 2007 2:54 am   
 
oh well the timer, is supposed to count down, i think i have something wrong in the script itself i just can't remember how to fix it..
like the variables for the @wall mins starts at 3 and @wallseconds starts at 4 so the timer goes from 3:04 to 3, 2 ,1,0, then -1,-2,-3,-4 ect i want it to go from 3:04 down. to zero at zero the timer shuts off. I hope this explains this better.
_________________
There are 3 things i hate kids, animals, and women with attitudes..
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Dec 24, 2007 2:57 am   
 
Simple logic problem:
#ALARM {*1}
#ADD wallseconds -1;#IF (@wallseconds <1) {#ADD mins -1;#VAR wallseconds 60};#IF (@wallmins < 1)
{#ADD wallhours -1;#VAR wallmins 60};#IF (@wallhours < 1) {#VAR wallhours 24}

Yes, "#Tą *1" will work at least until you have another alarm that has the same pattern. Using the ID is a better long term solution, but is not required.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
zema
Wanderer


Joined: 22 Jun 2005
Posts: 79

PostPosted: Mon Dec 24, 2007 3:45 am   Thanks
 
Works, thanks very much. I know it was just a basic math issue i should have just redid the script altogether now that i think about it..
_________________
There are 3 things i hate kids, animals, and women with attitudes..
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