DustinRosebery

dtest4

Aug 26th, 2013
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. m = peripheral.wrap("left")
  2. mBack = peripheral.wrap("back")
  3.  
  4. local running = true
  5.  
  6. local function grnButton()
  7.  m.setBackgroundColor(colors.black)
  8.  m.clear()
  9.  m.setTextScale(1)
  10.  m.setTextColor(colors.lime)
  11.  m.setCursorPos(22,2)
  12.  m.write("Congrats!")
  13.  m.setCursorPos(11,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(12,6)
  19.  m.write("and jump down to the left")
  20.  m.setCursorPos(22,7)
  21.  m.write("Good Luck")
  22.  m.setBackgroundColor(colors.lime)
  23.    for x = 10, 20 do
  24.      for y = 12, 16 do
  25.        m.setCursorPos(x, y)
  26.        m.write(" ")
  27.      end
  28.    end
  29.   for k,v in ipairs(witherNum) do
  30.   m.setCursorPos(table[k].startX, table[k].startY)
  31.  end
  32.  while running do
  33.   for k,v in ipairs(witherNum) do
  34.    event, button, x, y = os.pullEvent()
  35.    if event == "monitor_touch" then
  36.     if x >= table[k].startX and x <= table[k].endX and y >= table[k].startY and y <= table[k].endY then
  37.       table[k].command()
  38.     end
  39.    end
  40.   end
  41.  end
  42. end
  43.  
  44. local function redButton()
  45.  m.clear()
  46.  m.setTextScale(5)
  47.  m.setCursorPos(2,2)
  48.  m.setTextColor(colors.red)
  49.  m.write("LOSER")
  50.  os.sleep(10)
  51.  os.reboot()
  52. end
  53.  
  54. local function oneWither()
  55.  m.setBackgroundColor(colors.black)
  56.  m.clear()
  57.  m.setTextScale(5)
  58.  m.setCursorPos(5,2)
  59.  m.write("5")
  60.  os.sleep(1)
  61.  m.clear()
  62.  m.write("4")
  63.  os.sleep(1)
  64.  m.clear()
  65.  m.write("3")
  66.  os.sleep(1)
  67.  m.clear()
  68.  m.write("2")
  69.  os.sleep(1)
  70.  m.clear()
  71.  m.write("1")
  72.  os.sleep(1)
  73.  m.clear()
  74.   repeat
  75.     m.clear()
  76.     m.setBackgroundColor(colors.red)
  77.     m.setTextColor(colors.lime)
  78.     m.write("GO!")
  79.     os.sleep(0.5)
  80.     m.clear()
  81.     m.setBackgroundColor(colors.lime)
  82.     m.setTextColor(colors.red)
  83.     m.write("GO!")
  84.     os.sleep(0.5)
  85.   until 5
  86. end
  87.  
  88. local redGrnButtons ={
  89.  [1] = {buttonType = 1, startX = 10, endX = 20, startY = 12, endY = 16, buttonText = "GO!", command = grnButton},
  90.  [2] = {buttonType = 1, startX = 30, endX = 40, startY = 12, endY = 16, buttonText = "NO", command = redButton}
  91. }
  92.  
  93. local witherNum ={
  94.  [1] = {buttonType = 1, startX = 10, endX = 20, startY = 12, endY = 16, buttonText = "1", command = oneWither},
  95.  [2] = {buttonType = 1, startX = 30, endX = 40, startY = 12, endY = 16, buttonText = "2", command = twoWither}
  96. }
  97.  
  98. local function buttonMenu(table)
  99.  for k,v in ipairs(table) do
  100.   m.setCursorPos(table[k].startX, table[k].startY)
  101.  end
  102.  while running do
  103.   for k,v in ipairs(table) do
  104.    event, button, x, y = os.pullEvent()
  105.    if event == "monitor_touch" then
  106.     if x >= table[k].startX and x <= table[k].endX and y >= table[k].startY and y <= table[k].endY then
  107.       table[k].command()
  108.     end
  109.    end
  110.   end
  111.  end
  112.  m.clear()
  113. end
  114.  
  115.  
  116. local function WelcomeScreen()
  117.   m.clear()
  118.   m.setBackgroundColor(colors.black)
  119.   m.setTextScale(4)
  120.   m.setCursorPos(0,1)
  121.   m.setTextColor(colors.lime)
  122.   m.write(" Welcome")
  123.   m.setCursorPos(5,3)
  124.   m.setTextColor(colors.yellow)
  125.   m.write("to the")
  126.   m.setCursorPos(8,5)
  127.   m.setTextColor(colors.red)
  128.   m.write("ARENA!")
  129. end
  130.  
  131. local function screenTwo()
  132.   m.clear()
  133.   m.setBackgroundColor(colors.black)
  134.   m.setTextScale(1)
  135.   m.setCursorPos(9,1)
  136.   m.setTextColor(colors.white)
  137.   m.write("Welcome to HDbag's Wither Arena!!!")
  138.   m.setCursorPos(4,2)
  139.   m.write("Co-Hosting IPJ and the boss of the underworld")
  140.   m.setCursorPos(8,5)
  141.   m.write("simply push the green button to start")
  142.   m.setCursorPos(11,6)
  143.   m.write("Or push the red button to stop")
  144.   m.setCursorPos(1,8)
  145.   m.write("Work In Progress - - - Owners not held responsible")
  146.   m.setBackgroundColor(colors.lime)
  147.     for x = 10, 20 do
  148.       for y = 12, 16 do
  149.         m.setCursorPos(x, y)
  150.         m.write(" ")
  151.     end
  152.    end
  153.  m.setBackgroundColor(colors.red)
  154.    for x = 30, 40 do
  155.      for y = 12, 16 do
  156.        m.setCursorPos(x, y)
  157.        m.write(" ")
  158.      end
  159.    end
  160. end
  161.  
  162. -- end of functions list
  163.  
  164. m.clear()
  165. WelcomeScreen()
  166. os.sleep(1.5)
  167.  
  168. local event = (os.pullEvent())
  169.   if event == "monitor_touch" then
  170.     screenTwo()
  171.     buttonMenu(redGrnButtons)
  172.   end
Advertisement
Add Comment
Please, Sign In to add comment