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
Angelboy2098
Newbie


Joined: 04 Nov 2007
Posts: 2

PostPosted: Sun Nov 04, 2007 3:45 am   

Help with a trigger
 
I am fairly new to Zmud and I was trying to make a script to send different commands at random intervals problem is I don't know where to start any help would be awsome
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Nov 04, 2007 4:24 am   
 
The command you will be most interested in is #ALARM. You will also need a few functions %random, %case, possibly item %item.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Nov 04, 2007 9:49 am   
 
Something like:

#alarm {%eval(4+%random(6,16))} {#send %case(%random(1,4),dance,ponder,skip,hum)}

Will do one of the listed commands every 10-20 seconds. Look up the functions in the manual for more info on how to use them.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Angelboy2098
Newbie


Joined: 04 Nov 2007
Posts: 2

PostPosted: Mon Nov 05, 2007 12:43 am   
 
So if I wanted to changed the intervals between 0, and 360 while executing around 50 different commands at different intervals it would look something like this:


#ALARM {%eval( 4+%random( ,360))} {#send %case( %random( 1, 50), blah, skip, hum, note read %random( 1, 36), oocn read %random( 1, 11) )}
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Nov 05, 2007 9:21 am   
 
Between 0 and 360 seconds, you could just use %random(360) instead of %eval(4+%random(,360)), hopefully for obvious reasons.

Read the help file for the %case function. The first argument is a number, or a variable containing a number, or a function that returns a number. In this case, we're using the %random function to return a random number. The rest of the arguments are things to return when each number comes up - the second argument is number 1, the third number 2, etc etc. So your %case function should look like

%case(%random(1,50),something1,something2,something3,something4,something5,...blahblah...,something50)

EDIT: Rereading your %case example, I understand it better now. I thought you were confused about the usage and including %randoms everywhere, but you're not. Looks good!
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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