This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Walrusjockey's profile picture

Help a Noob plz

Started by Walrusjockey, 09 January 2013 - 02:18 PM
Walrusjockey #1
Posted 09 January 2013 - 03:18 PM
I am trying to write a code, and its one of my first with out a tutorial or such.

while turtle.getFuelLevel < 3 do
turtle.select(16)
turtle.refuel(3)

if turtle.getFuelLevel > 200 then p = true

if true ~= p then print "not ready"
end
theoriginalbit #2
Posted 09 January 2013 - 03:21 PM
hello Walrusjockey, this is the wrong section of the forums, coding questions should be in "Ask a Pro" I have requested a move for you. also please use [code] [/code] tags around your code, or if its sizeable, use pastebin :)/>

now as for the problem. I'm assuming its something to do with the fact that its not running? thats because you missed the () on turtle.getFuelLevel. this is a function and when being called requires the () at the end of it :)/>

EDIT: also after further inspection this

if turtle.getFuelLevel() > 200 then p = true
will never actually happen since the loop only runs when the fuel level is less than 3 and you then refuel it with 3 fuel, it would immediately exit.
PixelToast #3
Posted 09 January 2013 - 03:31 PM
you need a matching end for every if statement
you didnt need them anyway :P/>
while turtle.getFuelLevel < 3 do
turtle.select(16)
turtle.refuel(3)
print "refueling.."
end