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
➜ Trying to write some kind of alias script...
|
Trying to write some kind of alias script...
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Virsago
(2 posts) Bio
|
| Date
| Tue 07 Feb 2006 12:14 AM (UTC) |
| Message
| I have absolutely no clue how to go about this.
Basically, i need an alias that would work something like this.
I type 'combo1'
Combo 1 then randomizes 4 choices from the following 'lk mk hk sw'
so it would spit out 'lk lk lk lk' or 'lk mk sw lk' or whatever, at random. Basically to randomly select each spot with the 4 options given.
Can anybody clue me in to how to do this? On ZMud it was some kind of 'case' command. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Tue 07 Feb 2006 01:04 AM (UTC) |
| Message
| This will do it, if you use Lua as the script language:
<aliases>
<alias
match="combo1"
enabled="y"
send_to="12"
sequence="100"
>
<send>
result = {}
for count = 1, 4 do
table.insert (result,
({'lk', 'mk', 'hk', 'sw'}) [math.random (1, 4)])
end -- for
Send (table.concat (result, " "))</send>
</alias>
</aliases>
Basically it uses math.random to make a choice of the 4 different letter combinations, and does it 4 times. To make a similar alias simply changes the literals:
'lk', 'mk', 'hk', 'sw'
... to something else. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Virsago
(2 posts) Bio
|
| Date
| Reply #2 on Tue 07 Feb 2006 01:47 AM (UTC) |
| Message
| That's abso-frickin-lutely awesome. The problem is that I'm on mushclient 3.45 still. Im on dialup so i try not to download much stuff.
How can I actually get the lua into mushclient now? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Tue 07 Feb 2006 04:21 AM (UTC) |
| Message
| Well you could do something similar in VBscript, perhaps one of the VB scripters will post a suggestion.
However the MUSHclient download isn't that big (1.71 Mb for version 3.73). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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.
14,542 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top