[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  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] Refresh page


Posted by JY.Chang   Taiwan  (15 posts)  [Biography] 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.
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] 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
[Go to top] top

Posted by JY.Chang   Taiwan  (15 posts)  [Biography] 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?
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] 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
[Go to top] top

Posted by JY.Chang   Taiwan  (15 posts)  [Biography] 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!
[Go to top] 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.


12,780 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]