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


Joined: 13 Jan 2009
Posts: 4
Location: Helsinki

PostPosted: Fri Nov 10, 2023 2:08 pm   

CASE random with #ALARM or #WAIT
 
https://www.zuggsoft.com/zmud/help6/CASE.htm

#CASE %random {Hello} {Hi there} {Hiya} {Hi}
returns a random string from the given list to the MUD.

How do you add WAIT or ALARM for this random commands? If you just put ..
#CASE %random {#ALARM +5 Hello} {#ALARM +10 Hi there} {#ALARM +15 Hiya} {#ALARM +20 Hi}
or
#CASE %random {#WAIT +5 Hello} {#WAIT +10 Hi there} {#WAIT +15 Hiya} {#WAIT +20 Hi}

these wont work, "syntax error".

Do you have a work around for this? maybe with something else than #CASE %random ?

Thanks in advance Zuggsoft forum helpers!
Reply with quote
mikeC130
Apprentice


Joined: 03 Jul 2006
Posts: 110

PostPosted: Fri Nov 10, 2023 6:03 pm   
 
Your commands are incomplete. For alarm, any commands associated with it triggering must be in brackets {}, as in #ALARM +2 {Hi}. For your script, you would have nested brackets, with each case being in a set and then the command to follow the alarm within it's own brackets. Wait has a different syntax and parameter setting. Wait doesn't use +, and the value following is in milliseconds, not seconds, so waiting 2 seconds would just be #WAIT 2000. Also, sequential commands must be separated by a semicolon, so you need one between the wait and what you want sent out.

The following have been tested in CMUD, but should work for ZMUD as well. Both of these wait 2 seconds and then randomly send one of the messages.

Code:

#CASE %random {#ALARM +2 {Hello}} {#alarm +2 {Hi there}} {#alarm +2 {Hiya}} {#alarm +2 {Hi}}

#CASE %random {#WAIT 2000; Hello} {#WAIT 2000; Hi there} {#WAIT 2000; Hiya} {#WAIT 2000; Hi}
Reply with quote
kaupmat
Newbie


Joined: 13 Jan 2009
Posts: 4
Location: Helsinki

PostPosted: Fri Nov 10, 2023 6:34 pm   
 
Oh! So easy it was! I never had two different brackets in a trigger - only 1 ! Thank You very much mikec130 for help! This will help me in other future triggers too!
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