Loc

by: Zinal001

1 Vote0 Comments1 File (22 bytes)

A location API for turtles!

The API has several function related to position and direction of the turtle.

The API saves the position of the turtle every whenever you move it using the functions included in the API.
NOTE: If you move the turtle by the default turtle API (for example using turtle.forward()), then the API cannot detect that and it's position will be out of sync!

Turtle Digging Turtle Felling Turtle Mining Turtle Wireless Turtle

Save this file on the turtle (preferably in a direction called Loc) and load it using os.loadAPI("Loc/Loc") (or just os.loadAPI("Loc") if you dont want to save it in a it's own directory)

Function list:
* setPosition(x, y, z, dir) - Sets the position and direction of the turtle
* getPosition() - Returns the position of the turtle (As a vector)
* getDirection() - Returns the direction of the turtle (A number between 0 and 3. 0 and 3 included)
* setGotoOrder(first, second, third) - Sets the order in which the turtle should move when the gotoPosition() function is used. Each argument should be either "x", "y" or "z" (default is "x", "z", "y")
* getGotoOrder() - Returns the goto order as a table, each element containing either "x", "y" or "z"
* savePosition() - Save the current position to a file located at "Loc/location". Several functions do this (see notes below)
* restorePosition() - Restores the position from the file saved by the savePosition() function.
* up() - makes the turtle go up (Also saves the position using savePosition() )
* down() - makes the turtle go down (Also saves the position using savePosition() )
* left() - makes the turtle turn left (Also saves the position using savePosition() )
* right() - makes the turtle turn right (Also saves the position using savePosition() )
* forward() makes the turtle go forward in the direction it's facing (Also saves the position using savePosition() )
* back() makes the turtle go backward in the direction it's facing (Also saves the position using savePosition() )
* turnTo(dir) - Makes the turtle turn to a specific direction (dir should be a number between 0 and 3. 0 and 3 included) (Also saves the position using savePosition() )
* gotoPosition(x, y, z) - Makes the turtle go to a specific position indicated by the x, y and z arguments (Note: this uses the goto order set using the setGotoOrder() function) (Also saves the position using savePosition() )

Check the file itself to see the actual Docs of each function.
Key Filename Size Options
#gjdi8i Loc 22 bytes Download View/Install
Feature Matrix:
Feature Required Optional Unused
Advanced Computer Unused
Advanced Monitor Unused
Computer Unused
Monitor Unused
Disk Drive Unused
Turtle Required
Digging Turtle Optional
Felling Turtle Optional
Mining Turtle Optional
Wireless Turtle Optional
RedPower Support:
Feature Required Optional Unused
Bundled Cable Unused
ccSensors Support:
Feature Required Optional Unused
ccSensors Unused
MiscPeripherals Support:
Feature Required Optional Unused
Feeding Turtle Unused
Chunk Loader Turtle Unused
Laser Turtle Unused
Resupply Turtle Unused
Solar Turtle Unused
Shearing Turtle Unused
Compass Turtle Unused
Wrench Turtle Unused
Treetap Turtle Unused
Alchemist Turtle Unused
Sign Reader Turtle Unused
REther Turtle Unused
Tank Turtle Unused
Inventory Turtle Unused
Thaum Scanner Turtle Unused
MFFS Turtle Unused
RTG Turtle Unused
Charge Station Unused
Iron Note Block Unused
Resupply Station Unused
Interactive Sorter Unused
Gate Reader Unused
Rail Reader Unused
Nuclear Information Reader Unused
Turtle Teleporter Unused
Player Detector Unused
Computer Controlled Crafter Unused
Tree Analyzer Unused

User Comments 0 Comments


Leave a comment:
You must be logged in to add a comment.