m.getTanks("unknown")
anymore because everyscript gets an error on that one.And i cant seem to find the right part like the API for it.
Can somebody explain me this or if this is still working at all.
Thankyou
m.getTanks("unknown")
anymore because everyscript gets an error on that one.As I said before, you will need Open Peripherals (I think you will need core and integration for this).
I'm going to assume that you know how to build a railcraft tank. You will need it to have 3 valves, one for each: input, output and computer.
If you don't know how to use peripherals yet then read this.
Place the computer next to a valve.
Run this command into the terminal where side is the side that the tank valve is on the computer (front/back/left/right/up/down)If the computer says "no such program" then Open Peripherals is installed incorrectly. (You may need to check for case sensitivity, try ls or dir to print all files/folders)openp/docs <side>
If Open Peripheral is installed correctly, then the documentation of the tank will be printed.
table: 1298f94
startup:10: attempt to concatenate table and string
net = peripheral.wrap("back")
bridge = peripheral.wrap("left")
while true do
stored = net.callRemote("openblocks_tank_5","getTankInfo")
tank2 = net.callRemote("openblocks_tank_6","getTankInfo")
print(stored)
print(tank2)
bridge.addText(1,1, stored, 0xFF0000)
bridge.addText(1,10, tank2, 0xFFFFFF)
sleep(0.15)
bridge.sync()
bridge.clear()
end
{1.0={contents={id=1.0,amount=6000.0,rawName=Water,namewater}, capacity=16000.0}}
and for TANK2{1.0={capacity=16000.0}}
TANK2 is empty
local amount = stored[1].contents.amount
local name = stored[1].contents.rawName
local capacity = stored[1].capacity
local amount = stored[1].contents.amount local name = stored[1].contents.rawName local capacity = stored[1].capacity
This should work, although I'm not sure how you are displaying a table without serializing it.
local amount = stored[1].contents.amount
i get;
bridge.addText(1,1, amount, 0xFF0000)
bridge.addText(1,1, stored, 0xFF0000)
local amount = stored[1].contents.amount
line
local amount = stored[1].contents.rawName
net = peripheral.wrap("back")
bridge = peripheral.wrap("left")
bridge.clear()
-- count = 0
while true do
stored = net.callRemote("openblocks_tank_5","getTankInfo")
tank2 = net.callRemote("openblocks_tank_6","getTankInfo")
stored = net.callRemote("mcp_mobius_betterbarrel_0","getStoredItems")
local amount = stored[1].contents.amount
local name = stored[1].contents.rawName
local capacity = stored[1].capacity
--count = count + 5
print(stored)
print(tank2)
print(barrel)
--bridge.addGradientBox(0,0,900,50,0xFF0000,0.8,0x00FF00,0.8,1)
bridge.addBox(0,0,900,50,0x00CCFF,0.3)
bridge.addBox(0,250,90,40,0x00CCFF,0.2)
bridge.addText(1,255, "By Fatal1tyGC", 0xFFFF00)
bridge.addText(1,265, "This script", 0xFFFF00)
bridge.addText(1,275, "Runs Statview 0.1", 0xFF0000)
bridge.addText(1,1 amount, 0xFF0000)
bridge.addText(1,10, tank2, 0xFFFFFF)
bridge.addText(1,20, barrel, 0xFF0000)
sleep(0.15)
bridge.sync()
bridge.clear()
end
stored = net.callRemote("openblocks_tank_5","getTankInfo") -- Stick tank info in "stored"
...
stored = net.callRemote("mcp_mobius_betterbarrel_0","getStoredItems") -- Replace tank info with barrel info
barrel = net.callRemote("mcp_mobius_betterbarrel_0","getStoredItems") -- Replace tank info with barrel info
But the error keeps coming…
net = peripheral.wrap("back")
bridge = peripheral.wrap("left")
bridge.clear()
-- count = 0
while true do
stored = net.callRemote("openblocks_tank_5","getTankInfo")
tank2 = net.callRemote("openblocks_tank_6","getTankInfo")
barrel = net.callRemote("mcp_mobius_betterbarrel_0","getStoredItems")
local amount = stored[1].contents.amount
local name = stored[1].contents.rawName
local capacity = stored[1].capacity
--count = count + 5
print(stored)
print(tank2)
print(barrel)
--bridge.addGradientBox(0,0,900,50,0xFF0000,0.8,0x00FF00,0.8,1)
bridge.addBox(0,0,900,50,0x00CCFF,0.3)
bridge.addBox(0,250,90,40,0x00CCFF,0.2)
bridge.addText(1,255, "By Fatal1tyGC", 0xFFFF00)
bridge.addText(1,265, "This script", 0xFFFF00)
bridge.addText(1,275, "Runs Statview 0.1", 0xFF0000)
bridge.addText(1,1 amount, 0xFF0000)
bridge.addText(1,10, tank2, 0xFFFFFF)
bridge.addText(1,20, barrel, 0xFF0000)
sleep(0.15)
bridge.sync()
bridge.clear()
end
bridge = peripheral.wrap("left")
tank1 = peripheral.wrap("openblocks_tank_7")
tank2 = peripheral.wrap("openblocks_tank_8")
tank3 = peripheral.wrap("openblocks_tank_9")
tank4 = peripheral.wrap("openblocks_tank_10")
tank1i = tank1.getTankInfo("unknown")
tank2i = tank2.getTankInfo("unknown")
tank3i = tank3.getTankInfo("unknown")
tank4i = tank4.getTankInfo("unknown")
while true do
for k,v in pairs(tank1i[1])
do bridge.addText(1,10,k..": "..v ,0xFFFFFF)
end
sleep(0.75)
bridge.sync()
bridge.clear()
end
startup:14: attempt to concatenate string and table
Lua > p = peripheral.wrap("openblocks_tank_7")
Lua > info = p.getTankInfo("unknown")
Lua > for k,v in pairs(info) do print(k,v) end
capacity16000
contentstable:#######
Also, when there is water in a tank, and the script runs, it stops because i get an error:startup:14: attempt to concatenate string and table
local myTable = {["someKey"] = "someValue"}
print(myTable.someKey) -- Fine.
myTable = nil
print(myTable.someKey) -- attempt to index ? (a nil value)
if info and info.contents then print(info.contents.rawName) end -- If "info" is non-nil, and "info.contents" is non-nil, then index into info.contents to get rawName and print that.
net = peripheral.wrap("back")
bridge = peripheral.wrap("left")
bridge.clear()
--count = 0
while true do
stored = net.callRemote("openblocks_tank_5","getTankInfo")
tank2 = net.callRemote("openblocks_tank_6","getTankInfo")
barrel = net.callRemote("mcp_mobius_betterbarrel_0","getStoredItems")
--local amount = stored[1].contents.amount
--local name = stored[1].content.rawName
--local capacity = stored[1].capacity
-- count = count + 5
print(stored)
print(tank2)
print(barrel)
--bridge.addGradientBox(0,0,900,50,0xFF0000,0.8,0x00FF00,0.8,1)
bridge.addBox(0,0,900,50,0x00CCFF,0.3)
bridge.addBox(0,250,90,40,0x00CCFF,0.2)
bridge.addText(1,255, "By Fatal1tyGC", 0xFF0000)
bridge.addText(1,265, "This script",0xFFFF00)
bridge.addText(1,275, "Runs Statview 0.1",0xFF0000)
bridge.addText(1,1, stored, 0xFF0000)
bridge.addText(1,10, tank2, 0xFFFFFF)
bridge.addText(1,20, barrel, 0xFF0000)
sleep(0.15)
bridge.sync()
bridge.clear()
end
--local amount = stored[1].contents.amount
--local name = stored[1].content.rawName
--local capacity = stored[1].capacity
But that gives me errors.local name = stored[1].content.rawName
local capacity, name, amount = stored[1].capacity --#pre declare our variables (so we don't pollute the global table)
if stored[1].contents then --#if there's fluid in the tank
--#we can use the name and amount of that flue
name = stored.contents.rawName
amount = stored.contents.amount
else
--#we can't
name = "no fluid"
amount = 0
end
local capacity, name, amount = stored[1].capacity
if stored[1].contents then
local capacity = stored[1].capacity
local amount = stored[1].contents.amount
local name = stored[1].contents.rawName
-- count = count + 5
print(stored)
print(tank2)
print(barrel)
--bridge.addGradientBox(0,0,900,50,0xFF0000,0.8,0x00FF00,0.8,1)
bridge.addBox(0,0,900,50,0x00CCFF,0.3)
bridge.addBox(0,250,90,40,0x00CCFF,0.2)
bridge.addText(1,255, "By Fatal1tyGC", 0xFF0000)
bridge.addText(1,265, "This script",0xFFFF00)
bridge.addText(1,275, "Runs Statview 0.1",0xFF0000)
bridge.addText(1,1, name..": "..amount.."/"..capacity, 0xFF0000)
bridge.addText(1,10,tank2, 0xFFFFFF)
bridge.addText(1,20, barrel, 0xFF0000)
else
name = "No Fluid"
amount = 0
end
bridge.addBox(0,0,900,50,0x00CCFF,0.3)
bridge.addBox(0,250,90,40,0x00CCFF,0.2)
bridge.addText(1,255, "By Fatal1tyGC", 0xFF0000)
bridge.addText(1,265, "This script",0xFFFF00)
bridge.addText(1,275, "Runs Statview 0.1",0xFF0000)
if stored[1].contents then
bridge.addText(1,1, stored[1].contents.rawName..": "..stored[1].contents.amount.."/"..stored[1].capacity, 0xFF0000)
else
bridge.addText(1,1, "No Fluid: 0/"..stored[1].capacity, 0xFF0000)
end
bridge.addText(1,10,tank2, 0xFFFFFF)
bridge.addText(1,20, barrel, 0xFF0000)