Posted 20 October 2012 - 07:43 PM
Hello Computercraft community.
My problem is, that when I add os.pullEvent() to my options screen the computer is waiting for response and screen is not refreshing.(Without os.pullEvent it works fine.)
I want to make time that keep refreshing and computer waiting for response at the same time, so is that possibe?
Here is the code. I didn't include os.pullEvent in the code so you could tell me where should I put it, or how?
Sorry for my poor English, but I hope you'll understand.
Thank you.
My problem is, that when I add os.pullEvent() to my options screen the computer is waiting for response and screen is not refreshing.(Without os.pullEvent it works fine.)
I want to make time that keep refreshing and computer waiting for response at the same time, so is that possibe?
Here is the code. I didn't include os.pullEvent in the code so you could tell me where should I put it, or how?
Spoiler
id = os.computerID()
pass = "gta"
function access()
term.restore()
term.clear()
term.setCursorPos(1,1)
print("Enter the password")
write("Password:")
input = read("*")
if input == pass then
term.setCursorPos(1,4)
textutils.slowPrint("Password is correct")
sleep(0.7)
term.clear()
term.setCursorPos(1,1)
error()
else
term.setCursorPos(1,4)
textutils.slowPrint("Password is incorrect")
sleep(2)
os.reboot()
end
end
mon = peripheral.wrap("left")
term.redirect(mon)
term.clear()
term.setCursorPos(1,1)
while true do
local time = os.time()
time = textutils.formatTime(time, true)
print[[ Exploder's House
Options:
1.Access Computer.]]
term.setCursorPos(1,10) print("Computer ID:"..id.."") term.setCursorPos(26,10) print("Time "..time) --Here is the time that should keep refreshing.
sleep(0.5) -- Here is the part that refreshes screen every half a second.
term.clear()
term.setCursorPos(1,1)
end
Sorry for my poor English, but I hope you'll understand.
Thank you.