Advertisement
Guest User

money.lua

a guest
May 10th, 2024
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | None | 0 0
  1. peripheral.find("modem", rednet.open)
  2.  
  3. local monitor = peripheral.find("monitor")
  4.  
  5. monitor.setCursorPos(1,1)
  6.  
  7. function check_if_disk()
  8.     if disk.isPresent("bottom") == true then
  9.         if disk.hasData("bottom") == true then
  10.             print("has data")  
  11.             return true      
  12.         elseif disk.hasData("bottom") == false then
  13.             monitor.clear()
  14.             monitor.write("Plese insert correct disk")
  15.         end
  16.     elseif disk.isPresent("bottom") == false then
  17.         monitor.clear()
  18.         monitor.write("Please insert disk")
  19.     end
  20. end
  21.  
  22. function conformation(N)
  23.     local event, side, x, y = os.pullEvent("monitor_touch")
  24.     print("The monitor on side " .. side .. " was touched at (" .. x .. ", " .. y .. ")")
  25.     if y == N then
  26.         print("yes")
  27.         return true
  28.     else
  29.         print("mo")
  30.         return false
  31.     end
  32. end
  33.  
  34. function get_disk_data()
  35.     if check_if_disk() == true then
  36.         local file = fs.open("disk/data.lua", "r")
  37.         print(file)
  38.         if file == nil then
  39.             local Num = 3
  40.             monitor.write("no data")
  41.             monitor.setCursorPos(1,2)
  42.             monitor.write("Create account?")
  43.             monitor.setCursorPos(1,3)
  44.             monitor.write("YES")
  45.             conformation(Num)
  46.             if conformation() == true then
  47.                
  48.             elseif conformation() == false then
  49.                
  50.             end
  51.         else
  52.             print("has data")
  53.         end
  54.     end
  55. end
  56.  
  57. get_disk_data()
  58.  
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement