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


Joined: 29 Jul 2004
Posts: 19
Location: United States

PostPosted: Tue Aug 22, 2006 7:26 pm   

Random Trigger
 
I've got a character that as part of a character trait, I want him to, at random times, cluck like a chicken, oddly enough the mud I play has somthing like this as a social.

I've worked on it some with the help of one of the guys on our MUD and he says he got it to work, but I just can't grasp what I'm doing wrong.

Here is what I have:

Code:
#CLASS {character traits|ChickenTimer}
#CLASS {character traits|ChickenTimer}
#ALARM {-30:00} {@chickentimer}
#ALARM {   -@chickentimer} {chicken}
#VAR chickentimer {%random( 1200, 2400)}
#CLASS 0


The way I figure this it should start a timer at login that runs for 30 minutes then add a random time to that between 20 an 40 minutes.

A little long but I can adjust that. The problem is right now it executes every minute.
Reply with quote
Qiz
Novice


Joined: 14 Aug 2006
Posts: 34
Location: Sweden

PostPosted: Tue Aug 22, 2006 8:05 pm   Re: Random Trigger
 
Some things seem a bit strange here.
CuMorrigu wrote:

#VAR chickentimer {%random( 1200, 2400)}
#ALARM { -@chickentimer} {chicken}

While the principles behind this is ok, one thing may be causing the trouble here. However, I've not had the chance to test my theory and I'm not entirely certain, and I can't for the life of me understand why it would end up executing each minute.
The problem might come from the 1200,2400 random number. I'd rather do:
#VAR chickentimer {%random( 20, 40)}
#ALARM { -{@{chickentimer}:00}} {chicken}[/quote]


[quote="CuMorrigu"]
#ALARM {-30:00} {@chickentimer}
[/code]
What is the intent of this code? Let's assume @chickentimer contains 1500 from your original code. Then, each 30 minutes, the value 1500 is sent to the mud, which ought to do nothing at all. If you want effectively change the value of your variable every 30 minutes, then go with:
#ALARM {-30:00} {chickentimer = %random(20, 40)}

However in that case it might be better to do
#VAR chickentimer (%random(20,40) + 30)
#ALARM { -{@{chickentimer}:00}} {chicken; chikentimer = %random(20,40)}
This would execute chicken after 50-70 minutes after log, then each 20-40 minutes.
Reply with quote
CuMorrigu
Beginner


Joined: 29 Jul 2004
Posts: 19
Location: United States

PostPosted: Wed Aug 23, 2006 10:38 pm   
 
Okay I'm and idiot, but I am soooo lost here
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