Posted 22 July 2015 - 01:13 PM
Hi,
I am currently in the making of an Improved Turtle API. I am currently stuck on "turtle.place()" because the default Turtle API allows you to engrave text on a sign. I have got it working to place the sign, but, I cannot make it put the text on the sign.
Any help will be appreciated,
ZiR
WARNING: Be prepared for a VERY long code when opening this spoiler…
The place function is at the very bottom!
I am currently in the making of an Improved Turtle API. I am currently stuck on "turtle.place()" because the default Turtle API allows you to engrave text on a sign. I have got it working to place the sign, but, I cannot make it put the text on the sign.
Any help will be appreciated,
ZiR
WARNING: Be prepared for a VERY long code when opening this spoiler…
The place function is at the very bottom!
Spoiler
local oldTurtle = turtle
function turnRight( int )
int = int or 1
repeat
oldTurtle.turnRight()
int = int - 1
until int == 0
end
function turnLeft( int )
int = int or 1
repeat
oldTurtle.turnLeft()
int = int - 1
until int == 0
end
function forward( int )
int = int or 1
repeat
oldTurtle.forward()
int = int -1
until int == 0
end
function back( int )
int = int or 1
repeat
if oldTurtle.back() then
oldTurtle.back()
int = int - 1
else
error( "Movement Obstructed while performing command: back", 0 )
end
until int == 0
end
function up( int )
int = int or 1
repeat
if oldTurtle.up() then
oldTurtle.up()
int = int - 1
else
error( "Movement Obstructed whilst performing command: up" , 0 )
end
until int == 0
end
function down( int )
int = int or 1
repeat
if oldTurtle.down() then
oldTurtle.down()
int = int - 1
else
error( "Movement Obstructed whilst performing command: down" , 0 )
end
until int == 0
end
function attack( int )
int = int or 1
repeat
oldTurtle.attack( int )
int = int - 1
until int == 0
end
function attackUp( int )
int = int or 1
repeat
oldTurtle.attackUp()
int = int - 1
until int == 0
end
function attackDown( int )
int = int - 1
repeat
oldTurtle.attackDown()
int = int - 1
until int == 0
end
function select( int )
if int > 16 then
error( "Cannot select that slot!" , 0 )
elseif int < 1 then
error( "Cannot select that slot!" , 0 )
elseif int > 0 and int < 17 then
oldTurtle.select( int )
end
end
function refuel( int )
int = int or 1
repeat
for i = 1,16 do
turtle.select(i)
if oldTurtle.refuel(0) then
turtle.refuel( int )
end
end
int = int - 1
until int == 0
end
function dig( int )
int = int or 1
repeat
oldTurtle.dig()
int = int - 1
until int == 0
end
function digUp( int )
int = int or 1
repeat
oldTurtle.digUp()
int = int - 1
until int == 0
end
function digDown( int )
int = int or 1
repeat
oldTurtle.digDown()
int = int - 1
until int == 0
end
function suck()
oldTurtle.suck()
end
function suckUp()
oldTurtle.suckUp()
end
function suckDown()
oldTurtle.suckDown()
end
function equip( slot , side )
if side == "right" then
local currentSlot = oldTurtle.getSelectedSlot()
turtle.select( slot )
oldTurtle.equipRight( slot )
turtle.select( currentSlot )
elseif side == "left" then
local currentSlot = oldTurtle.getSelectedSlot()
turtle.select( slot )
oldTurtle.equipLeft()
turtle.select( currentSlot )
elseif not slot then
error( "Where can I find said tool ?")
elseif not side then
error( "I am not a psychic, I do not know what side you want me to equip this tool on." , 0 )
else
error( "Side not found" , 0 )
end
end
function craft( quantity )
oldTurtle.craft( quantity )
end
function getSelectedSlot()
oldTurtle.getSelectedSlot()
end
function getItemCount( slot )
if not slot then
oldTurtle.getItemCount( oldTurtle.getSelectedSlot( ) )
else
oldTurtle.getItemCount( slot )
end
end
function getItemSpace( slot )
if not slot then
oldTurtle.getItemSpace( oldTurtle.getSelectedSlot( ) )
else
oldTurtle.getItemSpace( slot )
end
end
function getItemDetail( slot )
if not slot then
oldTurtle.getItemDetail( oldTurtle.getSelectedSlot( ) )
else
oldTurtle.getItemDetail( slot )
end
end
function place( signText )
if signText then
end
oldTurtle.place()
end
function placeUp()
end
function placeDown()
end
Edited on 22 July 2015 - 11:14 AM