Posted 14 February 2015 - 11:43 AM
Hey there.
I'm currently trying to setup a room with CC to control powered spawner.
The idea behind this is to check the content of my ME for mob drops.
If there are not enough items from one type CC should give an rs output to start a spawner till enough of the items are inside of my ME.
For now everything is working fine but i'm stuck at creating and using tables for all the different items.
Currently my script looks like this:
With this script i can check the item inside "test" and its working.
The problem is that i need more then one item so i need more then one table.
It would look something like this:
The biggest problem for me on this point is to check every item i need.
I have no clue how to create a single table that contains all these items and run the "updateList()" function for all of these.
I realy hope someone here can help me to fix this problem and hopefully finally to understand this tables.. :/
Sorry for my bad english, i hope its not to hard to understand.
I'm currently trying to setup a room with CC to control powered spawner.
The idea behind this is to check the content of my ME for mob drops.
If there are not enough items from one type CC should give an rs output to start a spawner till enough of the items are inside of my ME.
For now everything is working fine but i'm stuck at creating and using tables for all the different items.
Currently my script looks like this:
Spoiler
local sSide = "left"
local me = peripheral.find("tileinterface")
local test = {
color = colors.red,
id = "Thaumcraft:ItemManaBean",
nbt = "ad5cc1bd74d2230c5c483e4c1bbc7948",
dmg = 0,
qty = 10
}
local function updateList()
local newlist = me.getAvailableItems()
for num,item in pairs(newlist) do
if test.nbt == "" then
if item.fingerprint.id == test.id and item.fingerprint.dmg == test.dmg and item.size < test.qty then
rs.setBundledOutput(sSide,colors.combine(rs.getBundledOutput(sSide),test.color))
elseif item.fingerprint.id == test.id and item.fingerprint.dmg == test.dmg and item.size >= test.qty then
rs.setBundledOutput(sSide,colors.subtract(rs.getBundledOutput(sSide), test.color))
end
else
if item.fingerprint.id == test.id and item.fingerprint.dmg == test.dmg and item.fingerprint.nbt_hash == test.nbt and item.size < test.qty then
rs.setBundledOutput(sSide,colors.combine(rs.getBundledOutput(sSide), test.color))
elseif item.fingerprint.id == test.id and item.fingerprint.dmg == test.dmg and item.fingerprint.nbt_hash == test.nbt and item.size >= test.qty then
rs.setBundledOutput(sSide,colors.subtract(rs.getBundledOutput(sSide), test.color))
end
end
end
end
local function startScan()
rs.setBundledOutput(sSide, 0)
while true do
updateList()
sleep(1)
end
end
startScan()
With this script i can check the item inside "test" and its working.
The problem is that i need more then one item so i need more then one table.
It would look something like this:
Spoiler
leather = {
color = colors.red,
id = "minecraft:leather",
nbt = "",
dmg = 0,
qty = 64
}
feather = {
color = colors.green,
id = "minecraft:feather",
nbt = "",
dmg = 0,
qty = 64
}
blazerod = {
color = colors.brown,
id = "minecraft:blaze_rod",
nbt = "",
dmg = 0,
qty = 128
}
witherskull = {
color = colors.blue,
id = "minecraft:skull",
nbt = "",
dmg = 1,
qty = 30
}
inksack = {
color = colors.purple,
id = "minecraft:dye",
nbt = "",
dmg = 0,
qty = 128
}
wool = {
color = colors.cyan,
id = "minecraft:wool",
nbt = "",
dmg = 0,
qty = 128
}
bones = {
color = colors.lightGray,
id = "minecraft:bone",
nbt = "",
dmg = 0,
qty = 128
}
gunpowder = {
color = colors.gray,
id = "minecraft:gunpowder",
nbt = "",
dmg = 0,
qty = 256
}
slimeball = {
color = colors.pink,
id = "minecraft:slime_ball",
nbt = "",
dmg = 0,
qty = 128
}
ghasttear = {
color = colors.lime,
id = "minecraft:ghast_tear",
nbt = "",
dmg = 0,
qty = 64
}
pinkslimeball = {
color = colors.yellow,
id = "MineFactoryReloaded:pinkslime",
nbt = "",
dmg = 0,
qty = 72
}
mana_ignis = {
color = colors.lightBlue,
id = "Thaumcraft:ItemManaBean",
nbt = "ad5cc1bd74d2230c5c483e4c1bbc7948",
dmg = 0,
qty = 256
}
mana_terra = {
color = colors.lightBlue,
id = "Thaumcraft:ItemManaBean",
nbt = "bb9211b894dea99a6b674ebe63759333",
dmg = 0,
qty = 256
}
mana_aer = {
color = colors.lightBlue,
id = "Thaumcraft:ItemManaBean",
nbt = "64630f917da3a7214b1ef2c91a90d090",
dmg = 0,
qty = 256
}
mana_aqua = {
color = colors.lightBlue,
id = "Thaumcraft:ItemManaBean",
nbt = "358c318e194980b0c0835a9f1ce41750",
dmg = 0,
qty = 256
}
mana_ordo = {
color = colors.lightBlue,
id = "Thaumcraft:ItemManaBean",
nbt = "a77c4b35bbb1a4c84b15122dd52354bf",
dmg = 0,
qty = 256
}
mana_perditio = {
color = colors.lightBlue,
id = "Thaumcraft:ItemManaBean",
nbt = "18add493aeeb97a3fe71cf8130fe8675",
dmg = 0,
qty = 256
}
The biggest problem for me on this point is to check every item i need.
I have no clue how to create a single table that contains all these items and run the "updateList()" function for all of these.
I realy hope someone here can help me to fix this problem and hopefully finally to understand this tables.. :/
Sorry for my bad english, i hope its not to hard to understand.