Posted 17 November 2013 - 03:33 PM
So I have a monitor on the back side of the computer. It displays if users can enter my house or not. There is a button to the right of the computer, and I want it to toggle whether the monitor says if you can enter or not. No matter what I set x to, the monitor always prints the nopass function. Also, is there a way I could save and load the variable to the computer so the chunk will not have to be loaded all the time? I'm noobish sorry.Thanks in advance!
local m = peripheral.wrap("back")
local function pass()
m.clear()
m.setBackgroundColor(8192)
m.setTextScale(1)
m.setCursorPos(1,1)
m.write("You may")
m.setCursorPos(1,2)
m.write(" enter ")
m.setCursorPos(1,3)
m.setTextColor(32)
m.write("WITHOUT ")
m.setTextColor(1)
m.setCursorPos(1,4)
m.write(" perms! ")
m.setCursorPos(1,5)
m.write(" ")
x = 2
end
local function nopass()
m.clear()
m.setBackgroundColor(16384)
m.setTextScale(1)
m.setCursorPos(1,1)
m.write("You may")
m.setCursorPos(1,2)
m.write(" enter ")
m.setCursorPos(1,3)
m.setTextColor(32)
m.write("WITH ")
m.setTextColor(1)
m.setCursorPos(1,4)
m.write(" perms! ")
m.setCursorPos(1,5)
m.write(" ")
sleep(5)
x = 1
end
x = 1
while true do
while not redstone.getInput("right",true) do
sleep(.5)
end
if x == 1 then
pass()
else
nopass()
end
end
local m = peripheral.wrap("back")
local function pass()
m.clear()
m.setBackgroundColor(8192)
m.setTextScale(1)
m.setCursorPos(1,1)
m.write("You may")
m.setCursorPos(1,2)
m.write(" enter ")
m.setCursorPos(1,3)
m.setTextColor(32)
m.write("WITHOUT ")
m.setTextColor(1)
m.setCursorPos(1,4)
m.write(" perms! ")
m.setCursorPos(1,5)
m.write(" ")
x = 2
end
local function nopass()
m.clear()
m.setBackgroundColor(16384)
m.setTextScale(1)
m.setCursorPos(1,1)
m.write("You may")
m.setCursorPos(1,2)
m.write(" enter ")
m.setCursorPos(1,3)
m.setTextColor(32)
m.write("WITH ")
m.setTextColor(1)
m.setCursorPos(1,4)
m.write(" perms! ")
m.setCursorPos(1,5)
m.write(" ")
sleep(5)
x = 1
end
x = 1
while true do
while not redstone.getInput("right",true) do
sleep(.5)
end
if x == 1 then
pass()
else
nopass()
end
end