Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, 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.
 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ voting alias

voting alias

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Zevrin   (2 posts)  Bio
Date Sat 05 Jun 2010 02:13 AM (UTC)
Message
I'm looking for something that will allow me to use the +vote system on my MUSH more effectively. Basically I need an alias that allows me to type "vote x y z" and it sends +vote x;+vote y;+vote z to the MUSH. Of, course I want it to be able to take in more then three names and the amount will change each time. Any ideas on how I could do this?

Thanks :)
Top

Posted by Daniel P   USA  (97 posts)  Bio
Date Reply #1 on Sun 06 Jun 2010 08:18 PM (UTC)

Amended on Sun 06 Jun 2010 08:20 PM (UTC) by Daniel P

Message
So correct me if I'm wrong but you want to take every letter and run +VOTE <letter> on them in turn.

Looking through the help files, I discovered the string.gmatch() function, which might work, as the example Nick gives is almost exactly what you're looking for: parse out the space-separated "words" into individual arguments.

Assuming your alias would match "vote *", your script could be:

for w in string.gmatch("%1","%a+") do
   print (w) -- Simply prints out every space-seperated letter on their own lines
   Send("+vote "..w)
end -- for


Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #2 on Sun 06 Jun 2010 09:46 PM (UTC)
Message
It sounds like 'x y z' are placeholders for names, like "vote george bob larry".

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Zevrin   (2 posts)  Bio
Date Reply #3 on Tue 08 Jun 2010 04:11 PM (UTC)
Message
Yes, x y and z were place holders.
Top

Posted by Daniel P   USA  (97 posts)  Bio
Date Reply #4 on Tue 08 Jun 2010 07:39 PM (UTC)
Message
string.gmatch() still works though, correct? It should.
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #5 on Tue 08 Jun 2010 07:48 PM (UTC)
Message
Hmm, yes. You'd probably just have to change %a to %S.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
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.


17,635 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.