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 ➜ Lua ➜ Enable / Disable Trigger

Enable / Disable Trigger

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


Posted by Tkl1129   Hong Kong  (43 posts)  Bio
Date Wed 28 Dec 2011 07:57 AM (UTC)
Message
Hi all,

Just want to ask a stupid quesiton.

in a World, 1st Connect was suppose all trigger is enable?

After reconnect to the world, do the status of the trigger is reset to default "Enable", or remain the same with last setting?

I feel confuse to setup the Label & Group name of the trigger that is hard to manage in reconnect case.

Please share yr exp and commnet for advice, thanks.
Top

Posted by Daniel P   USA  (97 posts)  Bio
Date Reply #1 on Wed 28 Dec 2011 04:21 PM (UTC)
Message
No. Your triggers' enabled flag is not reset on reload. They will save between sessions.

As for labels and groups, if you open up the specific trigger window, you should see the two boxes labelled "Label" and "Group". These can then be controlled with scripting via

EnableTrigger()

and

EnableTriggerGroup()

respectively.

If you have five triggers that are part of the same group; say, "attacks", you can disable all of your attacks via a script in an alias or some other means by calling

EnableTriggerGroup("attacks",false)

To turn them back on:

EnableTriggerGroup("attacks",true)

This also applies to single triggers via the Label box, or if editing the script directly from a text editor, the "name" variable.

No two triggers/aliases/timers can have the same label/name. MUSHClient really yells at you if you try this. Thus, if you look at the last example..five triggers in the "attacks" group, each one could be labelled: attack1, attack2, attack3, attack4, and attack5.

Say you only want to be able to use four of them instead of all five. You can disable the one trigger you don't want enabled with:

EnableTrigger("attack4",false)

and turn it back on with:

EnableTrigger("attack4",true)



Also note:

These correlate pretty closely with EnableAliasGroup(), EnableAlias(), EnableTimerGroup(), and EnableTimer().
Top

Posted by Tkl1129   Hong Kong  (43 posts)  Bio
Date Reply #2 on Wed 28 Dec 2011 04:40 PM (UTC)
Message
Thanks,

Since I'm Zmud user before that I usually control the trigger with enable / disable the class...

and all the en / dis status will reset by default when the session is reconnect.

now when I'm using mush, even relogin, close mush or reopen, the enable / disable status will be keep at the last status.

So I've to re-design of my trigger group.
Top

Posted by Nick Gammon   Australia  (23,057 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 28 Dec 2011 08:06 PM (UTC)
Message
Things are how you left them. When you save a Word document, things are how you left them when you open it next time, right?

You can enable/disable a group of triggers with EnableTriggerGroup (or EnableGroup if you want to do aliases and timers as well).

You can make a "on world open" event in your script file, and that event can enable/disable such groups as you see fit. Or you could use the "on world connect" event.

Template:function=EnableGroup EnableGroup

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


- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


18,837 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.