Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Code by MrDj200 2016.
- --Put your level under this (Note: The last entry has NO "," at the end!)
- levels = { "ExampleTop",
- "ExampleMiddle",
- "ExampleBottom"
- }
- -- Put your ComputerID's in the same order as above(Note: The last entry has NO "," at the end!)
- IDs = { 1,
- 5,
- 3
- }
- --On what side is your Wireless Modem? ( "bottom" | "top" | "back" | "front" | "right" | "left" )
- rednetSide = "left"
- --What line and row to start the buttons:
- line = 3
- row= 10
- space = 1
- --The Code starts here. Dont change anything, unless you know what you are doing ;P
- term.clear()
- term.setBackgroundColor(colors.red)
- lineNums = {}
- function fncButton(x, y)
- --print( "The mouse button 1 was pressed at ", x, " and ", y )
- for k, v in pairs(levels) do
- if y == lineNums[k] then
- if x > row - 1 and x < row + #levels[k] + 1 then
- rednet.open(rednetSide)
- rednet.send(IDs[k])
- end
- end
- end
- end
- for k, v in pairs(levels) do
- term.setCursorPos(row, line)
- term.write(v)
- lineNums[k] = line
- line = line + 1 + space
- end
- while true do
- local event, button, x, y = os.pullEvent( "mouse_click" )
- --print( "The mouse button ", button, " was pressed at ", x, " and ", y )
- if (button == 1) then
- fncButton(x, y)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment