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

Automated spawner with turtles: problem with Safari nets

Started by KiraGio, 14 December 2015 - 08:55 PM
KiraGio #1
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..
Lupus590 #2
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.
KiraGio #3
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? :/
Lupus590 #4
Posted 14 December 2015 - 10:14 PM
I can't recall, but at a guess, turtle.inspect() or an openPeripherals function
KiraGio #5
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..
Lupus590 #6
Posted 14 December 2015 - 10:48 PM
turtle.getItemDetails sorry I commonly mix the two up when I don't check the wiki
KiraGio #7
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?
Lupus590 #8
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
KiraGio #9
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.



Dragon53535 #10
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))
KiraGio #11
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 :)/>