DustinRosebery

Untitled

Aug 26th, 2013
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. m = peripheral.wrap("left")
  2. mBack = peripheral.wrap("back")
  3.  
  4. local running = true
  5.  
  6. local function grnButton()
  7. m.clear()
  8. m.setBackgroundColor(colors.black)
  9. m.setTextScale(1)
  10. m.setTextColor(colors.lime)
  11. m.setCursorPos(14,2)
  12. m.write("Congrats!")
  13. m.setCursorPos(10,4)
  14. m.setTextColor(colors.white)
  15. m.write("Once you select the #Withers")
  16. m.setCursorPos(9,5)
  17. m.write("Just wait for Monitor to flash GO!")
  18. m.setCursorPos(11,6)
  19. m.write("and jump down to the left")
  20. m.setCursorPos(13,7)
  21. m.write("Good Luck")
  22. end
  23.  
  24. local function redButton()
  25. m.clear()
  26. m.setTextScale(5)
  27. m.setCursorPos(2,2)
  28. m.setTextColor(colors.red)
  29. m.write("LOSER")
  30. os.sleep(10)
  31. os.reboot()
  32. end
  33.  
  34. local redGrnButtons ={
  35. [1] = {buttonType = 1, startX = 10, endX = 20, startY = 12, endY = 16, buttonText = "GO!", command = grnButton},
  36. [2] = {buttonType = 1, startX = 30, endX = 40, startY = 12, endY = 16, buttonText = "NO", command = redButton}
  37. }
  38.  
  39.  
  40. local function buttonMenu(table)
  41. for k,v in ipairs(table) do
  42. m.setCursorPos(table[k].startX, table[k].startY)
  43. end
  44. while running do
  45. for k,v in ipairs(table) do
  46. event, button, x, y = os.pullEvent()
  47. if event == "monitor_touch" then
  48. if x >= table[k].startX and x <= table[k].endX and y >= table[k].startY and y <= table[k].endY then
  49. table[k].command()
  50. end
  51. end
  52. end
  53. end
  54. m.clear()
  55. end
  56.  
  57.  
  58. local function WelcomeScreen()
  59. m.clear()
  60. m.setBackgroundColor(colors.black)
  61. m.setTextScale(4)
  62. m.setCursorPos(0,1)
  63. m.setTextColor(colors.lime)
  64. m.write(" Welcome")
  65. m.setCursorPos(5,3)
  66. m.setTextColor(colors.yellow)
  67. m.write("to the")
  68. m.setCursorPos(8,5)
  69. m.setTextColor(colors.red)
  70. m.write("ARENA!")
  71. end
  72.  
  73. local function screenTwo()
  74. m.clear()
  75. m.setBackgroundColor(colors.black)
  76. m.setTextScale(1)
  77. m.setCursorPos(9,1)
  78. m.setTextColor(colors.white)
  79. m.write("Welcome to HDbag's Wither Arena!!!")
  80. m.setCursorPos(4,2)
  81. m.write("Co-Hosting IPJ and the boss of the underworld")
  82. m.setCursorPos(8,5)
  83. m.write("simply push the green button to start")
  84. m.setCursorPos(11,6)
  85. m.write("Or push the red button to stop")
  86. m.setCursorPos(1,8)
  87. m.write("Work In Progress - - - Owners not held responsible")
  88. m.setBackgroundColor(colors.lime)
  89. for x = 10, 20 do
  90. for y = 12, 16 do
  91. m.setCursorPos(x, y)
  92. m.write(" ")
  93. end
  94. end
  95. m.setBackgroundColor(colors.red)
  96. for x = 30, 40 do
  97. for y = 12, 16 do
  98. m.setCursorPos(x, y)
  99. m.write(" ")
  100. end
  101. end
  102. end
  103.  
  104. -- end of functions list
  105.  
  106. m.clear()
  107. WelcomeScreen()
  108. os.sleep(1.5)
  109.  
  110. local event = (os.pullEvent())
  111. if event == "monitor_touch" then
  112. screenTwo()
  113. buttonMenu(redGrnButtons)
  114. end
Advertisement
Add Comment
Please, Sign In to add comment