Edited by fanzypantzy, 17 January 2016 - 12:09 AM.
Get item ID inside blood magic altar.
#1
Posted 16 January 2016 - 01:05 AM
#2
Posted 16 January 2016 - 01:20 AM
#3
Posted 16 January 2016 - 01:21 AM
This will give you either a list of methods for the alter (if it's a peripheral), or tell you it's not one (if it's not a peripheral).
local side = "top" --#this should be whatever side the alter is on
if peripheral.isPresent( side ) then
for k, v in pairs( peripheral.getMethods( side ) do
print( k )
end
else
print( "Not a Peripheral!" )
end
EditNinja'd
Edited by KingofGamesYami, 16 January 2016 - 01:21 AM.
#4
Posted 16 January 2016 - 11:43 PM
Here are the method I think I will have the most use of:

My questions are:
How do I get the different parts of getInfo() under the blood altar. It returns more than one thing and I would like to be able to call both the capacity and contents separately.
I'm really really new to this and have never coded anything else than a simple sheep farm. How can I get the capacity and do a simple "while capacity > 8000 do" or something similar. And how can I get the contents so I can wait until the right slate is finished. Again as simple as "contents = Bloodmagic:Blankslate" or something like that.
Here is the script I am working in atm, it does all the filtering manually with BC emzuli pipes and gates.
Edited by fanzypantzy, 16 January 2016 - 11:45 PM.
#5
Posted 16 January 2016 - 11:47 PM
local atable = {
["key"] = "Value"
}
print(atable.key) -- Prints "Value"
print(atable["key"]) -- Prints "Value"
The latter is more useful when Lua could misinterpret the dot notation (spaces or special characters in key). It is also more useful when you're dynamically indexing the table.
#6
Posted 16 January 2016 - 11:52 PM
local tbl = drive.getInfo() tbl.contents.amountwill be the numerical value of it's current amount
#7
Posted 17 January 2016 - 12:08 AM
Could this give me the information about the block inside the blood altar?

The big question is: teach me like I am 5, what is this proxy table thingy?
#8
Posted 17 January 2016 - 12:19 AM
#9
Posted 17 January 2016 - 12:23 AM

I mean it's not giving me much to go on to figure out what is in the table or how to get to it:
#10
Posted 17 January 2016 - 12:28 AM
Try running this to see what's in it
textutils.serialize(drive.getAllStacks())If you get an error, that means that it's probably got a function in it somewhere.
If it does error, we'll work on that next.
I think proxy is negligible right now, since you're referencing the altar you care about anyways, no need for a proxy I assume.
#11
Posted 17 January 2016 - 12:30 AM
#12
Posted 17 January 2016 - 12:37 AM
local side = "left"
local drive = peripheral.wrap(side)
local file = fs.open("tableFile","w")
local function readTable(tbl,previous)
previous = previous or ""
for a,v in pairs(tbl) do
if type(v) == table then
readTable(tbl,previous..a..":")
else
file.writeLine(previous..a.." = " .. type(v))
end
end
end
readTable(drive.getAllStacks(),"")
file.close()
And then open the tableFile file
Edited by Dragon53535, 17 January 2016 - 12:39 AM.
#13
Posted 17 January 2016 - 12:42 AM
1 = table
#14
Posted 17 January 2016 - 12:45 AM
local side = "left"
local drive = peripheral.wrap(side)
local file = fs.open("tableFile","w")
local function readTable(tbl,previous)
previous = previous or ""
for a,v in pairs(tbl) do
if type(v) == "table" then --# I forgot the quotes here
readTable(tbl,previous..a..":")
else
file.writeLine(previous..a.." = " .. type(v))
end
end
end
readTable(drive.getAllStacks(),"")
file.close()
Edited by Dragon53535, 17 January 2016 - 12:46 AM.
#15
Posted 17 January 2016 - 12:49 AM

But when I put the side back to left it returned 216 which is a blood interface block though. I assume you wanted the side to be the blood altar side.
#16
Posted 17 January 2016 - 12:51 AM
local side = "left"
local drive = peripheral.wrap(side)
local file = fs.open("tableFile","w")
local function readTable(tbl,previous)
previous = previous or ""
for a,v in pairs(tbl) do
if type(v) == "table" then --# I forgot the quotes here
readTable(v,previous..a..":") --#I was passing tbl here, which basically did this over and over again, without changing it's result
else
file.writeLine(previous..a.." = " .. type(v))
end
end
end
readTable(drive.getAllStacks(),"")
file.close()
Yay for typos and mistakes...
Edited by Dragon53535, 17 January 2016 - 12:52 AM.
#17
Posted 17 January 2016 - 12:52 AM
1:listSources = function 1:getAdvancedMethodsData = function 1:all = function 1:listMethods = function 1:doc = function 1:keys = function 1:basic = function 1:select = function 1:single = function
#18
Posted 17 January 2016 - 12:54 AM
drive.getAllStacks()[1].listMethods()I probably should say, I mean plug that back into the lua prompt after wrapping the altar again.
Edited by Dragon53535, 17 January 2016 - 12:57 AM.
#19
Posted 17 January 2016 - 12:59 AM
#20
Posted 17 January 2016 - 01:03 AM
Just to test though, what do these get you?
drive.getAllStacks()[1].keys() drive.getAllStacks()[1].listSources()
I'd also check what other methods you can use for the altar.
drive.listMethods()
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











