Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- password = "1234"
- rednet.open("back")
- doorName = "ThaumcraftDoor"
- monitorSide = "top"
- local Args = {...}
- if Args[1] == "update" then
- programName = shell.getRunningProgram()
- print("Updating.")
- fs.delete( programName )
- shell.run( "pastebin","get", "Gu2VWmBy", programName )
- print("Finished updating.")
- error()
- end
- if not fs.exists( "fui" ) then
- print( "Performing first time setup." )
- shell.run( "pastebin","get", "306Ns1qg", "fui" )
- print("Finished. Please run program again.")
- error()
- end
- read = ""
- os.loadAPI("fui")
- fui.setMonitorSide( monitorSide )
- os.sleep(1)
- w,h = fui.getSize()
- w = w + 1
- h = h + 1
- function drawScreen()
- fui.clear()
- fui.drawButton( " ", " ", 1, 8, 1, 6 , "black", "white" )
- fui.drawButton( " ", "1", 2, 2, 2, 1 , "black", "gray" )
- fui.drawButton( " ", "2", 5, 2, 2, 1 , "black", "gray" )
- fui.drawButton( " ", "3", 2, 2, 4, 1 , "black", "gray" )
- fui.drawButton( " ", "4", 5, 2, 4, 1 , "black", "gray" )
- end
- function checkPassword()
- if #read > 3 then
- if read == password then
- fui.drawButton( " ", " ", 2, 5, 2, 3 , "black", "lime" )
- msg = { [1]=doorName, [2]="toggle" }
- rednet.broadcast(textutils.serialize(msg))
- os.sleep(2)
- drawScreen()
- else
- fui.drawButton( " ", " ", 2, 5, 2, 3 , "black", "red" )
- os.sleep(2)
- drawScreen()
- end
- read = ""
- end
- end
- drawScreen()
- while true do
- fui.submitEvents()
- lastEvent = fui.getEvents()
- if fui.buttonPressed("1") and string.find( read, "1" ) == nil then
- fui.drawButton( " ", "1", 2, 2, 2, 1 , "black", "lightgray" )
- read = read.."1"
- checkPassword()
- elseif fui.buttonPressed("2") and string.find( read, "2" ) == nil then
- fui.drawButton( " ", "2", 5, 2, 2, 1 , "black", "lightgray" )
- read = read.."2"
- checkPassword()
- elseif fui.buttonPressed("3") and string.find( read, "3" ) == nil then
- fui.drawButton( " ", "3", 2, 2, 4, 1 , "black", "lightgray" )
- read = read.."3"
- checkPassword()
- elseif fui.buttonPressed("4") and string.find( read, "4" ) == nil then
- fui.drawButton( " ", "4", 5, 2, 4, 1 , "black", "lightgray" )
- read = read.."4"
- checkPassword()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment