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
snoogans
Novice


Joined: 28 Oct 2001
Posts: 43
Location: USA

PostPosted: Fri Jul 19, 2002 8:51 pm   

alarm triggers
 
okay i have a set of triggers to track the time i have left between quests and display it in the status bar. well trying to anyways. I have an alarm set to this ...

#alarm -15 {#math qtime @qtime-1;#if @qtime=0 {#T- Alarms;#VA mins n/a;#SA You may now quest again}}

ticks in the game are every 15 seconds, so i want to subtract 1 from the variable every 15 seconds, problem is that doesn't go off every 15 seconds, anyone know why?
Reply with quote
snoogans
Novice


Joined: 28 Oct 2001
Posts: 43
Location: USA

PostPosted: Fri Jul 19, 2002 8:53 pm   
 
btw i forgot to mention that is in a class called alarms that gets turned on and off when its tracking time or not
Reply with quote
Maximus
Wanderer


Joined: 21 May 2001
Posts: 59
Location: USA

PostPosted: Fri Jul 19, 2002 9:00 pm   
 
I believe it should be #ALARM *15

-15 only triggers once fifteen seconds after you create it. *15 should trigger every fifteen seconds. Problem is, it won't be tuned to the MUD's timer but rather to your computer's clock, so...it might be a little out of sync with the MUD's tick.

Hope that helps.

-Maximus
Reply with quote
snoogans
Novice


Joined: 28 Oct 2001
Posts: 43
Location: USA

PostPosted: Fri Jul 19, 2002 9:18 pm   
 
i got this from the help files ...
ALARM examples

#ALARM -30:00 {save}

The hour isn’t specified, so it defaults to *. Thus, this trigger saves your game every 30 minutes of connect time.

wouldn't mine do the same thing? the problem isn't that it goes off just once, its going off in intervals greater than 15 seconds, not 15 minutes though
Reply with quote
Maximus
Wanderer


Joined: 21 May 2001
Posts: 59
Location: USA

PostPosted: Fri Jul 19, 2002 9:26 pm   
 
Hmm...you're right, that should work then. What's turning your alarm class on?

-Maximus
Reply with quote
snoogans
Novice


Joined: 28 Oct 2001
Posts: 43
Location: USA

PostPosted: Fri Jul 19, 2002 9:34 pm   
 
#CLASS {alarms}
#ALARM -15 {#MATH qtime @qtime-1;#if @qtime=0 {#T- Alarms;#VA mins n/a;#SA You may now quest again}}
#CLASS 0
#CLASS {Quest}
#TRIGGER {You have (%d) minutes remaining %w you can quest again.} {#T+ alarms;#va qtime %1}
#TRIGGER {You may now quest again.} {#T- Alarms;#VA qtime n/a;q request}
#TRIGGER {You have (%d) minutes remaining to complete this quest.} {#T+ alarms;#VA qtime %1}
#TRIGGER {You inform {Lord|Lady} %w you have completed your quest.} {quest status}
#TRIGGER {* tells you 'I'm sorry, but I don't have any quests for you right now. Try again later.'} {quest status}
#TRIGGER {You have completed a part of your quest!} {#BEEP;quest status}
#CLASS 0

thats the whole script, written by someone else being converted by me to work on 6.16 works great so far except for this little problem
Reply with quote
Maximus
Wanderer


Joined: 21 May 2001
Posts: 59
Location: USA

PostPosted: Fri Jul 19, 2002 9:52 pm   
 
Honestly, the only thing I see wrong is missing paranthesis on the #IF statement in your alarm, it should look like

#if (@qtime=0) {#T- Alarms;#VA mins n/a;#SA You may now quest again}

Maybe that was the only problem. I would suggest putting a #SAY command at the beginning of your alarm to notify you if it's even going off because for all I can tell it should.

-Maximus
Reply with quote
snoogans
Novice


Joined: 28 Oct 2001
Posts: 43
Location: USA

PostPosted: Fri Jul 19, 2002 9:57 pm   
 
okay put the #SAY in there and it IS working, but its going every 60 seconds for some reason ... any guru's wanna whap upside the hide and tell me what stupid mistake i made?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Jul 19, 2002 10:19 pm   
 
First thing I would say is that the ALARM was improperly created. ALARMs made with the -x syntax are supposed to fire once and then auto remove.

Next thing of note is that your qtime variable is set with minutes but you seem to want to decrement it every 15 seconds. From what I recall of the autoquester code for ROM/DIKU the minutes it displays are real time minutes. So a few minor changes.

#CLASS {alarms}
#ALARM *1 {#ADD qtime -1;#if (@qtime=0) {#T- Alarms;#VA qtime n/a;#SA You may now quest again}}
#CLASS 0
#CLASS {Quest}
#TRIGGER {You have (%d) minutes remaining %w you can quest again.} {#T+ alarms;#va qtime %eval(%1*60)}
#TRIGGER {You may now quest again.} {#T- Alarms;#VA qtime n/a;q request}
#TRIGGER {You have (%d) minutes remaining to complete this quest.} {#T+ alarms;#VA qtime %eval(%1*60)}
#TRIGGER {You inform {Lord|Lady} %w you have completed your quest.} {quest status}
#TRIGGER {* tells you 'I'm sorry, but I don't have any quests for you right now. Try again later.'} {quest status}
#TRIGGER {You have completed a part of your quest!} {#BEEP;quest status}
#CLASS 0

Since you didn't include the status bar commands I can't update them too. I removed the reference to the variable "mins" from the ALARM and replaced that with "qtime" since you made no reference to it elsewhere.
Reply with quote
snoogans
Novice


Joined: 28 Oct 2001
Posts: 43
Location: USA

PostPosted: Fri Jul 19, 2002 10:31 pm   
 
no no no, game minutes are every 15 seconds, so every 15 seconds i want it to subtract one, and in the help file it says that

#alarm -30:00 {save}

will save every 30 seconds, it says the '-' only says for it to use connection time instead of system time, at least thats what it says in the help file
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Jul 19, 2002 11:26 pm   
 
It is going off every minute because when you give an alarm a pattern of -15 (hour and minutes not specified), it will match every time the connected seconds are 15 (once every minute.) What you want then is *15 that fires every 15 seconds, and since 15 seconds from connect time are the same as 15 seconds from your computer clock, it doesn't really matter if it is taking the connect time into consideration or not.

Kjata
Reply with quote
snoogans
Novice


Joined: 28 Oct 2001
Posts: 43
Location: USA

PostPosted: Fri Jul 19, 2002 11:45 pm   
 
that works kind of, only problem is that unless i get the quest exactly at an interval of 15(o seconds, 15, seconds, 30 seconds, etc) it wont be correct, only off by a few seconds, but is there any way so that it counts 15 seconds from what time i start it?
Reply with quote
EdwinDroom
Wanderer


Joined: 25 Jan 2002
Posts: 77
Location: Ireland

PostPosted: Sat Jul 20, 2002 12:28 am   
 
I tried the following

#ALARM -15 {#SHOW tick}

And it fired every 15 secs. Am using 6.26a beta for this, and already have alarms like this for fighting. Not sure why it isnt working correctly for you, but this is NOT a one time fire (that is #ALARM +7).

"I've got an allergy to Perrier, daylight and responsibility" - Marillion

Check out Moral Decay on 131.247.113.1 3003
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jul 20, 2002 1:12 am   
 
What you want is an alarm that fires every second and you manually count to 15:
#TRIGGER {something happens} {#VAR count 0;#T+ timerAlarm}
#ALARM "timerAlarm" {#ADD count 1;#IF (@count = 15) {15 seconds are up, do something}}

Kjata
Reply with quote
EdwinDroom
Wanderer


Joined: 25 Jan 2002
Posts: 77
Location: Ireland

PostPosted: Sat Jul 20, 2002 1:47 am   
 
Or, if you're not using tick timer elsewhere

#TS 20, and a trigger on Tick in 5 secs which executes your code and resets tick timer to 20?

Not elegant, but workable in all versions

"I've got an allergy to Perrier, daylight and responsibility" - Marillion

Check out Moral Decay on 131.247.113.1 3003
Reply with quote
fossie
Beginner


Joined: 09 Aug 2002
Posts: 12
Location: Norway

PostPosted: Tue Aug 13, 2002 11:25 am   
 
quote:

What you want is an alarm that fires every second and you manually count to 15:
#TRIGGER {something happens} {#VAR count 0;#T+ timerAlarm}
#ALARM "timerAlarm" {#ADD count 1;#IF (@count = 15) {15 seconds are up, do something}}

Kjata



I'm using an older version of zmud (can't install a newer version because it needs to update my registry - something I'm not authorized to do :/ )

What's the trigger pattern in this alarm?? I want my alarm to fire every half second or so, and count 1 when it does.

A bit late reply I know, but at least I'm reading the old posts so I don't nag you with old stuff over again :)

Thanks!
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Aug 13, 2002 12:26 pm   
 
Oops, the alarm pattern should be *1

If you can't upgrade your zMUD, then you can't make it fire every half-second since only the beta version is the one that currently lets you make alarms with floating-point values like 1.5, 10.2, and .5

Kjata
Reply with quote
fossie
Beginner


Joined: 09 Aug 2002
Posts: 12
Location: Norway

PostPosted: Wed Aug 14, 2002 8:32 am   
 
Well, it appears that I can use floatingpoint values in alarms in my version of Z-mud too (4.56)... I use

#ALARM *0.5 {#ad count 1}

and it seems to work very well.
The problem is that I want it to to fire every half second from when I fire my trigger, not every half second on my computers clock.

I've tried using alarms that fire only once, and then create a new alarm like this

#alias dostuff {#ad count 1;#alarm +0.5 {dostuff}}

but when I run it it stops after about 2 runs. I figured it stops because it tries to create the new alarm before the old (and identical) has been removed, so I added a wait command in there to give the old alarm time to be discarded:

#alias dostuff {#ad count 1;#wait 200;#alarm +0.5 {dostuff}}

And this seems to do the trick! Now my problem is that I use the #wait command elsewhere too, and of course they conflict making a mess of it all :P

Any good ideas?

PS! On the preview of this post the plus-signs seem to disappear. There is of course supposed to be plus-signs before the delay 0.5 in the alarms above.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Aug 14, 2002 12:20 pm   
 
Do you really need that much precision? Will something really bad happen if you don't quest again exactly when you are able to?

Kjata
Reply with quote
fossie
Beginner


Joined: 09 Aug 2002
Posts: 12
Location: Norway

PostPosted: Wed Aug 14, 2002 1:09 pm   
 
Well, on my mud timing can be a great advantage. Casting a spell at exactly the right time will make it go off instantly instead of waiting a second between starting and finishing the spell. I can get hit in that second, and if I get hit too much I wince...
I think each round is devided into four or six shorter timespans, And I was trying to keep track on which one I'm in so I can get my spells off quick and safe.
... what a wonderful thought! *dreams*
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Aug 14, 2002 2:37 pm   
 
Well, since I don't know exactly how you are doing what you want, all I can suggest is to somehow use %secs in your scripts. %secs returns the amount of miliseconds since midnight, and you can use it to find out the time difference between two events by saving its value when the first even happens and then subtracting the value it has when the second event happens from the value already saved.

Kjata
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Thu Aug 15, 2002 6:44 am   
 
Hmm....for your questing alarm, instead of having an alarm that checks every 15 seconds, why not just create a temporary alarm?

#TRIGGER {You have (%d) minutes remaining %w {you can quest again|complete this quest}.} {#exec {#alarm "QuestAlarm" +[%1*15] {#say You may now quest again.}}}
#TRIGGER {You may now quest again.} {#alarm "QuestAlarm" +1 {};q request}

Iljhar
Reply with quote
fossie
Beginner


Joined: 09 Aug 2002
Posts: 12
Location: Norway

PostPosted: Thu Aug 15, 2002 9:28 am   
 
Thanks, Kjata...
but I won't be able to activate the check until I recieve a line from the mud, and that would not be frequent enough. I'll let you know if I come up with an idea though :)

Thanks again,

-fossie
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