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

[halp?] missing programs

Started by LuaEclipser, 10 March 2013 - 02:37 AM
LuaEclipser #1
Posted 10 March 2013 - 03:37 AM
hello it has come to my attention that i am missing the


turtle.getFuelLevel() form turtle API
and the pastebin program

i am running computercraft 1.5
Willibilly19 #2
Posted 10 March 2013 - 03:43 AM
turtle.getFuelLevel() isn't a program, go into the Lua interpreter to use it, or use the refuel program. The pastebin program is missing because you haven't enabled the HTTP API in your config file. Just change false to true next to the HTTP API option, it'll show up.
theoriginalbit #3
Posted 10 March 2013 - 03:48 AM
turtle.getFuelLevel … tried restarting the computer without startup scripts? you could have accidentally overridden it somewhere. so
print(turtle.getFuelLevel)
displays nil?
SuicidalSTDz #4
Posted 10 March 2013 - 04:36 AM
Test everything before posting a topic:

print(turtle.getFuelLevel)

if not http then print("HTTP seems to be disabled") end

Basic knowledge goes a long way
LuaEclipser #5
Posted 10 March 2013 - 04:42 AM
i tried all that
SuicidalSTDz #6
Posted 10 March 2013 - 04:57 AM
If you tried it then you would have noticed that http was not enabled and or the fuel level was, well, the turtle's current fuel level. If it didn't return ANYTHING then you should reinstall ComputerCraft.
LuaEclipser #7
Posted 11 March 2013 - 01:59 PM
and i uninstalled, and renstalled, and now i am missing paintutils draw Image. this is how i am using it;



image = pauntutils.loadImage(".gui")
paintutils.drawImage(image,1,1)

i get error, paintutils :92: attempt to get lenght of nil
theoriginalbit #8
Posted 11 March 2013 - 02:54 PM
and i uninstalled, and renstalled, and now i am missing paintutils draw Image. this is how i am using it;



image = pauntutils.loadImage(".gui")
paintutils.drawImage(image,1,1)

i get error, paintutils :92: attempt to get lenght of nil
No thats not 'missing' the paintutils draw image. its that the loadImage doesn't seem to be loading the image from '.gui' file. since paintutils is saying `attempt to get length of nil` and the drawing gets the length of the table.
Left #9
Posted 11 March 2013 - 03:04 PM
Try turtle.getFuelLevel() with the brackets
theoriginalbit #10
Posted 11 March 2013 - 03:27 PM
Try turtle.getFuelLevel() with the brackets
Who are you telling that too? the OP does have it… in any case I can't remember which thread I stated it in, seems it wasn't this one but … function calls use the brackets, to access the function pointer you do not use the brackets. for example if turtle.getFuelLevel existed it would do this

print( turtle.getFuelLevel() ) -- this would print the fuel level
print( turtle.getFuelLevel ) -- this would print "function: 3454345" or some such random numbers
so doing 'turtle.getFuelLevel' without brackets can be a very useful tool to see if a function exists, since it would be nil. here is an example of a good usage of checking function pointers

if not term.isColor then
  print "You are using a pre-CC1.4 Computer"
  print "You cannot change colours"
elseif term.isColor() then
  print "You are using an Advanced Computer"
  print "You can change colours to any of the 16"
else
  print "You are using a Normal Computer in CC1.4+"
  print "You can change colours only between black and white"
end
LuaEclipser #11
Posted 13 March 2013 - 03:12 PM
i did

fel = turtle.getFuelLevel()
if fel < 1 then
print("No Fuel")
theoriginalbit #12
Posted 13 March 2013 - 03:32 PM
So what did it output? "No fuel"? Or attempt to call nil?