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
Eric Freeman
Newbie


Joined: 11 May 2003
Posts: 5
Location: USA

PostPosted: Sun May 11, 2003 11:42 pm   

problem with timers
 
I hope i'm posting to the right place :). I used zmud quite awhile ago and at one time i was pretty good at codeing in it. Well I started again with the new version (i dont have the old one anymore), and loaded in my trig set. It seems as thou all my timming trigs arent working at all. Or they are but the numbers they give me are wrong. Basically i'm timming protection spells. For instance..when a message comes up for showing a protection spell has gone up i have
msg {AOG ~[ON~] Last: (@aoglast) secs}
#math aog %time( hhmm)*60-%time( hh)*2400+%time( ss)-1
#var aogtime 1
#bu 3
#TS 400

when it goes down i have

#math current %time( hhmm)*60-%time( hh)*2400+%time( ss)
#math aogtime @current-@aog
#math aoglast @aogtime
msg {Aog ~[OFF~] --> (@aogtime secs)}
#var aogtime off
#bu 3
#TS off

What i'm doing (or trying to do or did at one time) is when the spell goes off..a button changes and counts up current time with a / last time. This way i can see about how long until the spell is going to fall. Now i did a quick fix useing the bottom left timmer, but this isnt a long term solution. I might have 4 or 5 of these spells up at one time. Now i have a general timmer trig..but i think that has really been messed up. It's
#math current %time ( h)*3600 + %time ( n)*60 + %time ( s);#if (@aogtime <> off) {#math pfetime @current-@aog};#if (@graptime <> off) {#math graptime @current-@grap};#if (@invtime <> off) {#math invtime @current-@inv};#if (@srtime <> off) {#math srtime @current-@sr};#if (@iwtime <> off) {#math iwtime @current-@iw};#if (@ehtime <> off) {#math ehtime @current-@eh};#if (@amftime <> off) {#math amftime @current-@amf}

Now i need help..this isnt working and I dont remember anything anymore :)
-Eric
Reply with quote
horks
Apprentice


Joined: 20 Jul 2001
Posts: 127
Location: USA

PostPosted: Mon May 12, 2003 2:24 am   
 
I'm not an expert, but hopefully, I can be of help.

#math current %time ( h)*3600 + %time ( n)*60 + %time ( s)

This looks like it takes the current time, and converts it into seconds right? There is a system var for connect time in seconds, why don't you just use that? (%ctime).


I have many time counter type scripts, and I use %ctime in all of them. i don't understand everything in your script, but I'll try to rewrite it to something that you can use (or atleast look at and make something else that works):

when the spell goes up:
msg {AOG ~[ON~] Last: (@aoglast) secs}
#var aog %ctime
#var aogtime 1
#bu 3
#TS 400

/*
No idea what your #bu or #TS are for, so I didn't change them.
*/

for when it goes down, you can do:
#var current %ctime
#var aogtime %eval(@current-@aog)
#var aoglast @aogtime
msg {Aog ~[OFF~] --> (@aogtime secs)}
#var aogtime off
#bu 3
#TS off

/*
I changed the aogtime command from #math to #var and then used a %eval function. I did this only because I prefer to use #var (since you are actually defining a var, so it looks nicer) :) I believe #math still works though. Feel free to do it however you wish.
*/



Father Horks
The only problem with computer security, is when you think it exists.
Reply with quote
Eric Freeman
Newbie


Joined: 11 May 2003
Posts: 5
Location: USA

PostPosted: Mon May 12, 2003 2:48 am   
 
oki..yea that works :) but afew questions.
Now the trig is working..now i have a button that i'm useing..when the button is on i have
AOG @aogtime/@aoglast
what this does is give me a count up for how long the aog (spell) has been up vs. how long the last one lasted. It gives me a very good idea when the spell will fall. But, useing your trig i'm not really getting a current @aogtime. What i was looking for was a var that was counting up and keepting track of the sec. Does that make any sense?
Also, can i use that format for multiple trigs being timed at the same time ? will the var get confused ? And does that mean i dont need my timming trig to convert sec at all ?
-Eric
Reply with quote
horks
Apprentice


Joined: 20 Jul 2001
Posts: 127
Location: USA

PostPosted: Mon May 12, 2003 3:27 am   
 
ok, In the script that you posted there doesn't seem to be any function that would allow @aogtime to count time as it passes. Can you post that part?

Basically, you need some trigger for when you want it to update @aogtime. For all of my timers, I use my hpbar, since it appears every round.

#TRIGGER {HP:} {#var aogtime %eval(%ctime-@aog)}

This would be the exact time that has past since last (since you are using the %ctime). If you don't have a trigger that you could put something like that in, you'd have to do a #ALARM, that could get messy, so I don't reccommend it, but it'd be something like this.

#ALARM 15 {#var aogtime %eval(%ctime-@aog)}

This would update @aogtime every fifteen seconds. You could change it to be less, but I've had some laggy problems running an alarm so often.

There are probably other ways to do this (probably even more effient). I'd like to see how you advanced @aogtime before, that might help me understand a better way myself :)



Father Horks
The only problem with computer security, is when you think it exists.
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