Trying to write some kind of alias script...

Posted by Virsago on Tue 07 Feb 2006 12:14 AM — 4 posts, 15,082 views.

#0
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.
Australia Forum Administrator #1
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.
#2
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?
Australia Forum Administrator #3
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).