Advertisement
DustinRosebery

startup alpha 3

Sep 2nd, 2013
275
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 printCenter = function(text, side)
  7.  --local monitor = peripheral.wrap(side)
  8.  --local maxw, maxh = monitor.getSize()
  9.  --local curx, cury = monitor.getCursorPos()
  10.  
  11.  --monitor.setCursorPos((maxw-#text)/2,cury)
  12.  --monitor.write(text)
  13.  --monitor.setCursorPos(curx,cury+1)
  14. --end
  15.  
  16. --local maxw, maxh = m.getSize()
  17. --m.setCursorPos(1,math.floor(maxh/2))       reference sets to top middle line
  18.  
  19.     --Broadcasts
  20.  
  21. local function platOneBroadcastOn()
  22.   rednet.open("top")
  23.   rednet.broadcast("platOneOn")
  24.   print("First Layer")
  25.   rednet.close("top")
  26. end
  27.  
  28.      -- Button Functions
  29.  
  30. local function oneWither()      --One Wither has been selected
  31.  m.setBackgroundColor(colors.black)
  32.  m.clear()
  33.  m.setTextScale(5)
  34.  m.setTextColor(colors.lime)
  35.  m.setCursorPos(5,2)
  36.  m.write("5")
  37.  os.sleep(1)
  38.  m.clear()
  39.  m.setCursorPos(5,2)
  40.  m.write("4")
  41.  os.sleep(1)
  42.  m.clear()
  43.  m.setCursorPos(5,2)
  44.  m.write("3")
  45.  os.sleep(1)
  46.  m.clear()
  47.  m.setCursorPos(5,2)
  48.  m.write("2")
  49.  os.sleep(1)
  50.  m.clear()
  51.  m.setCursorPos(5,2)
  52.  m.write("1")
  53.  os.sleep(1)
  54.  m.clear()
  55.  
  56.  platOneBroadcastOn()
  57.  
  58.  goRep()
  59.  goRep()
  60.  goRep()
  61. end
  62.  
  63. local function grnButton()      --Accept Arena challenge button
  64.  m.setBackgroundColor(colors.black)
  65.  m.clear()
  66.  m.setTextScale(1)
  67.  term.redirect(m)
  68.    m.setCursorPos(1,1)
  69.    m.clear()
  70.    m.setBackgroundColor(colors.black)
  71.    m.setBackgroundColor(colors.lime)
  72.     for x = 20, 30 do
  73.       for y = 12, 16 do
  74.         m.setCursorPos(x, y)
  75.         m.write(" ")
  76.       end
  77.     end
  78.    m.setBackgroundColor(colors.black)
  79.    m.setCursorPos(1,1)
  80.    print("Touch green button at any point to skip tutorial")
  81.    m.setCursorPos(1,2)
  82.    print("Touch any other part of the screen to view the next page.")
  83.    m.setCursorPos(1,4)
  84.    textutils.slowPrint("Welcome to the Arena")
  85.         local event = (os.pullEvent())
  86.                 if event == ("monitor_touch") then
  87.                         return
  88.                 end
  89.    m.clear()
  90.    m.setBackgroundColor(colors.black)
  91.    m.setBackgroundColor(colors.lime)
  92.     for x = 20, 30 do
  93.       for y = 12, 16 do
  94.         m.setCursorPos(x, y)
  95.         m.write(" ")
  96.       end
  97.     end  
  98.    m.setBackgroundColor(colors.black)
  99.    m.setCursorPos(1,1)
  100.    print("This tutorial explains what you will need to do to safely battle the wither in our base \n")
  101.         local event = (os.pullEvent())
  102.                 if event == ("monitor_touch") then
  103.                         return
  104.                 end
  105.     m.clear()
  106.     m.setBackgroundColor(colors.black)
  107.     m.setBackgroundColor(colors.lime)
  108.     for x = 20, 30 do
  109.       for y = 12, 16 do
  110.         m.setCursorPos(x, y)
  111.         m.write(" ")
  112.       end
  113.     end
  114.    m.setBackgroundColor(colors.black)
  115.    m.setCursorPos(1,1)
  116.    print("to start the battle you will touch the green button and a timer will count down from 5 and the screen will flash GO! \n")
  117.         local event = (os.pullEvent())
  118.                 if event == ("monitor_touch") then
  119.                         return
  120.                 end
  121.    m.clear()
  122.    m.setBackgroundColor(colors.black)
  123.    m.setBackgroundColor(colors.lime)
  124.     for x = 20, 30 do
  125.       for y = 12, 16 do
  126.         m.setCursorPos(x, y)
  127.         m.write(" ")
  128.       end
  129.     end
  130.    m.setBackgroundColor(colors.black)
  131.    m.setCursorPos(1,1)
  132.    print("As soon as the timer ends and the go begins to flash a platform will appear directly off the left of the platform, jump down and type Ready in the world chat... use a capitol R in Ready \n")
  133.         local event = (os.pullEvent())
  134.                 if event == ("monitor_touch") then
  135.                         return
  136.                 end
  137.    m.clear()
  138.    m.setBackgroundColor(colors.black)
  139.    m.setBackgroundColor(colors.lime)
  140.     for x = 20, 30 do
  141.       for y = 12, 16 do
  142.         m.setCursorPos(x, y)
  143.         m.write(" ")
  144.       end
  145.     end
  146.    m.setBackgroundColor(colors.black)
  147.    m.setCursorPos(1,1)
  148.    print("After you say the command in worldchat the blastshield will activate and the wither will start to be constructed \n")
  149.         local event = (os.pullEvent())
  150.                 if event == ("monitor_touch") then
  151.                         return
  152.                 end
  153.    m.clear()
  154.    m.setBackgroundColor(colors.black)
  155.    m.setBackgroundColor(colors.lime)
  156.     for x = 20, 30 do
  157.       for y = 12, 16 do
  158.         m.setCursorPos(x, y)
  159.         m.write(" ")
  160.       end
  161.     end
  162.    m.setBackgroundColor(colors.black)
  163.    m.setCursorPos(1,1)
  164.    print("For this version, how you defeat the wither is up to you... But to prevent accidental release of the wither the force field can not be deactivated until the nether star is placed in the last slot of the turtle you will find at the corner of the arena \n")
  165.         local event = (os.pullEvent())
  166.                 if event == ("monitor_touch") then
  167.                         return
  168.                 end
  169.    m.clear()
  170.    m.setBackgroundColor(colors.black)
  171.    m.setBackgroundColor(colors.lime)
  172.     for x = 20, 30 do
  173.       for y = 12, 16 do
  174.         m.setCursorPos(x, y)
  175.         m.write(" ")
  176.       end
  177.     end
  178.    m.setBackgroundColor(colors.black)  
  179.    m.setCursorPos(1,1)
  180.    print("In the very real case of a player death the force field will finish the job. Good Luck soldier... \n")
  181.    term.restore()
  182.         local event = (os.pullEvent())
  183.                 if event == ("monitor_touch") then
  184.                         return
  185.                 end
  186.    term.restore()
  187. end      
  188.  
  189. local function redButton()      --Dont Accept Arena Challenge
  190.  m.clear()
  191.  m.setTextScale(5)
  192.  m.setCursorPos(2,2)
  193.  m.setTextColor(colors.red)
  194.  m.write("Next Time Then")
  195.  os.sleep(4)
  196.  os.reboot()
  197. end
  198.  
  199. local function goRep()          -- flashes go on the screen
  200.  m.setTextScale(10)
  201.  m.setCursorPos(2,2)
  202.  m.write("GO!")
  203.  os.sleep(1)
  204.  m.clear()
  205.  os.sleep(0.5)
  206. end
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.     --Monitor screens
  214.  
  215. local function swapScreen()
  216.   m.clear()
  217.   m.setBackgroundColor(colors.black)
  218.   m.setTextScale(1)
  219.   m.setCursorPos(14,12)
  220.   term.redirect(m)
  221.     print("Touch to Start")
  222.   term.restore()
  223.   os.sleep(2)
  224.   os.reboot()
  225. end
  226.    
  227. local function WelcomeScreen()
  228.   m.clear()
  229.   m.setBackgroundColor(colors.black)
  230.   m.setTextScale(4)
  231.   m.setCursorPos(0,1)
  232.   m.setTextColor(colors.lime)
  233.   m.write(" Welcome")
  234.   m.setCursorPos(5,3)
  235.   m.setTextColor(colors.yellow)
  236.   m.write("to the")
  237.   m.setCursorPos(8,5)
  238.   m.setTextColor(colors.red)
  239.   m.write("ARENA!")
  240. end
  241.  
  242. local function yesNo(x1, x2, y1, y2)
  243. local event, side, X, Y = os.pullEventRaw()
  244.   if event == "monitor_touch" then
  245.     if (x1 >= 10 and x2 <= 20 and y1 >=12 and y2 <= 16) then
  246.       grnButton()
  247.     elseif (x1 >= 30 and x2 <= 40 and y1 >= 12 and y2 <= 16) then
  248.       redButton()
  249.     else
  250.       os.reboot()
  251.     end
  252.   end
  253. end
  254.  
  255. local function screenTwo()
  256.   m.clear()
  257.   m.setBackgroundColor(colors.black)
  258.   m.setTextScale(1)
  259.   m.setCursorPos(9,1)
  260.   m.setTextColor(colors.white)
  261.   m.write("Welcome to HDbag's Wither Arena!!!")
  262.   m.setCursorPos(4,2)
  263.   m.write("Co-Hosting IPJ and the boss of the underworld")
  264.   m.setCursorPos(8,5)
  265.   m.write("simply push the green button to start")
  266.   m.setCursorPos(11,6)
  267.   m.write("Or push the red button to stop")
  268.   m.setCursorPos(13,7)
  269.   m.write("Double click the buttons")
  270.   m.setCursorPos(1,9)
  271.   m.write("Work In Progress - - - Owners not held responsible")
  272.   m.setBackgroundColor(colors.lime)
  273.     for x = 10, 20 do
  274.       for y = 12, 16 do
  275.         m.setCursorPos(x, y)
  276.         m.write(" ")
  277.     end
  278.    end
  279.  m.setBackgroundColor(colors.red)
  280.    for x = 30, 40 do
  281.      for y = 12, 16 do
  282.        m.setCursorPos(x, y)
  283.        m.write(" ")
  284.      end
  285.    end
  286.  local event = (os.pullEvent())
  287.    if event == "monitor_touch" then
  288.      return
  289.    end
  290. end
  291.  
  292.     --Tables and executables
  293.  
  294. local redGrnButtons ={
  295.  [1] = {buttonType = 1, startX = 10, endX = 20, startY = 12, endY = 16, buttonText = "GO!", command = grnButton},
  296.  [2] = {buttonType = 1, startX = 30, endX = 40, startY = 12, endY = 16, buttonText = "NO", command = redButton}
  297. }
  298.  
  299. --local tutorialButton ={
  300. -- [1] = {buttonType = 1, startX = 20, endx = 30, startY = 12, endY = 16, buttonText = "#", command = oneWither
  301. --}
  302.  
  303. --local witherNum ={
  304.  --[1] = {buttonType = 1, startX = 20, endX = 30, startY = 12, endY = 16, buttonText = "1", command = oneWither},
  305. --}
  306.    
  307. local function buttonMenu(table)
  308.  for k,v in ipairs(table) do
  309.   m.setCursorPos(table[k].startX, table[k].startY)
  310.  end
  311.  while running do
  312.   for k,v in ipairs(table) do
  313.    event, button, x, y = os.pullEvent()
  314.    if event == "monitor_touch" then
  315.     if x >= table[k].startX and x <= table[k].endX and y >= table[k].startY and y <= table[k].endY then
  316.       table[k].command()
  317.     end
  318.    end
  319.   end
  320.   return
  321.  end
  322.  m.clear()
  323. end
  324.  
  325. local function clickCatch()
  326.     local eventtocatch = "monitor_touch"
  327.     local timeout = os.startTimer(3)
  328.     local e, arg1, arg2, arg3 = os.pullEvent()
  329.         if e == 'timer' and arg1 == timeout then
  330.             swapScreen()
  331.         elseif e == eventtocatch then
  332.             screenTwo()
  333.         end
  334. end
  335.  
  336. -- end of functions list
  337.  
  338. m.clear()
  339.  
  340.  
  341. WelcomeScreen()
  342. clickCatch()
  343.  
  344. screenTwo()
  345. buttonMenu(redGrnButtons)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement