Advertisement
DustinRosebery

Dtest

Aug 25th, 2013
2,385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. m = peripheral.wrap("left")
  2.  
  3. local running = true
  4.  
  5. local function grnButton()
  6.  m,clear()
  7.  m.setTextScale(5)
  8.  m.write("DO IT!")
  9. end
  10.  
  11. local function redButton()
  12.  m.clear()
  13.  m.setTextScale(5)
  14.  m.setCursorPos(1,2)
  15.  m.setTextColor(colors.red)
  16.  m.write("LOSER")
  17. end
  18.  
  19. local redGrnButtons ={
  20.  [1] = {buttonType = 1, startX = 10, endX = 20, startY = 12, endY = 16, buttonText = "GO!", command = grnButton},
  21.  [2] = {buttonType = 1, startX = 30, endX = 40, startY = 12, endY = 16, buttonText = "NO", command = redButton}
  22. }
  23.  
  24. local function buttonMenu(table)
  25.  for k,v in ipairs(table) do
  26.   m.setCursorPos(table[k].startX, table[k].startY
  27.  end
  28.  while running do
  29.   for k,v in ipairs(table) do
  30.    event, button, x, y = os.pullevent
  31.    if event == "monitor_touch" then
  32.     if button = table[k].buttonType then
  33.      if x >= table[k].startX and x <= table[k].endX and y >= table[k].startY and y <= table[k].endY then
  34.       table[k].command()
  35.      end
  36.     end
  37.    end
  38.   end
  39.  end
  40.  m.clear()
  41. end
  42.  
  43.  
  44. local function WelcomeScreen()
  45.   m.clear()
  46.   m.setTextScale(4)
  47.   m.setCursorPos(0,1)
  48.   m.setTextColor(colors.lime)
  49.   m.write(" Welcome")
  50.   m.setCursorPos(5,3)
  51.   m.setTextColor(colors.yellow)
  52.   m.write("to the")
  53.   m.setCursorPos(8,5)
  54.   m.setTextColor(colors.red)
  55.   m.write("ARENA!")
  56. end
  57.  
  58. local function screenTwo()
  59.   m.clear()
  60.   m.setTextScale(1)
  61.   m.setCursorPos(9,1)
  62.   m.setTextColor(colors.white)
  63.   m.write("Welcome to HDbag's Wither Arena!!!")
  64.   m.setCursorPos(4,2)
  65.   m.write("Co-Hosting IPJ and the boss of the underworld")
  66.   m.setCursorPos(8,5)
  67.   m.write("simply push the green button to start")
  68.   m.setCursorPos(11,6)
  69.   m.write("Or push the red button to stop")
  70.   m.setCursorPos(1,8)
  71.   m.write("Work In Progress - - - Owners not held responsible")
  72. end
  73.  
  74. -- end of functions list
  75.  
  76. WelcomeScreen()
  77. os.sleep(1.5)
  78.  
  79. local event = (os.pullEvent())
  80.   if event == "monitor_touch" then
  81.     screenTwo()
  82.     buttonMenu(redGrnButtons)
  83.   else
  84. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement