Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("back")
- local controllerID = 14
- os.loadAPI("button")
- local levels = {}
- function setControllerID(id)
- controllerID = id
- end
- function addLevel(name)
- table.insert(levels,name)
- end
- local function fillTable()
- local i = 1
- rednet.send(controllerID,"getCurrentLevel","BUD_ELEVATOR")
- local num, msg = rednet.receive("BUD_ELEVATOR")
- local currentLevel = tonumber(msg)
- for k,v in pairs(levels) do
- local j = i
- button.setTable(v,
- function()
- button.flash(v)
- rednet.send(controllerID, "move`"..j, "BUD_ELEVATOR")
- end
- , 10, 40, i*4-2, i*4)
- if i == currentLevel then
- button.toggleButton(v)
- end
- i = i + 1
- end
- button.screen()
- end
- function heading(str)
- button.heading(str)
- end
- local function getClick()
- event,side,x,y = os.pullEvent("mouse_click")
- button.checkxy(x,y)
- end
- function start()
- fillTable()
- while true do
- getClick()
- end
- end
- --term.clear()
- --heading("---- Elevator ----")
- --addLevel("Lobby")
- --addLevel("Basement")
- --start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement