Re: Script: Make Multiple Buttons/Levers
Posted: Thu Jan 11, 2018 4:46 pm
The script (at least the copy I have) connects all generated buttons to its own buttonPress() function; where the logic there determines what to do with each press. You can wrap a condition around all logic in buttonPress(), to have it simply do nothing. The buttons can still be pressed, but none trigger the door.
Example: —Replacement buttonPress()—
Example: —Replacement buttonPress()—
Code: Select all
activeButtons = true
function buttonPress(my)
if activeButtons then
--=|-------------------- Compare/or replace with your script's button logic, if different ---
local pushed = tonumber(string.sub(my.go.id, string.len(my.go.id) - 1))
local buttonAction = { [12] = function() script_A.script.myFunc(pushed) end,
[22] = function() script_B.script.myFunc(pushed) end,
[32] = function() script_C.script.myFunc(pushed) end,
}
buttonAction[pushed]()
--=|-----------------------------------------------------------------------------------------
end
end
function setActive(bool) --call with false, when you break/disable the door.
if type(bool) == "boolean" then
activeButtons = bool
end
end