This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
PatrikF1's profile picture

Need help with the peripheral proxxy

Started by PatrikF1, 03 October 2014 - 06:17 PM
PatrikF1 #1
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
Cranium #2
Posted 03 October 2014 - 08:35 PM
We'd be happy to help you with your code. What have you got so far?
PatrikF1 #3
Posted 03 October 2014 - 08:42 PM
This is what i got so far
http://pastebin.com/mP7abG97
PatrikF1 #4
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
Dragon53535 #5
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 ()
Bomb Bloke #6
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.