1 posts
Posted 18 January 2014 - 07:54 PM
Im trying to control the turtle without the need of staying on the computer to send the commands i have the rednet part up and running but i sont know how to do the rest.
Here is my code to the computer
www.pastebin.com/zz5BBhnkHere is my code to the turtle
www.pastebin.com/nqb3UznAThank You! :D/>
758 posts
Location
Budapest, Hungary
Posted 19 January 2014 - 02:17 AM
So you basically want to control something without using a controller. That's not gonna be easy. Do you have MiscPeripherals installed? The Chatbox peripheral can read your chat messages. Altough that'd mean spamming the chat with commands, there's no other way I can think of right now.
1281 posts
Posted 19 January 2014 - 05:59 AM
Terminal glasses from openPeripherals is probably a more suited approach. This way you can send commands outside of chat, aswell as display relevant info to your screen.
7083 posts
Location
Tasmania (AU)
Posted 19 January 2014 - 06:07 AM
Or do you perhaps want to be able to queue commands, go off and do something else, and come back to the controller computer to find them all completed while you were away?
1281 posts
Posted 19 January 2014 - 06:59 AM
After taking a quick look at the code, i'd assume he wants to be able to map turtle actions directly to his keyboard. This is unfortunately not a possibility as far as im aware of. Admittedly queuing commands from a computer would be a good idea, but either way you'll probably have to change your program so you don't have to queue up each move, but instead be able to queue up multiples of the same action in one go. Another quikc thing to note, is your usage of ifs
if message == "f" then
turtle.forward()
end -- should use elseif here instead
if message == "l" then
turtle.turnLeft()
end
Can instead be
if message == "f" then
turtle.forward()
elseif message == "l" then
turtle.turnLeft()
end
This both makes the code more optimized(faster), aswell as shorter.