18 posts
Location
Goshen, IN
Posted 27 February 2016 - 02:40 AM
Hello,
I am trying to write a series of programs for inventory management with turtles. The first thing I'm working on is Furnace management. Similar to Nitrogen finger's version, but with my own twist.
The main thing I'm having an issue with is the management. I want to figure out how to get the turtle to detect the difference between furnace fuel and smeltable items…now I KNOW I could just make it so that you HAVE to put fuel in slot 1, and items in slot 2, etc…but that's too simple for my taste. If I have to use tables I'm find with it. Just give me the starting piece of it, so I know the basic layout, (I'm still trying to learn tables) and maybe tell me how to add on to it?
Thanks in advance!
AngryDragonoid
1080 posts
Location
In the Matrix
Posted 27 February 2016 - 03:00 AM
A turtle uses the same fuel that a furnace uses.
for i = 1,16 do
turtle.select(i)
if turtle.fuel(0) then
print("Item in slot " .. i .. " can be used for fuel")
end
end
Edited on 27 February 2016 - 02:00 AM
3057 posts
Location
United States of America
Posted 27 February 2016 - 03:09 AM
for i = 1,16 do
turtle.select(i)
if turtle.refuel(0) then
print("Item in slot " .. i .. " can be used for fuel")
end
end
Fixed your code :)/>
1080 posts
Location
In the Matrix
Posted 27 February 2016 - 05:37 AM
A turtle uses the same fuel that a furnace uses.
for i = 1,16 do
turtle.select(i)
if turtle.refuel(0) then
print("Item in slot " .. i .. " can be used for fuel")
end
end
Edit: Thanks KoGY, forgot that it's turtle.refuel and not turtle.fuel
18 posts
Location
Goshen, IN
Posted 27 February 2016 - 03:44 PM
1) I'm on unlimited fuel.
2) That won't work for normal items too will it? Items to be smelted??
1080 posts
Location
In the Matrix
Posted 28 February 2016 - 03:16 AM
turtle.refuel(0) is really just a check, it "tries" to refuel with the item that is selected by using exactly 0 of that item. If the item was a fuel item then it could use that item and it returns true, however it doesn't consume it since it used 0. It's the easiest way of checking if certain items are fuel without caring which item it is exactly.
34 posts
Location
Minecraftia
Posted 04 March 2016 - 06:11 AM
Things that would make turtles better.
a way to get the ID of a block returns string "minecraft:block"
a way to get the ID of a block or item in inventory returns string "minecraft:block", or "minecraft:item"
a way to get the ID of a block or item in a specified slot in a chest that is in front above or below the turtle returns string "minecraft:item", or "minecraft:block"
a way to get the ID of a block or item in a specified slot in a furnace that is in front above or below the turtle returns string "minecraft:item", or "minecraft:block"
ex: turtle.getItem(slot)
ex: turtle.getBlock()
ex: turtle.getBlockUp()
ex: turtle.getContainerItem(slot)
1080 posts
Location
In the Matrix
Posted 04 March 2016 - 08:53 AM
Perhaps your ideas would be better suited for the suggestions forum.
2427 posts
Location
UK
Posted 04 March 2016 - 01:49 PM
Things that would make turtles better.
a way to get the ID of a block returns string "minecraft:block"
a way to get the ID of a block or item in inventory returns string "minecraft:block", or "minecraft:item"
a way to get the ID of a block or item in a specified slot in a chest that is in front above or below the turtle returns string "minecraft:item", or "minecraft:block"
a way to get the ID of a block or item in a specified slot in a furnace that is in front above or below the turtle returns string "minecraft:item", or "minecraft:block"
ex: turtle.getItem(slot)
ex: turtle.getBlock()
ex: turtle.getBlockUp()
ex: turtle.getContainerItem(slot)
http://computercraft.info/wiki/Turtle.getItemDetail