SHOW:
|
|
- or go back to the newest paste.
| 1 | ||
| 2 | ||
| 3 | ||
| 4 | m = peripheral.wrap("left")
| |
| 5 | mBack = peripheral.wrap("back")
| |
| 6 | ||
| 7 | local running = true | |
| 8 | ||
| 9 | -- Button Functions | |
| 10 | ||
| 11 | local function grnButton() | |
| 12 | - | m.setCursorPos(22,2) |
| 12 | + | m.setBackGroundColor(colors.black) |
| 13 | - | m.write("Congrats!")
|
| 13 | + | |
| 14 | - | m.setCursorPos(11,4) |
| 14 | + | |
| 15 | - | m.setTextColor(colors.white) |
| 15 | + | m.setCursorPos(1,1) |
| 16 | - | m.write("Once you select the #Withers")
|
| 16 | + | term.redirect(m) |
| 17 | - | m.setCursorPos(9,5) |
| 17 | + | print("Touch screen at any point to skip tutorial")
|
| 18 | - | m.write("Just wait for Monitor to flash GO!")
|
| 18 | + | |
| 19 | - | m.setCursorPos(12,6) |
| 19 | + | m.setCursorPos(1,3) |
| 20 | - | m.write("and jump down to the left")
|
| 20 | + | term.redirect(m) |
| 21 | - | m.setCursorPos(22,7) |
| 21 | + | textutils.slowPrint("Welcome to the Arena")
|
| 22 | - | m.write("Good Luck")
|
| 22 | + | clear() |
| 23 | - | m.setBackgroundColor(colors.lime) |
| 23 | + | term.r |
| 24 | - | for x = 10, 20 do |
| 24 | + | |
| 25 | ||
| 26 | ||
| 27 | local function redButton() | |
| 28 | m.clear() | |
| 29 | m.setTextScale(5) | |
| 30 | m.setCursorPos(2,2) | |
| 31 | m.setTextColor(colors.red) | |
| 32 | m.write("LOSER")
| |
| 33 | os.sleep(10) | |
| 34 | os.reboot() | |
| 35 | end | |
| 36 | ||
| 37 | ||
| 38 | ||
| 39 | local function oneWither() | |
| 40 | m.setBackgroundColor(colors.black) | |
| 41 | m.clear() | |
| 42 | m.setTextScale(5) | |
| 43 | m.setTextColor(colors.lime) | |
| 44 | m.setCursorPos(5,2) | |
| 45 | m.write("5")
| |
| 46 | os.sleep(1) | |
| 47 | m.clear() | |
| 48 | m.setCursorPos(5,2) | |
| 49 | m.write("4")
| |
| 50 | os.sleep(1) | |
| 51 | m.clear() | |
| 52 | m.setCursorPos(5,2) | |
| 53 | m.write("3")
| |
| 54 | os.sleep(1) | |
| 55 | m.clear() | |
| 56 | m.setCursorPos(5,2) | |
| 57 | m.write("2")
| |
| 58 | os.sleep(1) | |
| 59 | m.clear() | |
| 60 | m.setCursorPos(5,2) | |
| 61 | m.write("1")
| |
| 62 | os.sleep(1) | |
| 63 | m.clear() | |
| 64 | platOneBroadcastOn() | |
| 65 | m.setCursorPos(2,2) | |
| 66 | m.write("GO!")
| |
| 67 | os.sleep(1) | |
| 68 | m.clear() | |
| 69 | os.sleep(1) | |
| 70 | m.setCursorPos(5,2) | |
| 71 | m.write("GO!")
| |
| 72 | os.sleep(1) | |
| 73 | m.clear() | |
| 74 | os.sleep(1) | |
| 75 | m.setCursorPos(8,2) | |
| 76 | m.write("GO!")
| |
| 77 | end | |
| 78 | ||
| 79 | --Broadcasts | |
| 80 | ||
| 81 | local function platOneBroadcastOn() | |
| 82 | rednet.open("top")
| |
| 83 | rednet.broadcast("platOneOn")
| |
| 84 | print("First Layer")
| |
| 85 | rednet.close("top")
| |
| 86 | end | |
| 87 | ||
| 88 | --Tables and executable | |
| 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 | --Monitor screens | |
| 119 | ||
| 120 | local function WelcomeScreen() | |
| 121 | m.clear() | |
| 122 | m.setBackgroundColor(colors.black) | |
| 123 | m.setTextScale(4) | |
| 124 | m.setCursorPos(0,1) | |
| 125 | m.setTextColor(colors.lime) | |
| 126 | m.write(" Welcome")
| |
| 127 | m.setCursorPos(5,3) | |
| 128 | m.setTextColor(colors.yellow) | |
| 129 | m.write("to the")
| |
| 130 | m.setCursorPos(8,5) | |
| 131 | m.setTextColor(colors.red) | |
| 132 | m.write("ARENA!")
| |
| 133 | end | |
| 134 | ||
| 135 | local function screenTwo() | |
| 136 | m.clear() | |
| 137 | m.setBackgroundColor(colors.black) | |
| 138 | m.setTextScale(1) | |
| 139 | m.setCursorPos(9,1) | |
| 140 | m.setTextColor(colors.white) | |
| 141 | m.write("Welcome to HDbag's Wither Arena!!!")
| |
| 142 | m.setCursorPos(4,2) | |
| 143 | m.write("Co-Hosting IPJ and the boss of the underworld")
| |
| 144 | m.setCursorPos(8,5) | |
| 145 | m.write("simply push the green button to start")
| |
| 146 | m.setCursorPos(11,6) | |
| 147 | m.write("Or push the red button to stop")
| |
| 148 | m.setCursorPos(1,8) | |
| 149 | m.write("Work In Progress - - - Owners not held responsible")
| |
| 150 | m.setBackgroundColor(colors.lime) | |
| 151 | for x = 10, 20 do | |
| 152 | for y = 12, 16 do | |
| 153 | m.setCursorPos(x, y) | |
| 154 | m.write(" ")
| |
| 155 | end | |
| 156 | end | |
| 157 | m.setBackgroundColor(colors.red) | |
| 158 | for x = 30, 40 do | |
| 159 | for y = 12, 16 do | |
| 160 | m.setCursorPos(x, y) | |
| 161 | m.write(" ")
| |
| 162 | end | |
| 163 | end | |
| 164 | end | |
| 165 | ||
| 166 | -- end of functions list | |
| 167 | ||
| 168 | m.clear() | |
| 169 | WelcomeScreen() | |
| 170 | os.sleep(1.5) | |
| 171 | ||
| 172 | local event = (os.pullEvent()) | |
| 173 | if event == "monitor_touch" then | |
| 174 | screenTwo() | |
| 175 | buttonMenu(redGrnButtons) | |
| 176 | buttonMenu(witherNum) | |
| 177 | end |