Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local com = require("component")
- local thread = require("thread")
- local event = require("event")
- local modem = com.modem
- local gpu = com.gpu
- local port = 666 ---------> используемый порт
- local pass = "gogo"
- thread.init()
- local doit = {}
- doit[54] = "up"
- doit[157] = "down"
- doit[203] = "left"
- doit[205] = "right"
- doit[200] = "forward"
- doit[208] = "back"
- doit[48] = "swing"
- doit[47] = "swingUp"
- doit[49] = "swingDown"
- doit[45] = "use"
- doit[44] = "useUp"
- doit[46] = "useDown"
- doit[51] = "place"
- doit[50] = "placeUp"
- doit[52] = "placeDown"
- doit[31] = "suck"
- doit[30] = "suckUp"
- doit[32] = "suckDown"
- doit[16] = "drop"
- doit[41] = "password"
- doit[28] = "hide"
- modem.close()
- modem.open(port)
- modem.setStrength(500)
- modem.broadcast(port, pass)
- local _, _, _, _, _, clientAddr = event.pull("modem_message", nil, nil, port)
- print(clientAddr)
- local function msgRead()
- while true do
- local _, _, _, _, _, msg = event.pull("modem_message", nil, clientAddr, port)
- print(">>"..tostring(msg))
- end
- end
- thread.create(msgRead)
- while true do
- local _, _, _, k, _ = event.pull("key_up")
- if doit[tonumber(k)] ~= "hide" then
- modem.send(clientAddr, port, doit[tonumber(k)])
- print(doit[k])
- else
- local _, res = gpu.getResolution()
- if res == 25 then
- gpu.setResolution(10, 3)
- else
- gpu.setResolution(80, 25)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement