Guest User

dtest2

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