Guest User

dtest2

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