Jump to content




[halp?] missing programs


  • You cannot reply to this topic
11 replies to this topic

#1 LuaEclipser

  • Banned
  • 220 posts
  • LocationCleveland, Ohio

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

#2 Willibilly19

  • Members
  • 48 posts
  • LocationColorado, USA

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.

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

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?

#4 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

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

#5 LuaEclipser

  • Banned
  • 220 posts
  • LocationCleveland, Ohio

Posted 10 March 2013 - 04:42 AM

i tried all that

#6 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

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.

#7 LuaEclipser

  • Banned
  • 220 posts
  • LocationCleveland, Ohio

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

#8 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 11 March 2013 - 02:54 PM

View PostLuaEclipser, on 11 March 2013 - 01:59 PM, said:

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.

#9 Left

  • Members
  • 88 posts

Posted 11 March 2013 - 03:04 PM

Try turtle.getFuelLevel() with the brackets

#10 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 11 March 2013 - 03:27 PM

View PostLinearus, on 11 March 2013 - 03:04 PM, said:

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


#11 LuaEclipser

  • Banned
  • 220 posts
  • LocationCleveland, Ohio

Posted 13 March 2013 - 03:12 PM

i did
fel = turtle.getFuelLevel()
if fel < 1 then
print("No Fuel")


#12 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 13 March 2013 - 03:32 PM

So what did it output? "No fuel"? Or attempt to call nil?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users