18 posts
Posted 14 December 2015 - 09:55 PM
Hi everyone.
I'm trying to make an automated spawner with the MFR auto-spawner using turtles and a monitor.
Everything's fine: Chest behinD the turtle and AutoSpawner in front of it. The turtle picks up a safarinet from the chest, puts it into the spawner and everything's fine.
Everything's controlled by a monitor attached to a computer.
The ONLY problem I have is that I need to show the Name of the SafariNet (Skeleton, Creeper, etc.): it shows up like "safarinet.reusable" instead of the actual name.. I tried renaming one of them with an anvil in "Skeleton" but it still sees it as "safarinet.reusable"
for i = 1, chest.getInventorySize() do
chslot = chest.getStackInSlot(i)
if (chslot) then
mobs [i] = {name = chslot.name, slot = i}
end
end
This is the code I use and I really don't know how to get the actual name of the item..
2427 posts
Location
UK
Posted 14 December 2015 - 09:58 PM
I believe direwolf20 had this problem in one of his let's plays and solved it by getting the turtle to look at the item's meta-data. One of the values in there has the mob name inside of the item.
18 posts
Posted 14 December 2015 - 10:12 PM
I believe direwolf20 had this problem in one of his let's plays and solved it by getting the turtle to look at the item's meta-data. One of the values in there has the mob name inside of the item.
Well, how did he do that? :/
2427 posts
Location
UK
Posted 14 December 2015 - 10:14 PM
I can't recall, but at a guess, turtle.inspect() or an openPeripherals function
18 posts
Posted 14 December 2015 - 10:18 PM
I can't recall, but at a guess, turtle.inspect() or an openPeripherals function
Well, since the inspect one is for block, I think I need to try something different..
2427 posts
Location
UK
Posted 14 December 2015 - 10:48 PM
turtle.getItemDetails sorry I commonly mix the two up when I don't check the wiki
18 posts
Posted 14 December 2015 - 11:12 PM
turtle.getItemDetails sorry I commonly mix the two up when I don't check the wiki
I tried with the getStackInSlot():
ID: MinecFactoryReloaded:safarinet.reusable
name: safarinet.reusable
Are there other strings to use?
2427 posts
Location
UK
Posted 15 December 2015 - 12:21 AM
I'm not too familiar with MFR, does getStackInSlot return a table? If yes then iterate through that table and print all of the keys in it
local item = chest.getStackInSlot() --#I don't actually know how to call this function so correct me if I'm wrong
for k, v in pairs(item) do
print(tostring(k)..": "..tostring(v)) --#it may be toString()
end
18 posts
Posted 15 December 2015 - 12:31 AM
I'm not too familiar with MFR, does getStackInSlot return a table? If yes then iterate through that table and print all of the keys in it
local item = chest.getStackInSlot() --#I don't actually know how to call this function so correct me if I'm wrong
for k, v in pairs(item) do
print(tostring(k)..": "..tostring(v)) --#it may be toString()
end
Well, feel like it's not possible.
1080 posts
Location
In the Matrix
Posted 15 December 2015 - 12:54 AM
Do the same loop, but instead of item do
item.safari_net
local item = chest.getStackInSlot()
for k, v in pairs(item.safari_net) do
print(tostring(k)..": "..tostring(v))
18 posts
Posted 15 December 2015 - 01:28 AM
Do the same loop, but instead of item do
item.safari_net
local item = chest.getStackInSlot()
for k, v in pairs(item.safari_net) do
print(tostring(k)..": "..tostring(v))
That is working beautifully! Thanks to both of you :)/>