Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Awake
- print("Mining client awake: Hello World!")
- -- Setup wireless
- local modem = peripheral.wrap("right")
- -- 11 Server -> Client
- -- 12 Client -> Server
- modem.open(11)
- modem.open(12)
- print("Channel 11 and 12 are open")
- -- Setup receiving wireless messages
- function WaitForMessage(messageCompare)
- while true do
- local a,b,c,d,e,f = os.pullEvent("modem_message")
- print("Message received: ")
- print(e)
- if(e == messageCompare) then
- print("Message accepted")
- break
- end
- end
- end
- function IsTurtle()
- local success, data = turtle.inspect()
- if success then
- return data.name == "computercraft:turtle_advanced"
- else
- return false
- end
- end
- -- Setup sending wireless messages
- function SendMessage(message)
- modem.transmit(12, 11, message)
- end
- -- Main loop
- while true do
- print("Waiting to start next cycle")
- WaitForMessage("_StartNextCycle")
- print("Starting next cycle...")
- while not IsTurtle() do
- turtle.forward()
- end
- print(">>")
- print(">>")
- print(">>")
- end
- print("Goodbye >>")
- read()
Add Comment
Please, Sign In to add comment