Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if pocket then
- rednet.open("back")
- write("pocket")
- else
- rednet.open("top")
- write("computer")
- end
- term.clear()
- term.setCursorPos(1,1)
- continue = true
- monitor = nil
- if pocket then
- else
- monitor = peripheral.wrap( "right" )
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.write("Hello world")
- end
- function attackInfinite()
- write("Attacking forever, ctrl+T to stop")
- if pocket then
- else
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.write("Attacking forever,")
- monitor.setCursorPos(1,2)
- monitor.write("press q to stop")
- end
- while continue do
- rednet.broadcast("attack")
- sleep(1)
- end
- end
- function exitProgram()
- repeat
- local ev, key = os.pullEvent('key')
- until key == keys.q -- or whatever key i decide to use
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.write("Program stopped")
- end
- function program()
- while continue do
- write("send a command to the turtles : ")
- command = read()
- if command == "attack" then
- attackInfinite()
- end
- rednet.broadcast(command)
- end
- end
- parallel.waitForAny(program, exitProgram)
Advertisement
Add Comment
Please, Sign In to add comment