SHOW:
|
|
- or go back to the newest paste.
| 1 | - | local mon = peripheral.wrap("top")
|
| 1 | + | os.loadAPI("button")
|
| 2 | - | mon.setTextScale(1) |
| 2 | + | m = peripheral.wrap("right")
|
| 3 | - | mon.setTextColor(colors.white) |
| 3 | + | m.clear |
| 4 | - | local button={}
|
| 4 | + | |
| 5 | - | mon.setBackgroundColor(colors.black) |
| 5 | + | |
| 6 | - | |
| 6 | + | button.setTabel("Main Menu", mainMenu, 17, 18, 14, 24)
|
| 7 | - | function setTable(name, func, xmin, xmax, ymin, ymax) |
| 7 | + | button.setTabel("MobSpawner", mobSpawner, 7, 9, 3, 11)
|
| 8 | - | button[name] = {}
|
| 8 | + | button.setTabel("BaseStatus", baseStatus, 7, 9, 15, 23)
|
| 9 | - | button[name]["func"] = func |
| 9 | + | button.setTabel("SpawnWither", spawnWither, 7, 9, 27, 35)
|
| 10 | - | button[name]["active"] = false |
| 10 | + | button.setTabel("Blank1", blank1, 3, 5, 15, 23)
|
| 11 | - | button[name]["xmin"] = xmin |
| 11 | + | button.setTabel("Blank2", blank2, 11, 13, 15, 23)
|
| 12 | - | button[name]["ymin"] = ymin |
| 12 | + | |
| 13 | - | button[name]["xmax"] = xmax |
| 13 | + | |
| 14 | - | button[name]["ymax"] = ymax |
| 14 | + | function getClick() |
| 15 | event,side,x,y = os.pullEvent("monitor_touch")
| |
| 16 | button.check(x,y) | |
| 17 | - | function funcName() |
| 17 | + | |
| 18 | - | print("You clicked buttonText")
|
| 18 | + | function mobSpawner() |
| 19 | button.flash("MobSpawner")
| |
| 20 | - | |
| 20 | + | |
| 21 | ||
| 22 | - | setTable("ButtonText", funcName, 5, 25, 4, 8)
|
| 22 | + | function spawnWither() |
| 23 | - | end |
| 23 | + | button.flash("SpawnWither")
|
| 24 | end | |
| 25 | - | function fill(text, color, bData) |
| 25 | + | |
| 26 | - | mon.setBackgroundColor(color) |
| 26 | + | function mainMenu() |
| 27 | - | local yspot = math.floor((bData["ymin"] + bData["ymax"]) /2) |
| 27 | + | button.flash("MainMenu")
|
| 28 | - | local xspot = math.floor((bData["xmax"] - bData["xmin"] - string.len(text)) /2) +1 |
| 28 | + | |
| 29 | - | for j = bData["ymin"], bData["ymax"] do |
| 29 | + | |
| 30 | - | mon.setCursorPos(bData["xmin"], j) |
| 30 | + | function baseStatus() |
| 31 | - | if j == yspot then |
| 31 | + | button.flash("BaseStatus")
|
| 32 | - | for k = 0, bData["xmax"] - bData["xmin"] - string.len(text) +1 do |
| 32 | + | |
| 33 | - | if k == xspot then |
| 33 | + | |
| 34 | - | mon.write(text) |
| 34 | + | function blank1() |
| 35 | - | else |
| 35 | + | button.toggleButton("Blank1")
|
| 36 | - | mon.write(" ")
|
| 36 | + | |
| 37 | - | end |
| 37 | + | |
| 38 | - | end |
| 38 | + | function blank2() |
| 39 | - | else |
| 39 | + | button.toggleButton("Blank2")
|
| 40 | - | for i = bData["xmin"], bData["xmax"] do |
| 40 | + |