Hi everybody i was working on a program and i just get stuck every time i try something
i wanted a program with multiple usernames and passwords in total 2 usernames and 2 passwords, but i cant get it working,
i put the code in if somebody want to look at it then it would be awesome
local component=require("component")
local r=component.redstone
local gpu=component.gpu
local term=require("term")
local text=require("text")
local computer=require("computer")
local os=require("os")
---- config section
local badgenumber="001"
local password="reserve"
local delay=1 --time the door stays open
local side=5 --side of the door, test this
-----
local wrong=false
while true do
term.clear()
gpu.set(1,1,"Unity City Federal Reserve")
term.setCursor(1,2)
gpu.set(1,3,"Please enter badgenumber")
if wrong then
gpu.set(1,1,"Unity City Federal Reserve")
term.setCursor(1,2)
gpu.set(1,3,"Please enter badgenumber")
wrong=false
end
term.setCursor(24,3)
else
term.clear()
gpu.set(1,1,"Unity City Federal Reserve")
term.setCursor(1,2)
gpu.set(1,3,"Please enter password")
if wrong then
gpu.set(1,1,"Unity City Federal Reserve")
term.setCursor(1,2)
gpu.set(1,3,"Please enter password")
wrong=false
end
term.setCursor(24,3)
input = text.trim(term.read(nil, false, nil, "*"))
if input==password then
r.setOutput(side,15) -- check if this is the correct function
os.sleep(delay)
if input==password then
r.setOutput(side,0) -- same here
else
term.clear()
gpu.set(1,1, "Unity City Federal Reserve")
gpu.set(1,3, "Acces Denied")
os.sleep(delay)
computer.shutdown(true)
end
end
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Hi everybody i was working on a program and i just get stuck every time i try something
i wanted a program with multiple usernames and passwords in total 2 usernames and 2 passwords, but i cant get it working,
i put the code in if somebody want to look at it then it would be awesome
local component=require("component") local r=component.redstone local gpu=component.gpu local term=require("term") local text=require("text") local computer=require("computer") local os=require("os") ---- config section local badgenumber="001" local password="reserve" local delay=1 --time the door stays open local side=5 --side of the door, test this ----- local wrong=false while true do term.clear() gpu.set(1,1,"Unity City Federal Reserve") term.setCursor(1,2) gpu.set(1,3,"Please enter badgenumber") if wrong then gpu.set(1,1,"Unity City Federal Reserve") term.setCursor(1,2) gpu.set(1,3,"Please enter badgenumber") wrong=false end term.setCursor(24,3) else term.clear() gpu.set(1,1,"Unity City Federal Reserve") term.setCursor(1,2) gpu.set(1,3,"Please enter password") if wrong then gpu.set(1,1,"Unity City Federal Reserve") term.setCursor(1,2) gpu.set(1,3,"Please enter password") wrong=false end term.setCursor(24,3) input = text.trim(term.read(nil, false, nil, "*")) if input==password then r.setOutput(side,15) -- check if this is the correct function os.sleep(delay) if input==password then r.setOutput(side,0) -- same here else term.clear() gpu.set(1,1, "Unity City Federal Reserve") gpu.set(1,3, "Acces Denied") os.sleep(delay) computer.shutdown(true) end endLink to post
Share on other sites