binding a key

Post Reply
mattness
Posts: 17
Joined: Sat May 19, 2012 8:34 pm

binding a key

Post by mattness »

Can you bind a key to turn a trigger or multiple triggers on and off?

I assume the same thing could be applied to a trigger.

User avatar
kevutian
Posts: 217
Joined: Fri Aug 20, 2010 8:18 pm
Location: United Kingdom
Contact:

Re: binding a key

Post by kevutian »

We have disableTrigger() for this. The function works for both single triggers and trigger folders.

User avatar
demonnic
Posts: 886
Joined: Sat Dec 05, 2009 3:19 pm

Re: binding a key

Post by demonnic »

Something like the below might work. I wrote this here on the forums, may want to check for typos/insanity.
Code: [show] | [select all] lua
--in a script object
toggler = toggler or {}
if toggler.on == nil then toggler.on = false end
if not toggler.on then disableTrigger("ThatOne") else enableTrigger("ThatOne") end

--in the keybinding

if toggler.on then
  disableTrigger("ThatOne")
  toggler.on = false
else
  enableTrigger("ThatOne")
  toggler.on = true
end

Post Reply