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


Joined: 10 Apr 2003
Posts: 45
Location: USA

PostPosted: Tue Mar 30, 2004 5:10 am   

Periodic Events
 
Thank you to all who responded to my question about coloring certain output lines :) It helped a lot. The %color (fore, back) command only outputs a number to use in conjunction with #COLOR, but it put me on the right path.

My current pickle is something called a periodic event. I'm building a script that involves a series of #IF boolean expressions, in order to execute a possible two reactions dependent on whether a specific variable is true or false. However, in order to prevent this variable from being fooled into remaining true indefinitely, I need something that was only described as a "periodic event."

I've checked the help files thoroughly and I haven't been able to find anything. I think the reference MIGHT mean a tick timer, but I'm not sure, having checked the timer tool out. In the instructions I read for the script, I'm told this:

<<
Solution: events.
Add one more variable, I call it eatnow, and one periodical event (I
call it eatit) with a period of 1-2 seconds and action
get @eatnow from pouch
eat @eatnow

Now, whenever you had to eat an antidote, you, instead of it, not simply eat it, but also set eatnow equal to this antidote and enable the event. Say the trigger for the injury will now look this way:

$var poison 1
$if (@caneat = 1) {
$var caneat 0
$var eatnow "antidote"
$eventenable eatit
get antidote from pouch
eat antidote
}

Of course the moment you do eat the antidote, you have to stop this event, so you make triggers like "you eat an antidote" resulting in:
$eventdisable eatnow
$eventreset eatnow <- in my client this resets the event time
>>

I'm sure the "$var poison 1" is a boolean #IF setup (#IF (@poison = 1) ). What I'm not sure is where to put this "periodic event" called eatit, and whether "$eventenable," "$eventdisable," and "$eventreset" are yet more variables, or aliases, or something else.

Any assistance? :)

Holly
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Tue Mar 30, 2004 7:06 am   
 
quote:
Originally posted by HollyC

I've checked the help files thoroughly and I haven't been able to find anything. I think the reference MIGHT mean a tick timer, but I'm not sure, having checked the timer tool out. In the instructions I read for the script, I'm told this:



The tick timer would create a periodic event, but an #Alarm would probably be the way to go.

#ALARM eatit *2 {get @eatnow from pouch;eat @eatnow}

Note: A temporary alarm (not periodic) '#ALARM +2 {get @eatnow from pouch;eat @eatnow}' might be more advantageous in this case, but without the whole script it's difficult to know.

quote:

I'm sure the "$var poison 1" is a boolean #IF setup (#IF (@poison = 1) ). What I'm not sure is where to put this "periodic event" called eatit, and whether "$eventenable," "$eventdisable," and "$eventreset" are yet more variables, or aliases, or something else.



$eventenable probably corresponds to #T+
#T+ eatit
This will cause the setting with the ID eatit to be enabled. In this case 'get @eatnow from pouch;eat @eatnow' will be sent to the mud every two seconds.

$eventdisable probably corresponds to #T-
#T- eatnow
This will cause the setting with the ID eatnow to be disabled.

Note: #UNVAR eatnow would destroy the variable with ID eatnow.
$eventreset
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Tue Mar 30, 2004 7:14 am   
 
Read the helpfiles for Alarm, Trigger, Alias, Variable, T+, If
also do a forum search for auto cure, and various other things you might want it to do
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