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
DanaLea
Beginner


Joined: 31 Jul 2002
Posts: 19
Location: USA

PostPosted: Thu Jul 24, 2003 3:17 pm   

Clocks and Counters
 
Hello and good morning!

there are 2 things I would like to do and I need some help on the code.

First.
I have a couple of triggers set to go off when I level. And I have a variable called mylevel which holds my current level. I would like this to increment automaticly. Currently its set to #add @mylevel @levelup where levelup is = 1, but that doesn't work. How does it need to be set up?

Second.
I'd like to set up a timer or clock. It would start on a trigger, and on a different trigger it would end and display the elsaped time. Also, can you have more then one clock going? one for level, another for quest, and one for campaign, for example?

I hope these are simple to do.

thanks in advance,

Dana
Reply with quote
RobMacAF
Apprentice


Joined: 09 Jun 2002
Posts: 186
Location: USA

PostPosted: Thu Jul 24, 2003 4:56 pm   
 
The first part I can answer pretty easily. Instead of #ADD with #MATH command.

The #MATH command will do any math calculations, on numbers, variables, etc, and store it in a variable. The wording of it is:
#MATH variable equation

So in your case it would be:

#MATH mylevel @mylevel+1

That will add one to the variable MyLevel and store it as mylevel. I noticed that you have @LevelUp. If you would like to use that instead make it

#Math mylevel @mylevel+@levelup

This will add the variable levelup to mylevel and store it as mylevel.


Hope this helps. There might also be other ways to add and such but personally I always use #MATH for any calculations
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jul 24, 2003 6:00 pm   
 
First. The correct syntax for #ADD is #ADD varname amount. You have #ADD @varname amount.
#ADD mylevel @levelup
Also, you could just use 1 instead of @levelup.
#MATH, as per Rob, will work but isn't necessary.

Second. Timers are easy, you just make zMUD do what you would do -- look at the clock to see what time you started, then look at the clock again to see what time you finished and figure out the difference. Counters can be done by using an #ALARM to check the time without changing the start time.
#TR {a trigger} {#VAR clock1 %secs}
#TR {a different trigger} {#MATH timer1 ((%secs - @clock1)/1000);#IF (@timer1 < 0) {#ADD timer1 86400}}
#ALA *5 {#MATH timer2 ((%secs - @clock1)/1000);#IF (@timer2 < 0) {#ADD timer2 86400};#SAY Elapsed time: @timer2}
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