16 posts
Posted 03 October 2014 - 08:17 PM
I have a computer that should ask for a number between chest 1 and 14 and it should show the content of that chest using peripheral proxys and wired modems please help me with a program that can do it i got a image how it looks like
3790 posts
Location
Lincoln, Nebraska
Posted 03 October 2014 - 08:35 PM
We'd be happy to help you with your code. What have you got so far?
16 posts
Posted 03 October 2014 - 08:42 PM
16 posts
Posted 03 October 2014 - 09:00 PM
That what i got
print("enter a number 1-14")
chest = read()
c = peripheral.wrap("container_chest_(chest)")
for i = 1,27 do
if c.getStackInSlot(1) then
data = c.getStackInSlot(i)
print(i..":"..data.name)
sleep(20)
end
end
1080 posts
Location
In the Matrix
Posted 04 October 2014 - 12:01 AM
I believe what you're trying to do is c = peripheral.wrap("container_chest_" .. chest)
Which should work as long as it doesn't need ()
7083 posts
Location
Tasmania (AU)
Posted 04 October 2014 - 02:16 AM
That "if" statement is only checking slot 1. It should check the i'th slot.
Ideally you'd just call getStackInSlot() once (because it's slow!), store the result directly into "data", then check if "data" exists.