Jump to content




Need Help With Programming Turtle From Direwolf20 S5 Ep24


  • You cannot reply to this topic
1 reply to this topic

#1 bishopb65

  • New Members
  • 1 posts

Posted 03 September 2013 - 11:42 PM

I know he has his stuff set up great, but I'm running the ultimate mod pack and not his. Makes things a little tougher to get. anyway heres the code


local location = ""

function teleport()
tp = peripheral.wrap("bottom")
tp.teleport()
end

function checkFull()
greader = peripheral.wrap("right")
data = greader.get()
while not data["Full Energy"] do
sleep(2)
data=greader.get()
end
turtle.dig()
end

function checkEmpty()
greader=peripheral.wrap("right")
data = greader.get()
while not data["No Energy"] do
sleep(2)
data = greader.get()
end
turtle.dig()
end

function checkLoc()
loc = turtle.detectUp()
if loc == true then
print("I am at the quarry")
location = "Quarry"
if turtle.getItemCount(1) > 0 then turtle.turnRight() end
else
print("I am at the charge station")
location = "Charging"
if turtle.getItemCount(1) > 0 then
turtle.turnRight()
turtle.forward()
turtle.forward()
end
end
end

function getFuel()
turtle.turnleft()
for i = 1, 8 do turtle.forward() end
turtle.turnLeft()
for i = 1, 2 do turtle.forward() end
turtle.suck()
turtle.refuel()
turtle.turnLeft()
turtle.turnLeft()
for i = 1, 2 do turtle.forward() end
turtle.turnRight()
for i = 1, 8 do turtle.forward() end
turtle.turnleft()
end


function checkFuel()
fuel = turtle.getFuelLevel()
print("My fuel level:"..tostring(fuel))

if fuel < 1000 then
print("I need fuel")
getFuel()
print("My fuel level:"..tostring(turtle.getFuelLevel()))
end
end


checkLoc()
if location == "Quarry" then
turtle.place()
checkEmpty()
teleport()
else
turtle.place()
checkFuel()
checkFull()
turtle.turnLeft()
turtle.turnLeft()
turtle.forward()
turtle.forward()
teleport()
end


i get...bios :338: [string "teleport"]:8: '='
expected

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 September 2013 - 11:48 AM

Split into new topic.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users