LSLCNR

Untitled

Nov 12th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 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, color, backCol)
  30. term.setCursorPos(x, y)
  31. term.blit(text, color, backCol)
  32. end
  33.  
  34. function Print(text, x, y)
  35. term.setCursorPos(x, y)
  36. term.write(text)
  37. end
  38.  
  39. function getCenterX(text)
  40. local x,_ = term.getSize()
  41. return math.floor((x / 2) - (string.len(text) / 2))
  42. end
  43.  
  44. function startup()
  45. curFuncScreen = startup
  46. resetScreen()
  47. Print(" Stargate Control Program ", getCenterX(" Stargate Control Program "), 2, colors.black, colors.white)
  48. end
  49.  
  50. function awaitEvent()
  51. event, p1, p2, p3 = os.pullEvent()
  52. end
  53.  
  54. startup()
  55.  
  56. while true do
  57. awaitEvent()
  58. curFuncScreen()
  59. end
Advertisement
Add Comment
Please, Sign In to add comment