89 posts
Posted 29 August 2012 - 09:32 PM
as the title says
i know you need 3 computers to run a gps system but how do you make a turtle go to a x y z coordinate?
also i would like to have a turtle send all the text it would normaly display on its screen to a remote computer (and thus to a monitor)?
436 posts
Posted 29 August 2012 - 10:20 PM
This is mostly math. Find the difference between each x, y and z and then have the turtle move that many times in those directions. I would start with up or down (the y axis). And for the message display, make a computer (with a monitor, if you want) run a message system into the monitor. Something like this.
side = "" -- Put what side your monitor is in the quotes
mon= peripheral.wrap(side)
while true do
event, arg1, arg2 = os.pullEvent()
if event == "rednet_message" then
mon.write(arg1)
mon.write(" " .. arg2)
end
end
And you can add filters and such afterward. But, basically what this program does (after you specify what side is), is takes in all messages aimed at it, or broadcast in its range (default 64 block-lengths, not a cube 128 blocks a side), and displays it with its sender id.
89 posts
Posted 29 August 2012 - 11:28 PM
This is mostly math. Find the difference between each x, y and z and then have the turtle move that many times in those directions. I would start with up or down (the y axis). And for the message display, make a computer (with a monitor, if you want) run a message system into the monitor. Something like this.
side = "" -- Put what side your monitor is in the quotes
mon= peripheral.wrap(side)
while true do
event, arg1, arg2 = os.pullEvent()
if event == "rednet_message" then
mon.write(arg1)
mon.write(" " .. arg2)
end
end
And you can add filters and such afterward. But, basically what this program does (after you specify what side is), is takes in all messages aimed at it, or broadcast in its range (default 64 block-lengths, not a cube 128 blocks a side), and displays it with its sender id.
doh, i thought there was a way to send a turtle to specific cords :)/>/> oh well thats that idea out of the window
the rednet thing, im looking at the excavate code now and the rednet tutorial, that looks doable, thankyou.
im guessing i just replace all
print( "" )
with
rednet.broadcast("") then
while true do
event, arg1, arg2 = os.pullEvent()
if event == "rednet_message" and id == "5" then
mon.write(arg1)
mon.write(" " .. arg2)
end
im at work at mo so cant test but im assuming that if turtle with id5 broadcasts the computer running that code (mostly your code i know) would print it on the monitor
but if turtle 6 did then the computer wouldnt ?
or have i misunderstood the id thing?
14 posts
Posted 30 August 2012 - 12:18 AM
id would need to be changed to arg1, and you'd need to end the do, but yes.
so:
while true do
event, arg1, arg2 = os.pullEvent()
if event == "rednet_message" and arg1 == "5" then
mon.write(arg1)
mon.write(" " .. arg2)
end
end
89 posts
Posted 30 August 2012 - 12:26 AM
id would need to be changed to arg1, and you'd need to end the do, but yes.
so:
while true do
event, arg1, arg2 = os.pullEvent()
if event == "rednet_message" and arg1 == "5" then
mon.write(arg1)
mon.write(" " .. arg2)
end
end
thank you
14 posts
Posted 30 August 2012 - 12:34 AM
no probs, just trying to help.