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, 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 ➜ Trigger with multiple commands (Combination of Words)

Trigger with multiple commands (Combination of Words)

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


Posted by Valentim   (9 posts)  Bio
Date Thu 15 Aug 2013 06:02 PM (UTC)

Amended on Thu 15 Aug 2013 06:08 PM (UTC) by Valentim

Message
How do I make a trigger according to information below:
Example: Words (Do It Do Do It)

Trigger: Words \( (. *) \)

Send:
Word = %1 -- Variable Word equal "Do It Do Do It"
Word = Replace (Word, "Do It", "DoIt") -- Variable Word equal "DoIt Do DoIt"

Then we separate the commands
Word = Split(Word, " ")

Now we have an array with the values
Word[1] = DoIt
Word[2] = Do
Word[3] = DoIt"

After sending word for word to Mud
"DoIt"
"Do"
"DoIt"

It is possible to make this trigger?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 16 Aug 2013 08:24 AM (UTC)
Message
You could do a string.gmatch on the resulting string, and then do a "Send" on each word.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Valentim   (9 posts)  Bio
Date Reply #2 on Fri 16 Aug 2013 11:56 AM (UTC)
Message
I could not use the "string.gmatch", looked at some examples but is not working.

Does anyone have any other idea?
Top

Posted by Valentim   (9 posts)  Bio
Date Reply #3 on Fri 16 Aug 2013 02:37 PM (UTC)
Message
Managed to create a simple form.


aWord = {}
cWord = "%2"
aWord = utils.split (cWord, " ")

for pos, value in pairs (aWord) do
  Send(value)
end -- For
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.


15,213 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.