Creating a macro to disable all triggers

Posted by Dina on Tue 28 Nov 2017 12:48 AM — 4 posts, 18,577 views.

#0
i'm very sorry if this has already been discussed, i'm completely new to this and i've searched the forums and tested out a few things but failed every time.
i want to create a macro (alt+something whatever) to simpy disable all triggers instantly, is that possible?
if so, how should i do it?
Australia Forum Administrator #1
If you look at the Triggers configuration dialog (where they are all listed) there is a checkbox "Enable Triggers". You can turn that on or off in a script. I assume you are using Lua scripting (the default).

First make a couple of aliases, one to disable all triggers, and one to enable them again, like this:


<aliases>

  <alias
   match="disable_all_triggers"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
SetOption ("enable_triggers", false)
ColourNote ("red", "", "Triggers disabled.")
</send>
  </alias>

  <alias
   match="enable_all_triggers"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
SetOption ("enable_triggers", true)
ColourNote ("green", "", "Triggers enabled.")
</send>
  </alias>

</aliases>



Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


Now use the Macros configuration to make a certain couple of macro keys call these aliases. For example make F7 send "disable_all_triggers" and F8 send "enable_all_triggers".

Now when you hit those keys the macro sends that word, which is picked up by the command processor, which then calls the alias, which calls the script. The confirmation message (which you can omit) tells you what has happened.
#2
Hi, and thank you for the quick and clear answer, is succesfully made it work and it was easy even with my no-coding experience.

I am now trying a new thing : making a chat redirector. i am playing hellmoo, and found this http://hellmoo.org/wiki/index.php/Triggers
it appears you have already made one. i followed your steps, saved it in .xml as ChatRedirector.xml in my plugins folder, and tried adding and enabling it. sadly it doesn't seem to be working, the plugin is enabled but nothing changes. by trying and failing a few times, it seems i have to create a world first for the chat to be redirected in, is that correct?
Australia Forum Administrator #3
This is really a new question isn't it?

In that plugin there is a line:


chat_world = "hellmoo_Chat"


So for that to work you need to have made another world called "hellmoo_Chat" and set its IP address to 0.0.0.0.

However that plugin is 10 years old. There are more recent ones that redirect to a miniwindow, which saves you having to have new worlds open. I think this is the latest thread about it:

http://www.gammon.com.au/forum/?id=12855

You would however need to adjust the triggers in it to match what comes from your MUD. The page you linked has some example triggers, and the page I mention above says:


--[[
Call this plugin by making as many triggers as you want in your main
  world file (or other plugins) and then passing the style runs to this 
  plugin like this:
--]]

function chattrigger (name, line, wildcards, styles)
    require "serialize"
    check (CallPlugin ("10778718503f0c91106745f5", 
                       "display", serialize.save_simple (styles)))
  end -- chattrigger


So you basically use the triggers from your page, but change them to call the script above and it should work. In fact if you rename that function "chattrigger" to "redirect" then the work should be minimal.