Advertisement
onwardprogress

mainloop

Dec 8th, 2015
997
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. --This is the mainloop file, it checks the disk drives for a floppy with the clearance program on it.
  2. os.pullEvent = os.pullEventRaw
  3. local access = 2
  4. local h = fs.open("/securityVariables", "r")
  5. local access = tonumber(h.readLine())
  6. h.close()
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. write("Current Access Level is set to: ")
  10. if access == 2 then
  11.     print("STRICT")
  12.     sleep(1)
  13. elseif access == 1 then
  14.     print("MODERATE")
  15.     sleep(1)
  16. elseif access == 0 then
  17.     print("NONE")
  18.     sleep(1)
  19. else
  20.     print("Something weird with access variable")
  21.     sleep(1)
  22. end
  23. print("Please put your access badge into the drive")
  24. sleep(1)
  25. local event, diskSide = os.pullEvent("disk")
  26. if event == "disk" then
  27.     shell.run("cd /disk")
  28.     shell.run("clearance")
  29. else
  30.     --do nothing
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement