Pause/Unpause all triggers with 1 alias

Posted by Gymosphere on Thu 01 Jan 2009 10:11 AM — 8 posts, 35,462 views.

#0
I have many triggers with many groups. Some are without groups. Some groups are enabled, some groups are disabled.

I know I can enable/disable a group.

But how do I pause the whole trigger list, and when unpause, it will go back to the state before I pause?

Something similar to clicking trigger, and then check/uncheck the "enable triggers' checkbox. Just that, I need to make an alias to do the same thing.

Is there a way to do that?
Australia Forum Administrator #1
To disable all triggers:


<aliases>
  <alias
   match="dt"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
SetOption ("enable_triggers", 0)
Note ("Triggers disabled.")
</send>
  </alias>
</aliases>


To enable them again, as they were:


<aliases>
  <alias
   match="et"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
SetOption ("enable_triggers", 1)
Note ("Triggers enabled.")
</send>
  </alias>
</aliases>


To use the above, see: http://mushclient.com/pasting

These assume scripting is active, and Lua is the scripting language. However other scripting languages would look very similar.
Amended on Thu 01 Jan 2009 07:25 PM by Nick Gammon
USA #2
The requested one alias...


<aliases>
  <alias
   match="tt"
   name="ToggleTriggers"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
SetOption ("enable_triggers", (GetOption("enable_triggers")+1)%%2)
Note ("Triggers are enabled: " .. tostring(GetOption("enable_triggers") == 1))
</send>
  </alias>
</aliases>
Amended on Fri 02 Jan 2009 01:33 AM by WillFa
#3
Great one! Thank you for the best support on the net!
#4
How would you do the same for disabling aliases? As I find myself having to do this occassionally on my mud for certain quests/areas?
Australia Forum Administrator #5
Clearly you can't make an alias to enable aliases as it wouldn't fire.

I have taken Willfa's idea of a single toggling alias, and turned it into an accelerator key. You could change the keystroke easily enough. Since this doesn't rely upon aliases being active, it will toggle aliases on or off.


AcceleratorTo ("Ctrl+Alt+A", [[
SetOption ("enable_aliases", math.fmod (GetOption ("enable_aliases") + 1, 2))
Note ("Aliases are enabled: " .. tostring (GetOption ("enable_aliases") == 1))
]], sendto.script)


The only problem is that accelerators are not saved in the world file, so you really need to do this every time the world loads.

Simply making a script file, and putting that in it, should do the trick - as that would be executed every time the script file loads.
#6
Erm sorry Nick, I meant to disable aliases. Or does the same thing apply? I'm guessing not.
USA #7
Yup, that's what that does. Nick's point was that you can't have an alias to enable the disabled alises, because the enable aliases alias is disabled with all the other aliases. :) So he basically gave you a macro/accelerator that does it.

To make the setting "stick" tho, you'd need to put that code into a script file. Hit CTRL+SHIFT+6, and make sure there's a script file specified. Click the "New..." button if one's not. After clicking OK out of that dialog box, Hit CTRL+SHIFT+H, paste the code in. Save. You should be prompted to reload the script file, but if no, hit CTRL+SHIFT+R.


After that, CTRL+ALT+A will toggle aliases on and off.

That help?