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 ➜ Easily Enabling/Disabling Triggers

Easily Enabling/Disabling Triggers

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


Posted by Qwilleran   (3 posts)  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?
Top

Posted by Ked   Russia  (524 posts)  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.
Top

Posted by Qwilleran   (3 posts)  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
Top

Posted by Qwilleran   (3 posts)  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
Top

Posted by Flannel   USA  (1,230 posts)  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.
Top

Posted by Ked   Russia  (524 posts)  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.
Top

Posted by Ked   Russia  (524 posts)  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>
Top

Posted by Nick Gammon   Australia  (23,133 posts)  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
Top

Posted by Ked   Russia  (524 posts)  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.
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.


23,604 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.