Posted 10 January 2013 - 08:01 AM
Worked on a couple APIs that have simplified some of my other turtle scripts. As the title implies, they are simple APIs so they leave out a bunch of the checking that should probably be in place.
util_move http://pastebin.com/9ztmF89F :
The axis I chose was a forward, right, down axis from the initial orientation of the turtle. Each of the movement functions updates the turtle's location on a stored grid [position] so using Forward and MoveTo interchangably is acceptable. As a note, Forward, Up and Down move the amount provided or 1 space if no parameter is provided.
functions:
I wanted to make item selection, checking and placing easier along with refueling.
functions:
util_move http://pastebin.com/9ztmF89F :
The axis I chose was a forward, right, down axis from the initial orientation of the turtle. Each of the movement functions updates the turtle's location on a stored grid [position] so using Forward and MoveTo interchangably is acceptable. As a note, Forward, Up and Down move the amount provided or 1 space if no parameter is provided.
functions:
- TurnTo ( direction ) – accepts "forward", "right", "back", "left"
- Forward ( amount ) – moves in the direction it's facing with digging and attacking
- MoveTo ( forward, right, down ) – moves to a specific position on the grid [0, 0, 0 is start]
- TurnAround() – flips the direction of the turtle
- Up ( amount ) – moves up with digging and attacking
- Down ( amount ) – moves down with diging and attacking
I wanted to make item selection, checking and placing easier along with refueling.
functions:
- DropAll() – drops all the items from the turtle
- MoveAll( from, to ) – moves all items from 1 slot to another
- FuelNeeded ( moves ) – displays the Fuel needed for the suspected # of moves. Pretty sure the math is wrong here.
- Refuel ( slot ) – uses up all the fuel in the given slot
- RefuelAll() – tries to refuel using the entire turtle inventory
- NonEmptySlot() – gets the next available slot that is not empty
- PlaceNext() – places the next available block down, if it can't it digs or attacks what is ever in the way
- ConfirmFull() – returns true is the turtle is fuel, false if not. It checks against the maximum stack size, not comparing to 64
- ConfirmAmount( amount ) – returns true if the amount of items on the turtle meets or exceeds the given amount, false if not.