Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("left")
- mBack = peripheral.wrap("back")
- local running = true
- --local printCenter = function(text, side)
- --local monitor = peripheral.wrap(side)
- --local maxw, maxh = monitor.getSize()
- --local curx, cury = monitor.getCursorPos()
- --monitor.setCursorPos((maxw-#text)/2,cury)
- --monitor.write(text)
- --monitor.setCursorPos(curx,cury+1)
- --end
- --local maxw, maxh = m.getSize()
- --m.setCursorPos(1,math.floor(maxh/2)) reference sets to top middle line
- -- Button Functions
- local function grnButton() --Accept Arena challenge button
- m.setBackgroundColor(colors.black)
- m.clear()
- m.setTextScale(1)
- m.setCursorPos(1,1)
- term.redirect(m)
- print("Touch green button at any point to skip tutorial")
- term.restore()
- m.setCursorPos(1,3)
- term.redirect(m)
- textutils.slowPrint("Welcome to the Arena")
- os.sleep(5)
- m.setCursorPos(1,3)
- m.clearLine()
- os.sleep(1)
- m.clear()
- m.setCursorPos(1,1)
- m.clear()
- print("This tutorial explains what you will need to do to safely battle the wither in our base \n")
- os.sleep(5)
- m.clear()
- m.setCursorPos(1,1)
- 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")
- os.sleep(5)
- m.clear()
- m.setCursorPos(1,1)
- 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")
- os.sleep(5)
- m.clear()
- m.setCusorPos(1,1)
- print("After you say the command in worldchat the blastshield will activate and the wither will start to be constructed \n")
- os.sleep(5)
- m.clear()
- m.setCursorPos(1,1)
- 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")
- os.sleep(5)
- m.clear()
- m.setCurosrPos()
- print("In the very real case of a player death the force field will finish the job. Good Luck soldier... \n")
- term.restore()
- end
- local function redButton() --Dont Accept Arena Challenge
- m.clear()
- m.setTextScale(5)
- m.setCursorPos(2,2)
- m.setTextColor(colors.red)
- m.write("LOSER")
- os.sleep(10)
- os.reboot()
- end
- local function goRep() -- flashes go on the screen
- m.setTextScale(10)
- m.setCursorPos(2,2)
- m.write("GO!")
- os.sleep(1)
- m.clear()
- os.sleep(0.5)
- end
- local function oneWither() --One Wither has been selected
- m.setBackgroundColor(colors.black)
- m.clear()
- m.setTextScale(5)
- m.setTextColor(colors.lime)
- m.setCursorPos(5,2)
- m.write("5")
- os.sleep(1)
- m.clear()
- m.setCursorPos(5,2)
- m.write("4")
- os.sleep(1)
- m.clear()
- m.setCursorPos(5,2)
- m.write("3")
- os.sleep(1)
- m.clear()
- m.setCursorPos(5,2)
- m.write("2")
- os.sleep(1)
- m.clear()
- m.setCursorPos(5,2)
- m.write("1")
- os.sleep(1)
- m.clear()
- platOneBroadcastOn()
- goRep()
- goRep()
- goRep()
- end
- --Broadcasts
- local function platOneBroadcastOn()
- rednet.open("top")
- rednet.broadcast("platOneOn")
- print("First Layer")
- rednet.close("top")
- end
- --Tables and executables
- local redGrnButtons ={
- [1] = {buttonType = 1, startX = 10, endX = 20, startY = 12, endY = 16, buttonText = "GO!", command = grnButton},
- [2] = {buttonType = 1, startX = 30, endX = 40, startY = 12, endY = 16, buttonText = "NO", command = redButton}
- }
- local witherNum ={
- [1] = {buttonType = 1, startX = 10, endX = 20, startY = 12, endY = 16, buttonText = "1", command = oneWither},
- [2] = {buttinType = 1, startX = 30, endX = 40, startY = 12, endY = 16, buttonText = "2", command = twoWither}
- }
- local function buttonMenu(table)
- for k,v in ipairs(table) do
- m.setCursorPos(table[k].startX, table[k].startY)
- end
- while running do
- for k,v in ipairs(table) do
- event, button, x, y = os.pullEvent()
- if event == "monitor_touch" then
- if x >= table[k].startX and x <= table[k].endX and y >= table[k].startY and y <= table[k].endY then
- table[k].command()
- end
- end
- end
- return
- end
- m.clear()
- end
- --Monitor screens
- local function WelcomeScreen()
- m.clear()
- m.setBackgroundColor(colors.black)
- m.setTextScale(4)
- m.setCursorPos(0,1)
- m.setTextColor(colors.lime)
- m.write(" Welcome")
- m.setCursorPos(5,3)
- m.setTextColor(colors.yellow)
- m.write("to the")
- m.setCursorPos(8,5)
- m.setTextColor(colors.red)
- m.write("ARENA!")
- end
- local function screenTwo()
- m.clear()
- m.setBackgroundColor(colors.black)
- m.setTextScale(1)
- m.setCursorPos(9,1)
- m.setTextColor(colors.white)
- m.write("Welcome to HDbag's Wither Arena!!!")
- m.setCursorPos(4,2)
- m.write("Co-Hosting IPJ and the boss of the underworld")
- m.setCursorPos(8,5)
- m.write("simply push the green button to start")
- m.setCursorPos(11,6)
- m.write("Or push the red button to stop")
- m.setCursorPos(13,7)
- m.write("Double click the buttons")
- m.setCursorPos(1,9)
- m.write("Work In Progress - - - Owners not held responsible")
- m.setBackgroundColor(colors.lime)
- for x = 10, 20 do
- for y = 12, 16 do
- m.setCursorPos(x, y)
- m.write(" ")
- end
- end
- m.setBackgroundColor(colors.red)
- for x = 30, 40 do
- for y = 12, 16 do
- m.setCursorPos(x, y)
- m.write(" ")
- end
- end
- end
- -- end of functions list
- m.clear()
- WelcomeScreen()
- os.sleep(1.5)
- local event = (os.pullEvent())
- if event == "monitor_touch" then
- screenTwo()
- buttonMenu(redGrnButtons)
- buttonMenu(witherNum)
- end
Advertisement
Add Comment
Please, Sign In to add comment