Jump to content




Tortoise API (better turtles)


  • You cannot reply to this topic
25 replies to this topic

#1 HDeffo

  • Members
  • 214 posts

Posted 27 February 2016 - 05:06 PM

Yet another API designed to make turtle functions more robust. Includes functionality improvements on native functions, additional functions, facing and position memorization, and much more



pastebin get 34Lb30Dj tortoise





documentation

The only reason this doesn't have more functions is because I don't know what else to add. If theres something else you want please let me know :D

I will not add pathfinding. That requires large algorithms and several functions on its own. Something like that deserves its own API entirely.





Credit to kingofgamesyami as this started out as a simple rewrite of LAMA

Edited by HDeffo, 20 November 2016 - 01:57 PM.


#2 Diaqon

  • Members
  • 4 posts

Posted 29 February 2016 - 03:46 PM

Nice API overall, but your "tortoise.becomeTurtle()" function seems to break refueling the turtle
Unable to use default "refuel" program, and can't refuel using lua interpreter either.

#3 HDeffo

  • Members
  • 214 posts

Posted 29 February 2016 - 07:55 PM

hmm it was working when I tested it last. I will see if I can fix that thanks Diaqon!

#4 HDeffo

  • Members
  • 214 posts

Posted 29 February 2016 - 08:10 PM

Bug fixed :D .....I messed up a single if statement in a previous update and broke everything >.>

#5 HDeffo

  • Members
  • 214 posts

Posted 01 March 2016 - 03:33 AM

just added a new function digAll. Made specifically for things like trees and ore veins!

#6 Lupus590

  • Members
  • 2,028 posts
  • LocationUK

Posted 01 March 2016 - 10:38 AM

This sounds like something which could have a lot of use in hive. What license are you releasing this under? http://choosealicense.com/

#7 HDeffo

  • Members
  • 214 posts

Posted 01 March 2016 - 06:17 PM

check my signature, it is my attempt to avoid the whole licensing thing. I am writing this for a game so I don't see a reason to get all ownership conscious of it. This counts as an API. If a license is really important just treat it like MIT

#8 HDeffo

  • Members
  • 214 posts

Posted 01 March 2016 - 06:34 PM

New Update
  • new undoForce and undoAllForce functions
  • all functions which could previously take a name can now also take damage as another variable. This lets you specify even different types of logs and such.
  • digAll, digAllUp, digAllDown are all slightly faster by at least 25% (in some cases more so)

Edited by HDeffo, 02 March 2016 - 05:03 AM.


#9 taz4hvn

  • Members
  • 4 posts

Posted 05 July 2016 - 10:28 AM

Maybe you can help, I'm new to CC, lua and even more APIs !
I made:

"pastebin get HC5SwGdv tortoise" in my turtle, got it

I made a simple script to test:

os.loadAPI("tortoise")
tortoise.forwardForce()
tortoise.backForce()


forward worked and then I get a:

tortoise:218: attempt to index ? (a nil value)

Did I miss smthg ?

#10 Lupus590

  • Members
  • 2,028 posts
  • LocationUK

Posted 05 July 2016 - 12:26 PM

View Posttaz4hvn, on 05 July 2016 - 10:28 AM, said:

-snip-

can we see your code?

edit: note to self, read

Edited by Lupus590, 05 July 2016 - 07:11 PM.


#11 taz4hvn

  • Members
  • 4 posts

Posted 05 July 2016 - 04:03 PM

Thanks for the answer.

There's no more code to show you really, I made a simple script with these three lines:

os.loadAPI("tortoise")
tortoise.forwardForce()
tortoise.backForce()


and got a:

tortoise:218: attempt to index ? (a nil value)

I checked the file, this line is in the tortoise.backForce() function.

#12 Lupus590

  • Members
  • 2,028 posts
  • LocationUK

Posted 05 July 2016 - 07:22 PM

edit the tortoise api and add this between lines 217 and 218

--#this is the new 218 line
if tTurtleData == nil then error(" tTurtleData is nil")
if tFacing == nil then error("tFacing is nil")

tell me which of the error messages turns up

#13 Gorzoid

  • Members
  • 44 posts

Posted 17 July 2016 - 02:10 PM

View Posttaz4hvn, on 05 July 2016 - 04:03 PM, said:

Thanks for the answer.

There's no more code to show you really, I made a simple script with these three lines:

os.loadAPI("tortoise")
tortoise.forwardForce()
tortoise.backForce()


and got a:

tortoise:218: attempt to index ? (a nil value)

I checked the file, this line is in the tortoise.backForce() function.
Typo in line 761 of his code, change sFaceing to sFacing

Edited by Gorzoid, 17 July 2016 - 02:11 PM.


#14 HDeffo

  • Members
  • 214 posts

Posted 05 August 2016 - 12:15 PM

Oops haha thought I fully tested all functions before uploading. I'll update and correct this bug in a few hours when I'm home

#15 Mantas

  • Members
  • 5 posts

Posted 08 August 2016 - 09:45 AM

Simple to use, and extremely useful. I don't think I'm ever using a turtle again without this API.

#16 block12345

  • Members
  • 12 posts

Posted 12 October 2016 - 10:04 PM

got an error but fixed it by putting south instead of South now it works fine :) cool api love it

Edited by block12345, 12 October 2016 - 10:13 PM.


#17 Sewbacca

  • Members
  • 450 posts
  • LocationStar Wars

Posted 13 October 2016 - 05:59 PM

I wanted to code something like that, but now i don't have to =)
One suggestion:
I would love turtle.redirect etc. functions.
I will, no i am going to use your API =)
Sewbacca

#18 Erzengel

  • New Members
  • 2 posts

Posted 16 November 2016 - 02:52 AM

Bug: If you have turtles set to infinite fuel, iFuel in data is set to "unlimited" and thus anywhere that iFuel is treated like a number the program crashes. For example, I initially get "tortoise:193: attempt to compare number with string expected, got number". I modified the code on my side to add the following function:
function enoughFuel(iNum)
if tTurtleData.iFuel == "unlimited" or iNum <= tTurtleData.iFuel then
  return true
else
  return false
end
end
and replaced every comparison against tTurtleData.iFuel with "enoughFuel(iNum)" or "not enoughFueld(iNum)" and now it works wonderfully.

#19 dropdead

  • Members
  • 14 posts

Posted 19 November 2016 - 04:42 PM

First: How do I know what Minecraft/CC version to use? It is hardly mentioned so I can't help the feeling this is common knowledge.

I don't really understand how to load this up. I'v tried it with MC 1.8.9 and CC 1.78.
I got the program connecting to pastebin (pastebin get HC5SwGdv tortoise) and tried
os.loadAPI("tortoise")
and it asked for the coordinates. After that I tried
tortoise.becomeTurtle()
but this error occured:
lua:1: attempt to index ? (a nil value)

Am I missing any other files? Any tips how to load it properly?

Maybe I don't understand something essential about using programs for the turtles. Lots of stuff just do not work and throws colorful error messages at me. I understand a bit of Java, PHP, Perl and other languages but Lua goes straight over my head because I either don't get the error messages at all or I look at the code and see nothing wrong anyway.

Help please?

P.S. If I sound in anyway offensive or my grammar/spelling is atrocious: English is not my native language.

#20 HDeffo

  • Members
  • 214 posts

Posted 19 November 2016 - 07:39 PM

View Postdropdead, on 19 November 2016 - 04:42 PM, said:

-snip-

Oh gosh I haven't been to this website in ages and it looks like I picked a good time! A long time back there was a rollback on the forums and it appears this was affected. The version posted is broken and should've been replaced by a fixed version. :3 I'll upload the correct version by tomorrow morning for you





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users