17 posts
Location
Germany
Posted 28 October 2012 - 12:09 AM
Hallo my english is not very good but I found a bug ,
I have worked on an older Program and make it better but in the older CC version 1.45 it doesn't work (I haven't do anny code in who don' work ind older Versions)
The Error message says that ther is the Error:
if FuelLevel < 10 then
end
P
but when I make it so
if FuelLevel <= 10 then
end
The same Error but only in CC1.45.
Pleas help me I want to use my.Program in my Modded World (MC 1.3.2 with mods how not exist for MC 1.4.2)
17 posts
Location
Germany
Posted 28 October 2012 - 12:15 AM
Oh in the Error message stod something with "Expectet Number"
1111 posts
Location
Portland OR
Posted 28 October 2012 - 12:15 AM
How are you getting the FuelLevel? Are you using something like this? We probably need to see more of you're code and the exact error you are getting. If you're doing FuelLevel like I have done below both of the if statements should work.
FuelLevel = turtle.getFuelLevel()
17 posts
Location
Germany
Posted 28 October 2012 - 12:20 AM
Yes I do.
I use the code what you printed
1111 posts
Location
Portland OR
Posted 28 October 2012 - 12:34 AM
Okay so I've tried but I'm unable to duplicate this. It's probably something else wrong in you're code and not a bug. You should probably post the code and error message in ask-a-pro.
To validate that it works simply do this.
FuelLevel = turtle.getFuelLevel()
print(FuelLevel)
if FuelLevel < 10 then
print("it works")
end
I've tested in 1.4 and 1.46
724 posts
Posted 28 October 2012 - 06:23 AM
Just print your FuelLevel.
Chances it will be "unlimited". :D/>/>
17 posts
Location
Germany
Posted 28 October 2012 - 07:04 AM
The Error cames from the line with
if FuelLevel <= 10 then
And only in Cc 1.45. My Question is Why in CC 1.45 and only.ther in CC 1.46 work the Program and it gives no Error message back.
I dont now WHY It dont work in CC1.45 !!
992 posts
Posted 28 October 2012 - 08:19 AM
turtle.getFuelLevel() returns one of two things dependent on the setting in the config. if fule is on it returns a number if it is off it returns a string. you cant use <= on a string. run this code and post the results
local fuelL = turtle.getFuelLevel()
if type(fuelL) == "number" then
print("fuel is required status")
print(fuelL)
else
print("fuel not required")
print(fuelL)
end
17 posts
Location
Germany
Posted 28 October 2012 - 08:30 AM
Oh I so Stupid I forget that I denyed that turtles net fuel