Advertisement
LSLCNR

Untitled

Nov 12th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. local sg = peripheral.wrap("right")
  2.  
  3. local favAddresses = {
  4. {
  5. title = "",
  6. address = ""
  7. }
  8. }
  9.  
  10. local curFuncScreen = nil
  11.  
  12. local event, p1, p2, p3 = nil
  13.  
  14. function resetScreen()
  15. term.clear()
  16. term.setBackgroundColor(colors.gray)
  17. term.setTextColor(colors.black)
  18. term.setCursorPos(1, 1)
  19. end
  20.  
  21. function Print(text, x, y, color)
  22. local prevColor = term.getTextColor()
  23. term.setTextColor(color)
  24. term.setCursorPos(x, y)
  25. term.write(text)
  26. term.setTextColor(prevColor)
  27. end
  28.  
  29. function Print(text, x, y)
  30. term.setCursorPos(x, y)
  31. term.write(text)
  32. end
  33.  
  34. function getCenterX(text)
  35. local x,_ = term.getSize()
  36. return math.round((x / 2) - (string.len(text) / 2))
  37. end
  38.  
  39. function startup()
  40. curFuncScreen = startup
  41. resetScreen()
  42. Print("Stargate Control Program", getCenterX("Stargate Control Program"), 2)
  43. end
  44.  
  45. function awaitEvent()
  46. event, p1, p2, p3 = os.pullEvent()
  47. end
  48.  
  49. startup()
  50.  
  51. while true do
  52. awaitEvent()
  53. curFuncScreen()
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement