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

Making a turtle move from within its hosted peripheral

Started by ingie, 19 June 2014 - 03:00 PM
ingie #1
Posted 19 June 2014 - 05:00 PM
Hi there.

on the back of "fixing" OpenCCSensors ;)/> …. well, a tiny little buglet - [ see their thread ] …. can anyone pay me a solid in return:


can anyone cleverer than i advise if there is any way of moving a turtle within a turtle peripheral other than with setDirection and teleportTo?

i have a lovely peripheral which i'm making, but i want the peripheral to command the turtle to move [dependent on a thing]
and whilst insta-teleporting and insta-turning with setDirection will "get me there" - it's not really the nice elegant journey I want :)/>


i was wondering initially if the executeCommand(ILuaContext context, ITurtleCommand command) would allow this, but looking deeper, it seems not…
seems weird to be a turtle's peripheral and not be able to make the turtle itself do the equivalent of the lua "turtle.forward()" etc…

either
a ) i'm missing something obvious; or
b ) i'm not

:)/>

many thankity thanks in advance.
Edited on 19 June 2014 - 03:00 PM
Lignum #2
Posted 19 June 2014 - 08:10 PM
I believe this belongs in the "Peripheral Help and Discussion" section.

Anyway, I'm not too experienced with peripheral development but having a quick look at ITurtleAccess, it appears to me that you need to play the moving animation manually with ITurtleAccess.playAnimation(TurtleAnimation).
ingie #3
Posted 20 June 2014 - 01:14 AM
I believe this belongs in the "Peripheral Help and Discussion" section.

very true… was thinking it was a pro cc question when that's really just usage of cc not coding the api, sorry about that… if it can be moved - that'd be cool by me.

Anyway, I'm not too experienced with peripheral development but having a quick look at ITurtleAccess, it appears to me that you need to play the moving animation manually with ITurtleAccess.playAnimation(TurtleAnimation).

derp. you're right… for some reason i'd scanned that method as being simply for tool animation… but now i look again, i seeeee….

many thanks.
Lignum #4
Posted 20 June 2014 - 01:26 AM
You're welcome.
ingie #5
Posted 20 June 2014 - 01:31 AM
update…

aye, it seems it's a combination of both.

i first used ITurtleAccess.teleportTo(World world, int x, int y, int z) to teleport the turtle.
and followed that directly with ITurtleAccess.playAnimation(TurtleAnimation animation) to make turtle do the teleport in it's proper smooth way

perfect.

many thanks again for pointing me at my lack of reading… [ i'd seen that it was "ToDo" documented at the top level of ITurtleAccess and stopped there as it's name wasn't a giveaway for what i thought i wanted ]
skwerlman #6
Posted 20 June 2014 - 03:15 AM
I believe this belongs in the "Peripheral Help and Discussion" section.

very true… was thinking it was a pro cc question when that's really just usage of cc not coding the api, sorry about that… if it can be moved - that'd be cool by me.
You can report your post if you'd like it moved.
Lyqyd #7
Posted 20 June 2014 - 05:50 AM
I'm fine with the topic being either here or there, but in Ask a Pro, it's likely to be seen by a wider audience.