Advertisement
peptide

Dez Sign - Main

May 9th, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. side = "back" --This is the side of the monitor
  2.  
  3. mon = peripheral.wrap(side)
  4. mon.clear()
  5. mon.setTextScale(3)
  6.  
  7. if fs.exists("DezSignData") == false then
  8.   print("Settings not found. Loading Editor")
  9.   shell.run("Edit")
  10. end
  11.  
  12. file = fs.open("DezSignData", "r")
  13. local Day = tonumber(file.readLine())
  14. local Record = tonumber(file.readLine())
  15. file.close()
  16.  
  17. mon.setCursorPos(1,1)
  18. mon.write("Welcome to Dez Corp.")
  19.  
  20. mon.setCursorPos(1,3)
  21. mon.write("Your safety is important")
  22. mon.setCursorPos(1,4)
  23. mon.write("         to us.")
  24.  
  25.  
  26. mon.setCursorPos(1,6)
  27. mon.write("Days since last")
  28.  
  29. mon.setCursorPos(1,9)
  30. mon.write("Previous Record : " .. Record .. " Days")
  31.  
  32. local DoneAdd = false
  33. while true do
  34.     if (os.time() < 0.200) then
  35.         if (DoneAdd == false) then
  36.             Day = Day + 1
  37.             file = fs.open("DezSignData", "w")
  38.             file.writeLine(tostring(Day))
  39.             file.writeLine(tostring(Record))
  40.             file.close()
  41.             DoneAdd = true
  42.         end
  43.     else
  44.         DoneAdd = false
  45.     end
  46.     mon.setCursorPos(1,7)
  47.     mon.write("Nuclear Meltdown : " .. Day)
  48.          os.sleep(1)
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement