Advertisement
DustinRosebery

startup beta 3

Sep 2nd, 2013
403
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.lime)
  71.     for x = 20, 30 do
  72.       for y = 12, 16 do
  73.         m.setCursorPos(x, y)
  74.         m.write(" ")
  75.       end
  76.     end
  77.    m.setBackgroundColor(colors.black)
  78.    m.setCursorPos(1,1)
  79.    print("Touch green button at any point to skip tutorial")
  80.    m.setCursorPos(1,2)
  81.    print("Touch any other part of the screen to view the next page.")
  82.    m.setCursorPos(1,4)
  83.    textutils.slowPrint("Welcome to the Arena")
  84. end
  85.  
  86. local function tut1()
  87.    m.clear()
  88.    m.setBackgroundColor(colors.lime)
  89.     for x = 20, 30 do
  90.       for y = 12, 16 do
  91.         m.setCursorPos(x, y)
  92.         m.write(" ")
  93.       end
  94.     end  
  95.    m.setBackgroundColor(colors.black)
  96.    m.setCursorPos(1,1)
  97.    print("This tutorial explains what you will need to do to safely battle the wither in our base \n")
  98. end
  99.  
  100. local function tut2()
  101.     m.clear()
  102.     m.setBackgroundColor(colors.lime)
  103.     for x = 20, 30 do
  104.       for y = 12, 16 do
  105.         m.setCursorPos(x, y)
  106.         m.write(" ")
  107.       end
  108.     end
  109.    m.setBackgroundColor(colors.black)
  110.    m.setCursorPos(1,1)
  111.    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")
  112. end
  113.  
  114. local function tut3()
  115.    m.clear()
  116.    m.setBackgroundColor(colors.lime)
  117.     for x = 20, 30 do
  118.       for y = 12, 16 do
  119.         m.setCursorPos(x, y)
  120.         m.write(" ")
  121.       end
  122.     end
  123.    m.setBackgroundColor(colors.black)
  124.    m.setCursorPos(1,1)
  125.    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")
  126. end
  127.  
  128. local function tut4()
  129.    m.clear()
  130.    m.setBackgroundColor(colors.lime)
  131.     for x = 20, 30 do
  132.       for y = 12, 16 do
  133.         m.setCursorPos(x, y)
  134.         m.write(" ")
  135.       end
  136.     end
  137.    m.setBackgroundColor(colors.black)
  138.    m.setCursorPos(1,1)
  139.    print("After you say the command in worldchat the blastshield will activate and the wither will start to be constructed \n")
  140. end
  141.  
  142. local function tut5()
  143.    m.clear()
  144.    m.setBackgroundColor(colors.lime)
  145.     for x = 20, 30 do
  146.       for y = 12, 16 do
  147.         m.setCursorPos(x, y)
  148.         m.write(" ")
  149.       end
  150.     end
  151.    m.setBackgroundColor(colors.black)
  152.    m.setCursorPos(1,1)
  153.    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")
  154. end
  155.  
  156. local function tut6()
  157.    m.clear()
  158.    m.setBackgroundColor(colors.lime)
  159.     for x = 20, 30 do
  160.       for y = 12, 16 do
  161.         m.setCursorPos(x, y)
  162.         m.write(" ")
  163.       end
  164.     end
  165.    m.setBackgroundColor(colors.black)  
  166.    m.setCursorPos(1,1)
  167.    print("In the very real case of a player death the force field will finish the job. Good Luck soldier... \n")
  168.    term.restore()
  169. end
  170.  
  171. local function redButton()      --Dont Accept Arena Challenge
  172.  m.clear()
  173.  m.setTextScale(5)
  174.  m.setCursorPos(2,2)
  175.  m.setTextColor(colors.red)
  176.  m.write("Next Time Then")
  177.  os.sleep(4)
  178.  os.reboot()
  179. end
  180.  
  181. local function goRep()          -- flashes go on the screen
  182.  m.setTextScale(10)
  183.  m.setCursorPos(2,2)
  184.  m.write("GO!")
  185.  os.sleep(1)
  186.  m.clear()
  187.  os.sleep(0.5)
  188. end
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.     --Monitor screens
  196.  
  197. local function swapScreen()
  198.   m.clear()
  199.   m.setBackgroundColor(colors.black)
  200.   m.setTextScale(1)
  201.   m.setCursorPos(14,12)
  202.   term.redirect(m)
  203.     print("Touch to Start")
  204.   term.restore()
  205.   os.sleep(2)
  206.   os.reboot()
  207. end
  208.    
  209. local function WelcomeScreen()
  210.   m.clear()
  211.   m.setBackgroundColor(colors.black)
  212.   m.setTextScale(4)
  213.   m.setCursorPos(0,1)
  214.   m.setTextColor(colors.lime)
  215.   m.write(" Welcome")
  216.   m.setCursorPos(5,3)
  217.   m.setTextColor(colors.yellow)
  218.   m.write("to the")
  219.   m.setCursorPos(8,5)
  220.   m.setTextColor(colors.red)
  221.   m.write("ARENA!")
  222. end
  223.  
  224. local function yesNo(x1, x2, y1, y2)
  225. local event, side, X, Y = os.pullEventRaw()
  226.   if event == "monitor_touch" then
  227.     if (x1 >= 10 and x2 <= 20 and y1 >=12 and y2 <= 16) then
  228.       grnButton()
  229.     elseif (x1 >= 30 and x2 <= 40 and y1 >= 12 and y2 <= 16) then
  230.       redButton()
  231.     else
  232.       os.reboot()
  233.     end
  234.   end
  235. end
  236.  
  237. local function screenTwo()
  238.   m.clear()
  239.   m.setBackgroundColor(colors.black)
  240.   m.setTextScale(1)
  241.   m.setCursorPos(9,1)
  242.   m.setTextColor(colors.white)
  243.   m.write("Welcome to HDbag's Wither Arena!!!")
  244.   m.setCursorPos(4,2)
  245.   m.write("Co-Hosting IPJ and the boss of the underworld")
  246.   m.setCursorPos(8,5)
  247.   m.write("simply push the green button to start")
  248.   m.setCursorPos(11,6)
  249.   m.write("Or push the red button to stop")
  250.   m.setCursorPos(13,7)
  251.   m.write("Double click the buttons")
  252.   m.setCursorPos(1,9)
  253.   m.write("Work In Progress - - - Owners not held responsible")
  254.   m.setBackgroundColor(colors.lime)
  255.     for x = 10, 20 do
  256.       for y = 12, 16 do
  257.         m.setCursorPos(x, y)
  258.         m.write(" ")
  259.     end
  260.    end
  261.  m.setBackgroundColor(colors.red)
  262.    for x = 30, 40 do
  263.      for y = 12, 16 do
  264.        m.setCursorPos(x, y)
  265.        m.write(" ")
  266.      end
  267.    end
  268.  local event = (os.pullEvent())
  269.    if event == "monitor_touch" then
  270.      return
  271.    end
  272. end
  273.  
  274.     --Tables and executables
  275.  
  276. local redGrnButtons ={
  277.  [1] = {buttonType = 1, startX = 10, endX = 20, startY = 12, endY = 16, buttonText = "GO!", command = grnButton},
  278.  [2] = {buttonType = 1, startX = 30, endX = 40, startY = 12, endY = 16, buttonText = "NO", command = redButton}
  279. }
  280.  
  281. local tutorialButton ={
  282.  [1] = {buttonType = 1, startX = 20, endX = 30, startY = 12, endY = 16, buttonText = "#", command = oneWither}
  283.  [2] = {buttonType = 1, startX = 1, endX = 50, startY = 1, endY = 11, buttonText = "!", command = return}
  284.  [3] = {buttonType = 1, startX = 1. endX = 19, startY = 12, endY = 16, buttonText = "@", command = return}
  285.  [4] = {buttonType = 1, startX = 31, endX = 50, startY = 12, endY = 16, buttonText = "$", command = return}
  286.  [5] = {buttonType = 1, startX = 1, endX = 50, startY = 17, endY = 19, buttonText = "%", command = return}
  287. }
  288.  
  289. --local witherNum ={
  290.  --[1] = {buttonType = 1, startX = 20, endX = 30, startY = 12, endY = 16, buttonText = "1", command = oneWither},
  291. --}
  292.    
  293. local function buttonMenu(table)
  294.  for k,v in ipairs(table) do
  295.   m.setCursorPos(table[k].startX, table[k].startY)
  296.  end
  297.  while running do
  298.   for k,v in ipairs(table) do
  299.    event, button, x, y = os.pullEvent()
  300.    if event == "monitor_touch" then
  301.     if x >= table[k].startX and x <= table[k].endX and y >= table[k].startY and y <= table[k].endY then
  302.       table[k].command()
  303.     end
  304.    end
  305.   end
  306.   return
  307.  end
  308.  m.clear()
  309. end
  310.  
  311. local function clickCatch()
  312.     local eventtocatch = "monitor_touch"
  313.     local timeout = os.startTimer(3)
  314.     local e, arg1, arg2, arg3 = os.pullEvent()
  315.         if e == 'timer' and arg1 == timeout then
  316.             swapScreen()
  317.         elseif e == eventtocatch then
  318.             screenTwo()
  319.         end
  320. end
  321.  
  322. -- end of functions list
  323.  
  324. m.clear()
  325.  
  326.  
  327. WelcomeScreen()
  328. clickCatch()
  329.  
  330. screenTwo()
  331. buttonMenu(redGrnButtons)
  332.  
  333. grnButton()
  334. buttonMenu(tutorialButton)
  335.  
  336. tut1()
  337. buttonMenu(tutorialButton)
  338.  
  339. tut2()
  340. buttonMenu(tutorialButton)
  341.  
  342. tut3()
  343. buttonMenu(tutorialButton)
  344.  
  345. tut4()
  346. buttonMenu(tutorialButton)
  347.  
  348. tut5()
  349. buttonMenu(tutorialButton)
  350.  
  351. tut6()
  352. buttonMenu(tutorialButton)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement