This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
XMrPotatoX's profile picture

Perform task from rednet message

Started by XMrPotatoX, 05 September 2014 - 08:31 PM
XMrPotatoX #1
Posted 05 September 2014 - 10:31 PM
Is there a way for a turtle to get a message over rednet and perform the specified task?

Something like this

while true do
   Id, msg, protocol = rednet.receive()
   msg
end
where the message would be "turtle.forward()"

I know this works,

while true do
   Id, msg, protocol = rednet.receive()
   if msg == "turtle.forward()" then
	  turtle.forward()
   end
end
but its very time consuming to do this for every possible action
Edited on 05 September 2014 - 08:32 PM
KingofGamesYami #2
Posted 05 September 2014 - 10:40 PM
loadstring( string )
XMrPotatoX #3
Posted 05 September 2014 - 11:05 PM

Thank you so much!
I often times forget that LUA has its own documentation, I'll be sure to look around more next time :D/>
DannySMc #4
Posted 08 September 2014 - 12:07 PM

Thank you so much!
I often times forget that LUA has its own documentation, I'll be sure to look around more next time :D/>

Personally I would of just used a set of pre-coded controls? So use a pocket computer (if using 1.6x) and you can use forward, backward, turn left and right etc. This is a lot more time consuming but once done, could be very handy.
XMrPotatoX #5
Posted 08 September 2014 - 06:44 PM
Personally I would of just used a set of pre-coded controls? So use a pocket computer (if using 1.6x) and you can use forward, backward, turn left and right etc. This is a lot more time consuming but once done, could be very handy.

Yeah, I was doing something like that at first. But then I wanted to input commands from outside Minecraft. The rednet example was just the easiest way to explain what I was asking.

This is what I ended up doing in case you were wondering,
Edited on 08 September 2014 - 04:44 PM