New method for turtle API - direction.
#1
Posted 21 October 2012 - 07:07 PM
#2
Posted 21 October 2012 - 07:22 PM
#3
Posted 21 October 2012 - 07:25 PM
Use some peripheral instead or setup a GPS network.
#4
Posted 21 October 2012 - 08:26 PM
It is important to note that gps can't directly give you the direction, and that could be where it is added, but I guess it's still a no.
#5
Posted 21 October 2012 - 08:41 PM
#6
Posted 21 October 2012 - 10:51 PM
x1,y1,z1 = gps.locate(2,true) turtle.forward() if x1 then --there is a GPS system x2,_,z2 = gps.locate(2) x2,z2 = x2-x1,z2-z1 endx2,z2 now contain which axis you moved on and which direction.
There is also at least one peripheral mod that lets you craft a compass turtle...I may think it's not very useful but the option is there.
Edited by ChunLing, 21 October 2012 - 10:52 PM.
#7
Posted 22 October 2012 - 03:33 PM
Otherwise, it's trivial to set up two alternate right and left functions that remember how many times your turtle turned so you can always get the direction. Only problem might be that this system would be relative to turtle's first direction when you placed it down.
#8
Posted 22 October 2012 - 07:13 PM
And it's not always possible to move a turtle... Not to mention that I have to setup a gps network to have a workaround for something that would not bother me if CC was keeping it's state and would continue programs
Thanks for the tip about the compass peripheral - I'm gonna look into it.
Edit: Not that useful, I'm afraid. I need every kind of turtle to be able to tell direction, not just one specific kind.
#9
Posted 22 October 2012 - 07:53 PM
CrazyCatLady, on 22 October 2012 - 07:13 PM, said:
And it's not always possible to move a turtle... Not to mention that I have to setup a gps network to have a workaround for something that would not bother me if CC was keeping it's state and would continue programs
Thanks for the tip about the compass peripheral - I'm gonna look into it.
Edit: Not that useful, I'm afraid. I need every kind of turtle to be able to tell direction, not just one specific kind.
Then save the direction to disk whenever you rotate. However I'll see if we can add it.
Persistence will be coming to CC eventually.
#10
Posted 22 October 2012 - 07:55 PM
It might seem like a slim chance but this happens quite frequently for me. Not so with rotating, but with moving (save coordinates and then move). That is why none of my moving-related turtles are autostarted.
AFAIK nearly every turtle can be combined with compass peripheral?
#11
Posted 22 October 2012 - 08:20 PM
matejdro, on 22 October 2012 - 07:55 PM, said:
It might seem like a slim chance but this happens quite frequently for me. Not so with rotating, but with moving (save coordinates and then move). That is why none of my moving-related turtles are autostarted.
AFAIK nearly every turtle can be combined with compass peripheral?
Then only save after it has moved?
#12
Posted 22 October 2012 - 08:22 PM
#13
Posted 22 October 2012 - 09:03 PM
matejdro, on 22 October 2012 - 08:22 PM, said:
Possible but less likely. One easier way to be sure is to queue the turtle movement using turtle.native.turnLeft().
#14
Posted 22 October 2012 - 09:08 PM
#16
Posted 22 October 2012 - 11:50 PM
#17
Posted 24 October 2012 - 03:28 PM
#18
Posted 24 October 2012 - 03:34 PM
#19
Posted 24 October 2012 - 03:53 PM
#20
Posted 09 December 2012 - 07:41 AM
If instead one saved part of the state, e.g. the turtle.native queue, or in general peripheral's requests queue's, one would guarantee that peripheral calls would be executed. Then again I'm theorizing on incomplete information about how CC works internally. Just my two bits.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











