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

The same Program dont work in 1.45 as for 1.46

Started by ROBdk97, 27 October 2012 - 10:09 PM
ROBdk97 #1
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)
ROBdk97 #2
Posted 28 October 2012 - 12:15 AM
Oh in the Error message stod something with "Expectet Number"
Luanub #3
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()
ROBdk97 #4
Posted 28 October 2012 - 12:20 AM
Yes I do.
I use the code what you printed
Luanub #5
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
Sebra #6
Posted 28 October 2012 - 06:23 AM
Just print your FuelLevel.
Chances it will be "unlimited". :D/>/>
ROBdk97 #7
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 !!
BigSHinyToys #8
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
ROBdk97 #9
Posted 28 October 2012 - 08:30 AM
Oh I so Stupid I forget that I denyed that turtles net fuel