The turtle itself (named JCVD, just because I have a penchant for naming my turtles silly things) has a simple startup, it's a while true do loop of turnLeft and attack. It stays in one place and attacks mobs that are led to it.
To keep things simple and safe, I've set JCVD on top of a computer, which has wrapped JCVD as a peripheral. So here's what I've got so far:
modem=peripheral.wrap("bottom")
modem.open(3)
jcvd=peripheral.wrap("top")
jcvd.turnOn()
local event, side, rcv, rpl, msg, dst=os.pullEvent("modem_message")
while true do
if msg=="jcvdon" then
jcvd.turnOn()
modem.transmit(1,3, "JCVD is turned on!")
elseif msg=="jcvdoff" then
jcvd.shutdown()
modem.transmit(1,3, "JCVD is turned off!")
else
modem.transmit(1,3, "Didn't catch that. Try again?")
end
end
After that, it's a relatively simple case of writing a couple of programs on my pocket computer that transmit the respective messages to turn JCVD on and off.
The trouble I'm having, as mentioned in the title, is that it'll receive the first command just fine, but after that it won't receive anything, and will throw a "Too long without yielding" error message. I already see at least one mistake in the code but I thought I'd check in with some pros and figure out how to do what I want to do.