controlling triggers from the world command line

Posted by Mork451 on Wed 06 Aug 2003 08:22 PM — 7 posts, 23,914 views.

USA #0
Call me hopeless, but I can't seem to get a handle on how to turn a trigger on or off from the mushclient world command line. For instance, I have a trigger labelled 'loot'. There are times I need to disable it FAST...i.e., no time to open the menu with a right-click, select triggers, scroll down to the right trigger, etc....you get the picture. What exactly must I type on the command line to disable (not delete) that specific trigger?
Australia Forum Administrator #1
To do it without any preparation, and assuming scripting is active, do this:


/world.enabletrigger "loot", 0


However you will probably say that is too much typing. So, make an alias "lootoff" and another called "looton", like this:


<aliases>
  <alias
   match="lootoff"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>enabletrigger "loot", 0
note "** looting off **"</send>
  </alias>

  <alias
   match="looton"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>enabletrigger "loot", 1
note "** looting ON **"</send>
  </alias>
</aliases>


USA #2
Thanks, I got all of that except the 'send_to: "12"' part
Australia Forum Administrator #3
You can just copy between the lines, go into alias configuration and hit the paste button. No typing needed. However, the "send to 12" means "send to script".
USA #4
Ah, got it...thanks! Its working! :)


John
#5
Okay, so what about for those of us who can't script worth a darn but have set up an intricate system of aliases/triggers? I would love to be able to toggle triggers off and on from the command prompt but am kind of unwilling to learn how to write scripts to do it. Is there a way?
Australia Forum Administrator #6
It isn't that hard to do one-line scripts, however the aliases below will do it for you. Copy from between the lines, go into the alias configuration screen, and click the "paste" button.



<aliases>
  <alias
   match="trigoff *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>if enabletrigger ("%1", 0) = 0 then
  colournote "white", "green", "Trigger %1 now OFF"
else
  colournote "white", "red", "Trigger %1 does not exist"
end if</send>
  </alias>
  <alias
   match="trigon *"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>if enabletrigger ("%1", 1) = 0 then
  colournote "white", "green", "Trigger %1 now on"
else
  colournote "white", "red", "Trigger %1 does not exist"
end if</send>
  </alias>
</aliases>



This will give you two aliases "trigon" and "trigoff". You would use them like this:

trigon attack
trigoff eat

That is, you type "trigon" (trigger on) followed by the name of the trigger you want to turn on, and "trigoff" (trigger off) followed by the name of the trigger you want to turn off.

You will get a message echoed on your screen telling you whether or not the trigger is now on or off, or if it does not exist.

To make this work, the triggers that you are turning on and off must have a label (name) which you put in the "label" box for each one.