Advertisement
Guest User

card

a guest
Dec 12th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. --First time setup/load settings
  2. if not fs.exists("settings") then
  3.   --shell.run("pastebin", "get", "", "button")
  4.   data = {first = true, pin = " ", name = " "}
  5.   file = fs.open("settings", "w")
  6.   file.write(textutils.serialise(data))
  7.   file.close()
  8. else
  9.   file = fs.open("settings", "r")
  10.   data = textutils.unserialise(file.readAll())
  11.   file.close()
  12. end
  13.  
  14. --Variable declaration/apis
  15. shell.run("button")
  16. size = {x = 26, y = 20}
  17.  
  18. term.setBackgroundColor(colors.white)
  19. term.setTextColor(colors.black)
  20.  
  21. --Changes table button states
  22. function tState(_t, _s)
  23.   for _, button in pairs(_t) do
  24.     button:set("state", _s)
  25.   end
  26. end
  27.  
  28. --Create number pad buttons
  29. pinButtons = {}
  30. local i = 0
  31.   for _yy = 1, 3 do
  32.     for _xx = 0, 2 do
  33.     i = i + 1
  34.     pinButtons[i] = newButton((8 + (_xx * 3)), (11 + (_yy * 2)), 1, 1, tostring(i), "f", "0", (i + 1))
  35.   end
  36. end
  37. pinButtons[11] = newButton(11, 19, 1, 1, "0", "f", "0", 0)
  38. pinButtons[10] = newButton (8, 19, 1, 1, " ", "0", "d", "enter")
  39. pinButtons[12] = newButton (14, 19, 1, 1, " ", "0", "e", "back")
  40. tState(pinButtons, false)
  41.  
  42. function displayPad(header, _y)
  43.   term.clear()
  44.   term.setCursorPos(math.floor((size.x / 2) - (#header / 2)), _y)
  45.   term.write(header)
  46.   tState(pinButtons, true)
  47.   drawDummyButtons("t")
  48. end
  49.  
  50. --Account creation
  51. if data.first then
  52.   displayPad("hehe", 6)
  53.  
  54. --Normal Startup
  55. else
  56.  
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement