Register to post in forums, or Log in to your existing account

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion

Joined: 11 Dec 2011
Posts: 3
Location: Oslo

PostPosted: Wed Jun 18, 2014 8:42 am   

Script help for a newbie

I would like to create a script which when triggered will pick a random respons from an already predetermined list.

#Trigger {They are not here} - Send #ECHO (text), howerver I want each time the tigger {They are not here} is triggered, to have configured 10 different echoes which will show randomly from the same trigger.

#ECHO mob1
#ECHO mob2
#ECHO mob3
#ECHO mob4

My problem is that I can't get the trigger to randomize each #ECHO, so I just keep getting the same #ECHO over and over.

If I use:
#TRIGGER {They are not here} {%random 1,10}
and under %random have all the #ECHOs, the trigger will simply prompt numbers.

Example, when its triggered the %random 1,10 will show "52" or some other random number.

Does anyone have a good idea on how I can make this work ?

Reply with quote

Joined: 20 Jul 2017
Posts: 1

PostPosted: Thu Jul 20, 2017 4:16 pm   
I am also looking for the similar thing to make .. :(
Reply with quote

Joined: 04 Aug 2002
Posts: 3614
Location: Pensacola, FL, USA

PostPosted: Sun Jul 23, 2017 7:38 am   
Wrong section of the forums.... but I will fix that.
This answer assumes you are using CMUD:

First you need to put your options into avariable


then to pick a random member of that would be:

$thisMob=%item($mobs, (%random(1, %numitems($mobs)))

and then you would perform whichever action you want to do on $thisMob
Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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