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

Last Question: Checking if an item is [blank]

Started by Doobliheim, 24 November 2015 - 10:28 PM
Doobliheim #1
Posted 24 November 2015 - 11:28 PM
Quick question. I have my fueling function, but I wanted to have the turtle to check it's other inventory slots for coal before it shuts off if it's designated "fuel" slow runs out. I was thinking of using the "turtle.getItemDetail()" and then using a boolean to check if the slot has an item with the name "minecraft:coal". How would I go about checking if the returned name information matches "minecraft:coal"?

Last question, I promise :P/>
Dragon53535 #2
Posted 24 November 2015 - 11:33 PM

local x = "minecraft:iron"
if(x == "minecraft:coal") then
  --# Do stuff
end
local y = (x == "minecraft:coal")
if(y) then
  --#Do stuff
end
Bomb Bloke #3
Posted 24 November 2015 - 11:38 PM
You may be better off using turtle.refuel(0). This doesn't actually refuel the turtle, but it still returns true if the currently selected slot contains a valid fuel unit, or false if it does not.