Posted 03 February 2015 - 12:02 AM
Hi Everyone,
I am having some trouble trying to figue out somethings….
Here is the code:
So basicly when you click in the area of the [ON] or [OFF] it either turns on or off the redstone signal
I would like to make it so it can automaticly find the xPos and yPos of the [ON] when i create it. So i dont have to guess he xPos myself every time i create a new ON or OFF button.
I am having some trouble trying to figue out somethings….
Here is the code:
term.clear()
term.setCursorPos(1,1)
isWhiteOn="OFF"
isOrangeOn="OFF"
while true do
term.clear()
term.setCursorPos(1,1)
print("Toggle white light. [".. isWhiteOn .."]")
print("Toggle orange light. [".. isOrangeOn .."]")
local event, button, xPos, yPos = os.pullEvent("mouse_click")
if xPos >= 20 and xPos <= 23 and yPos == 1 then
if rs.testBundledInput("back", 1) == false then
rs.setBundledOutput("back", 1)
isWhiteOn="ON"
isOrangeOn="OFF"
else
rs.setBundledOutput("back", 0)
isWhiteOn="OFF"
end
elseif xPos >= 22 and xPos <= 25 and yPos == 2 then
if rs.testBundledInput("back", 2) == false then
rs.setBundledOutput("back", 2)
isWhiteOn="OFF"
isOrangeOn="ON"
else
rs.setBundledOutput("back", 0)
isOrangeOn="OFF"
end
end
end
So basicly when you click in the area of the [ON] or [OFF] it either turns on or off the redstone signal
I would like to make it so it can automaticly find the xPos and yPos of the [ON] when i create it. So i dont have to guess he xPos myself every time i create a new ON or OFF button.
Edited on 02 February 2015 - 11:05 PM