Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Alias generates random emote from array
Alias generates random emote from array
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Janus
(3 posts) Bio
|
Date
| Tue 10 Feb 2009 10:32 AM (UTC) |
Message
| Hello,
I play a MUD called armageddon. Normally when I climb I type code like U (emote) eg: U (gripping the rope tightly) productes output : Gripping the rope tightly, you climp upwards.
Id like to create an alias that will randomly fire say 20% of the time, and when it fires, appends a random emote from an array of emotes.
dim climb
climb[1]="spitting into ^me hands and rubbing them together"
climb[2]="taking the strain on the rope"
..
climb[18]="gripping the rope tightly"
climb[19]="wrapping the wrope around ^me leg"
climb[20]="blinking as dust falls in ^me face"
I've had a look through the forums, but can't get this working myself. If anyone could offer a suggestion, or point to a relevant thread, i'd be most grateful.
Thanks | Top |
|
Posted by
| Janus
(3 posts) Bio
|
Date
| Reply #1 on Tue 10 Feb 2009 04:24 PM (UTC) |
Message
| Hello,
I found a very useful article on a teleport alias which looks really promising for a starting place.
Only problem is, I've copied and pasted it correctly, but I think the alias is wrong? Ive got:
add_teleport * *
as per the example, but if i type this:
add_teleport desert 4343
the script is throwing back:
Syntax: add_teleport name dbref
eg. add_teleport LandingBay 4421
as if the variables are not being passed across.
Am I being really dumb?
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Tue 10 Feb 2009 07:00 PM (UTC) |
Message
| For the random emotes, there is a plugin on this page:
http://www.gammon.com.au/mushclient/plugins/
It is called Random_Socials and it does that general idea. However it builds up its list from what the MUD offers as socials.
It is pretty simple to do the random stuff in Lua, so I'll illustrate it here:
<aliases>
<alias
match="U"
enabled="y"
send_to="12"
sequence="100"
>
<send>
do -- keep emotes table local
local emotes = {
"spitting into ^me hands and rubbing them together",
"taking the strain on the rope",
-- add more anywhere
"gripping the rope tightly",
"wrapping the wrope around ^me leg",
"blinking as dust falls in ^me face",
} -- end of emotes table
if math.random (0, 100) <= 20 then -- 20% of the time
Send ("U (" .. emotes [math.random (1, #emotes)] .. ")")
else
Send ("U")
end -- if
end -- do
</send>
</alias>
</aliases>
This maintains a local table of possible emotes, which it randomly chooses one from, 20% of the time. Just add more into the table in the same format, and it will adjust to the new size (it picks one from the first to #emotes, which is the size of the table).
See: http://mushclient.com/pasting for how to paste that into the client. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Janus
(3 posts) Bio
|
Date
| Reply #3 on Wed 11 Feb 2009 07:39 AM (UTC) |
Message
| Thats exactly what i was after.
Thank you so much, I would never have figured that out on my own. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
12,390 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top