|
dungheap Newbie
Joined: 27 Jul 2015 Posts: 3 Location: Florida
|
Posted: 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? |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: 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)) |
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
dungheap Newbie
Joined: 27 Jul 2015 Posts: 3 Location: Florida
|
Posted: 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 :) |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: 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?
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: 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 |
|
|
|
dungheap Newbie
Joined: 27 Jul 2015 Posts: 3 Location: Florida
|
Posted: Thu Jul 30, 2015 5:06 am |
I am assuming I am making this a trigger?
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
|
|