voting alias

Posted by Zevrin on Sat 05 Jun 2010 02:13 AM — 6 posts, 24,391 views.

#0
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 :)
USA #1
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


Amended on Sun 06 Jun 2010 08:20 PM by Daniel P
USA #2
It sounds like 'x y z' are placeholders for names, like "vote george bob larry".
#3
Yes, x y and z were place holders.
USA #4
string.gmatch() still works though, correct? It should.
USA #5
Hmm, yes. You'd probably just have to change %a to %S.