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

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Easily Enabling/Disabling Triggers
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Easily Enabling/Disabling Triggers

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


Posted by Qwilleran   (3 posts)  [Biography] bio
Date Wed 07 Apr 2004 04:08 PM (UTC)
Message
I don't use any scripts whatsoever except for a simple sipper. For triggers, I've always just done 'text match' and a return. However, I have certain abilities that will stop if a trigger goes off, or if I do anything at all. Is there an easy way, like an alias, that I could enable/disable all triggers?
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #1 on Wed 07 Apr 2004 04:53 PM (UTC)
Message
I can't really believe it yet, but I couldn't find an easy way of doing this. There is a workaround but it is _very_ painful, especially if you have lots of triggers. A simpler workaround also exists but it is likely to screw up some things if you have triggers that need to be enabled/disabled individually - this will enable/disable them with all the other stuff and it can have undesirable side effects. But here it is nonetheless:


<aliases>
  <alias
   name="trigger_controller"
   match="^(etr|dtr)$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>if &quot;%1&quot; = &quot;etr&quot; then
 for each trig in World.GetTriggerList
   world.EnableTrigger trig, 1
 next
 for each plug in World.GetPluginList
   world.EnablePlugin plug, 1
 next
 world.Note &quot;Triggers enabled&quot;
elseif &quot;%1&quot; = &quot;dtr&quot; then
 for each trig in World.GetTriggerList
   world.EnableTrigger trig, 0
 next
 for each plug in World.GetPluginList
   world.EnablePlugin, plug, 0
 next
 world.Note &quot;Triggers disabled&quot;
end if</send>
  </alias>
</aliases>


'etr' enables all triggers in your world file and all your plugins, 'dtr' - disables them all.
[Go to top] top

Posted by Qwilleran   (3 posts)  [Biography] bio
Date Reply #2 on Wed 07 Apr 2004 07:45 PM (UTC)
Message
Error number: -2146828275
Event: Execution of line 14 column 4
Description: Type mismatch: 'World.EnablePlugin'
Line in error:

Called by: Immediate execution
[Go to top] top

Posted by Qwilleran   (3 posts)  [Biography] bio
Date Reply #3 on Wed 07 Apr 2004 08:01 PM (UTC)
Message
I got it figured out, there's an extra comma after the World.EnablePlugin in the second half of the script. Thanks guys! Works just like I wanted
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #4 on Wed 07 Apr 2004 10:22 PM (UTC)
Message
erm, Ked, nice work and all, but cant you just disable the "enable triggers" option?

world.SetOption "enable_triggers", 1

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #5 on Wed 07 Apr 2004 10:50 PM (UTC)
Message
you can? Then I was looking in the wrong place. That would be certainly a whole lot simpler and less messy. Just testing that thing above caused me a serious headache with disabling the triggers that have no business being enabled most of the time.
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #6 on Wed 07 Apr 2004 10:56 PM (UTC)

Amended on Wed 07 Apr 2004 11:03 PM (UTC) by Nick Gammon

Message
Ok, pardon my sudden bout of idiocy then. Here's the right way to do it:


<aliases>
  <alias
   name="trigger_controller"
   match="^(etr|dtr)$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>if "%1" = "etr" then
 world.SetOption "enable_triggers", 1
 world.Note "Triggers enabled"
elseif "%1" = "dtr" then
 world.SetOption "enable_triggers", 0
 world.Note "Triggers disabled"
end if</send>
  </alias>
</aliases>
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Wed 07 Apr 2004 11:05 PM (UTC)
Message
Yes, that is the way, although I would have used two aliases. Seems messy to me to have an alias that matches two completely different words, then inside have an "if test" that works out which word it matched, and do different things.

A slightly nicer approach would probably be to put the target triggers into a trigger group, and then enable/disable the group. The technique of disabling *all* triggers is a bit brute force for me.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #8 on Thu 08 Apr 2004 05:39 AM (UTC)
Message
On the first point - I actually prefer doing it this way. The more aliases I have, through more of them I have to browse so having just one instead of two makes life easier. The aliases are actually a switch, like "trigs (on|off)" but since I actually know what Qwilleran needs that alias for, an on|off switch is too large to type - etr|dtr is a simpler combination. Rapture people... :)

On the second point - I find this to be messy as well and would never do it that way myself. It's another one of those weird Zmud techniques that have been around forever in Achaea, which is why everyone seems to use them. But what the hell - it works.
[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.


5,769 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 FutureQuest]