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


Joined: 27 Jul 2015
Posts: 3
Location: Florida

PostPosted: Mon Jul 27, 2015 5:48 am   

How to emote randomly
 
I am playing a MUD that sends this output when smoking a pipe:

You take a long, deep drag on your pipe.

When that comes on screen, I want to emote randomly one of 5 emotes I have set (pipe1, pipe2, etc).

I've tried a few things but they were utter failure. Any help?
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Mon Jul 27, 2015 7:36 am   
 
Store the 5 emotes in a string list, then use %random to get a random number from 1 to 5, and %item to get the item in the list at that position. Something like this:

Code:
$emotes = {"pipe1", "pipe2", "pipe3", "pipe4", "pipe5"}
#send %item($emotes, %random(1, 5))
Reply with quote
shalimar
GURU


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

PostPosted: Tue Jul 28, 2015 12:05 am   
 
#send %item($emotes, %random(1, %numitems($emotes)))

That will allow you to add more variety still without having to edit more then just the array of aliases.
_________________
Discord: Shalimarwildcat
Reply with quote
dungheap
Newbie


Joined: 27 Jul 2015
Posts: 3
Location: Florida

PostPosted: Tue Jul 28, 2015 3:48 am   
 
I tried doing what you guys said but all I get from the mud is "what?"

I'm assuming there's more to the code then what you posted. I'll figure it out some other day :)
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Tue Jul 28, 2015 10:56 am   
 
Do you have echo commands enabled in preferences? Can you see what the script is sending to the MUD?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Jul 29, 2015 6:49 am   
 
I am going to guess that you have aliases named pipe1, pipe2, etc. for those emotes. You can either change the #SEND from above to #EXEC, or you could rebuild the whole thing as a single alias like this:
Code:
#SWITCH (%random(1,5))
 (1) {some code from pipe1
  some more pipe1 code
 }
 (2) {pipe2 stuff}
 (3) {whatever is in pipe3}
 (4) {the contents of pipe 4}
 (5) {you got the idea}

If you do choose to change to the #SWITCH read the help carefully because matching the indentation to how I wrote it will be important.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
dungheap
Newbie


Joined: 27 Jul 2015
Posts: 3
Location: Florida

PostPosted: Thu Jul 30, 2015 5:06 am   
 
I am assuming I am making this a trigger?
Reply with quote
shalimar
GURU


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

PostPosted: Thu Jul 30, 2015 7:49 am   
 
#TRIGGER, #ALIAS, #MACRO, #BUTTON, #MXP....

Which type of setting you put it in is really up to you.
The switch presented to you is just a randomizer.
_________________
Discord: Shalimarwildcat
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 Wolfpaw.net