Posted 04 August 2013 - 10:57 AM
For the people that never heard of a Gate Reader. It's part of the MiscPeripherals mod and works the same as a Gate from BuildCraft. The only difference is that this one can be computer controlled. Ofcourse a Gate can be too, but that would only be possible with a standard Gate and with redstone pulses. This Gate Reader is alot more efficient and can detect everything and is rather inexpensive to make.
There is a ton of information a Gate Reader can give to you. This is passed in tables. For a good tutorial about tables, look here: http://lua-users.org/wiki/TablesTutorial
To diagnose what information the object can give you, you can use this code:
Let's say you want to check if a chest is full (I handled this question in the 'Ask a Pro' section) and want to emit a redstone pulse when it is full. You need to check if a value in the table 'data' equals "Inventory Full" (exactly spelled like that). That would look like this:
If you want to see any improvements, please tell me.
There is a ton of information a Gate Reader can give to you. This is passed in tables. For a good tutorial about tables, look here: http://lua-users.org/wiki/TablesTutorial
To diagnose what information the object can give you, you can use this code:
--# This is just demonstrative code!
m = peripheral.wrap("right")
data = m.get() --#This will give you the table
--# Now to print the table, you need a for loop that will use pairs.
for i,j in pairs(data) do
print(tostring(i)..": "..(j))
end
Let's say you want to check if a chest is full (I handled this question in the 'Ask a Pro' section) and want to emit a redstone pulse when it is full. You need to check if a value in the table 'data' equals "Inventory Full" (exactly spelled like that). That would look like this:
if data["Inventory Full"] then --#You don't need == true, it already checks if it is true
rs.setOutput("back", true)
sleep(1)
rs.setOutput("back", false)
end
If you want to see any improvements, please tell me.