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
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Mon Jul 12, 2004 5:12 pm   

pulse timer question
 

I am trying to make a timer that times when get a mana pulse untill the next pulse. This is for a simu game. The mana pulses come around every 2 minutes but have a 30 secnd variation in order to hinder mechanical abuse.

@mana is a game defined variable that i use to keep track of current mana

does the below look correct?


#CLASS {pulsetimer}
#ALARM "pulsetimer" {*1} {#IF (@pulsetimer >= 1) {#ADD pulsetimer +1}}
#ALARM "manacounter" {*1} {#VAR manacounter {%additem(%item @mana), @lastmana)};#if (@lastmana 2 > @lastmana 1) {pulsetime = 1};#DELN lastmana 1}
#class 0


cheers Naz
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Jul 12, 2004 7:01 pm   
 
No, it doesn't look correct. %additem should have two arguments but you only have one. %item should be followed by two arguments but you don't have any. (@lastmana 2 > @lastmana 1) will parse as ((@lastmana) (2 > @lastmana) (1)), which will always be true and can't be what you want. You don't make any use of @manacounter, but it appears it might have been intended to be @lastmana. You never reduce the value of @pulsetimer.

The tick timer would probably be more accurate unless you are using it for something else.
#TS 120
#ALARM manapulse {*1} {#IF (@mana > @lastmana) {#TZ};#VAR lastmana @mana}
Putting this in a trigger which gets the value of @mana would be better than using #ALARM.

If the ticktimer is in use:
#ALARM manapulse {*1} {#IF (@mana > @lastmana) {#VAR pulsetime @pulsetimer;#VAR pulsetimer 1} {#ADD pulsetimer 1};#VAR lastmana @mana}
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Tue Jul 13, 2004 7:18 pm   
 
thanks lightbulb , the one using the tick timer stalled when the period was longer than 120, but the other version was more suited anyway as i can use a button display next to my other alarms so everything is close with a glance.

i was trying to make a var with 2 values , compare values then delete and replace, using different vars is much better.


thanks Naz
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