Advertisement
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
- --Broadcasts
- local function platOneBroadcastOn()
- rednet.open("top")
- rednet.broadcast("platOneOn")
- print("First Layer")
- rednet.close("top")
- end
- -- 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 screen at any point to skip tutorial")
- term.restore()
- m.setCursorPos(1,3)
- term.redirect(m)
- textutils.slowPrint("Welcome to the Arena")
- clear()
- term.r
- 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
- --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(1,8)
- 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
Advertisement