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 ➜ Lua ➜ Is there a function for checking trigger group exists or not?

Is there a function for checking trigger group exists or not?

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


Posted by JY.Chang   Taiwan  (15 posts)  Bio
Date Tue 13 Dec 2011 04:17 AM (UTC)
Message
Q1: The IsTrigger function is for single trigger, but i want to know is there a function for checking trigger group exists or not?

Q2:
Send ("eat bread\ndrink milk")
Send (FixupEscapeSequences("eat bread\ndrink milk"))


both of above got an error message when send to script, i am new in programming, please tell me where the mistake is?

ps.English is not my mother language, so my english is pretty basic, please don't mind.
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #1 on Tue 13 Dec 2011 04:51 AM (UTC)

Amended on Tue 13 Dec 2011 04:54 AM (UTC) by Fiendish

Message
Quote:
Q1: The IsTrigger function is for single trigger, but i want to know is there a function for checking trigger group exists or not?
I don't think there is a function for this, but why do you want it?

Quote:
Q2:

Send ("eat bread\ndrink milk")
Send (FixupEscapeSequences("eat bread\ndrink milk"))


You could just do
Send("eat bread")
Send("drink milk")

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by JY.Chang   Taiwan  (15 posts)  Bio
Date Reply #2 on Tue 13 Dec 2011 05:33 AM (UTC)

Amended on Tue 13 Dec 2011 07:21 AM (UTC) by JY.Chang

Message
Quote:
I don't think there is a function for this, but why do you want it?

I make an alias below to enable a trigger group, and i want to do that error message will popup if the trigger group doesn't exist.
<aliases>
  <alias
   match="t+"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>EnableTriggerGroup("%1",true)
Note("Enable Trigger Group " .. "%1")</send>
  </alias>
</aliases>



Quote:

You could just do
Send("eat bread")
Send("drink milk")

Thank you for your answer, but i wonder how can i do that by just one line command?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Tue 13 Dec 2011 05:51 AM (UTC)
Message
In send-to-script, \n is converted into a newline (before being sent to Lua). So do this:


Send ("eat bread\\ndrink milk")


Or:


Send ([[
eat bread
drink milk
]])





Quote:

I want to know is there a function for checking trigger group exists or not?


Template:function=EnableTriggerGroup EnableTriggerGroup

The documentation for the EnableTriggerGroup script function is available online. It is also in the MUSHclient help file.



The function returns the number of items in the group. If the group doesn't exist it would return 0.

- Nick Gammon

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

Posted by JY.Chang   Taiwan  (15 posts)  Bio
Date Reply #4 on Tue 13 Dec 2011 07:46 AM (UTC)
Message
Nick Gammon said:

In send-to-script, \n is converted into a newline (before being sent to Lua). So do this:


Send ("eat bread\\ndrink milk")


Or:


Send ([[
eat bread
drink milk
]])


-----

(function=EnableTriggerGroup)

The function returns the number of items in the group. If the group doesn't exist it would return 0.


Thank you very much, Nick! You really do me a big favour!
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,537 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.