Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function showMenu()
- -- set up monitor
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- -- Display the button
- term.setBackgroundColor(colors.blue)
- term.setCursorPos(3, 2)
- term.write(string.rep(" ", 10)) -- 10 spaces
- --Display the label
- term.setTextColor(colors.white)
- term.setCursorPos(3 + 2, 2) -- remember 2 columns more for centering here
- term.write("Test")
- end
- function sendTurtle()
- local sendTurtleByGPS = require("sendTurtleByGPS")
- sendTurtleByGPS.send()
- end
- function doAction(action)
- if action == "showMenu" then
- showMenu()
- elseif action == "sendTurtle" then
- sendTurtle()
- else
- print("Net dannoy komandi")
- end
- end
- function getResult(senderId, protocol, typeTurtle)
- if (senderId) then
- senderId = tostring(senderId)
- if (protocol) then
- print(senderId, " is online.", "Protocol: ", protocol)
- else
- print(senderId, " is online.", "No protocol.")
- end
- else
- if (typeTurtle == "razgruzchik") then
- print("Razgruzchikov net v seti.")
- else
- print("Pogruzchikov net v seti.")
- end
- end
- end
- print("Wi-fi modem side? (back/top/left/right/bottom)")
- modemSide = read()
- rednet.open(modemSide)
- if (rednet.isOpen(modemSide)) then
- print("[OK] Wi-fi activated")
- rednet.broadcast("Who is online?", "loaders")
- senderId, message, protocol = rednet.receive("LoadersOnlineResult",5)
- getResult(senderId, protocol, "pogruzchik")
- rednet.broadcast("Who is online?", "unloaders")
- senderId, message, protocol = rednet.receive("unLoadersOnlineResult",5)
- getResult(senderId, protocol, "razgruzchik")
- doAction("showMenu")
- else
- print("Wi-fi activation error. Maybe wrong side?")
- return false
- end
Add Comment
Please, Sign In to add comment