Smart Turtles

Bane83

New Member
Jul 29, 2019
17
0
0
For the story to this point, see: Smarter Turtles: A Teaser

I am pleased to release Smarter Turtles v0.1 ALPHA (I cannot stress enough that this is an alpha): PasteBin: W41ywiNn

DISCLAIMER: Smarter Turtles v0.1 alpha release has not been rigorously tested, though initial tests look good. However, I accept no responsibility for any damages caused by using this script on your server. By using this script you agree to release me from responsibility for all manner of actions, losses, demands, so-on-and-so-forth.

LICENSE: You are given free use of this script, however the code does still belong to me and so you are not granted permission to redistribute, modify, or claim this code as your own.

Currently Implemented
The full documentation is too large to fit here, so I needed to put that on PasteBin as well: 5e2Bp7SX
turtle.up(n, afterEachMove, retryOnFail)
turtle.down(n, afterEachMove, retryOnFail)
turtle.back(n, afterEachMove, retryOnFail)
turtle.forward(n, afterEachMove, retryOnFail)
turtle.left(n, reorientAfterEachMove, reorientWhenDone, afterEachMove, retryOnFail)
turtle.right(n, reorientAfterEachMove, reorientWhenDone, afterEachMove, retryOnFail)
turtle.dig(n, afterEachDig, whenDone, retryOnFail)
turtle.digUp(n, afterEachDig, whenDone, retryOnFail)
turtle.digDown(n, afterEachDig, whenDone, retryOnFail)

Installation
  1. Download the script to your turtle via pastebin get W41ywiNn smarter_turtles (or whichever file name you prefer)
  2. Update (or create) your startup file with the following line: os.run(_G, "smarter_turtles")
    • Or use whatever you named the file other than "smarter_turtles"
    • This will add the code from the smarter_turtles script into the global environment and overwrite the default turtles behaviour
  3. Reboot the turtle
An important note is that this will overwrite the existing turtle API meaning everything will be accessible directly off of the turtle API without having to include anything special in your programs. Any existing code will automatically be updated to use the new API as well. Not to fear, though, as everything I've created so far is backwards compatible. If there's anything I can't make backwards compatible, it will get a name that does not clash with the turtle API. If you need access to the original turtle API it's available via turtle.original

My Request To You!
This project can only grow through feedback from you. I am, admittedly, rather new to Lua and I'm sure there are things that weren't implemented quite optimally. If you have any feedback whether it be:
  • Regarding the API and how to improve function calls
  • New features for the API
  • How to make the code better
  • Etc
PLEASE do share your thoughts! I will carefully consider any change requests that are made and will inform you, here, whether or not they can/will be included.

Thanks!