MarsP4ste

readyScreen--Terminal

Jun 19th, 2021
631
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local event = require("event")
  2. local term = require("term")
  3. local shell = require("shell")
  4. local sizeX, sizeY, sizeXO, sizeYO, sizeXR, sizeYR = term.getViewport()
  5. local gpu = term.gpu()
  6. local ready = true
  7. term.setCursorBlink(false)
  8.  
  9.  
  10. function clearScreen()
  11.   gpu.setBackground(0x365991, false)
  12.   term.clear()
  13.   term.setCursor(1,1)
  14. end
  15.  
  16. function writeText(n)
  17.   local text = "This Terminal is ready for usage"
  18.   local text2 = "Hit the screen to begin"
  19.   if n ~= 3 then
  20.     if n == 1 then
  21.       text2 = "Welcome"
  22.     end
  23.  
  24.     len1 = string.len(text)/2
  25.     len2 = string.len(text2)/2
  26.  
  27.     term.setCursor(sizeX/2-len1,sizeY/2-1)
  28.     print(text)
  29.  
  30.     term.setCursor(sizeX/2-len2,sizeY/2+1)
  31.     print(text2)
  32.   else
  33.     text = "There is a problem with this Terminal"
  34.     text2 = "Please inform the bank staff"
  35.     len1 = sizeX/2-string.len(text)/2
  36.     len2 = sizeX/2-string.len(text2)/2
  37.    
  38.     setCursor(len1,sizeY/2-1)
  39.     print(text)
  40.     setCursor(len2,sizeY/2+1)
  41.     print(text2)
  42.   end
  43. end
  44.  
  45.  
  46. ---Execute programm
  47. clearScreen()
  48. writeText(0)
  49. while (true) do --wait for an Input from a user to start the ATM program
  50.   local _,_,x,y,_,n = event.pull("touch")
  51.   if x == 1 and y == 1 then
  52.     shell.execute("reboot")
  53.   else
  54.     break
  55.   end
  56. end
  57. clearScreen()
  58. writeText(1)
  59. os.sleep(1)
  60. shell.execute("/home/selectMainProgram.lua")
RAW Paste Data