Jump to content




Get items from chest?


8 replies to this topic

#1 Zyme

  • Members
  • 7 posts

Posted 18 September 2012 - 08:04 PM

I just found out about ComputerCraft when playing Tekkit and it seems awesome, if you knew how to code...

I have a warehouse with 200+ chests that is sorted with input pipes. Now I need a way to actually get the items in a easy fashion, instead of running from floor to floor.

A solution was to use a retriever, but to get 64 diamonds I would need 1 diamond and click the button 64 times, or whatever. I need a way to tell the system "I need X amount of Y" sent to me.

The only solution I could think of is ComputerCraft.


Would it be possible to create such an interface? Where you have multiple pages with items in the terminal and you type in a number, (for example 10 for diamonds), and then the amount. That would send a signal to some machine that will get the right amount from the chest into tubes and transported up to floor 1.

#2 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 18 September 2012 - 08:24 PM

Tekkit uses 1.33 version of ComputerCraft. Unfortunately, this version does not interact with chests or inventory. If Tekkit was updated to 1.41 ComputerCraft, then you would be able to do this.

Edit: I reread your post, and noticed you said nothing about turtles. Wait for an update, and I'll have something for you.

Edit 2: Here is the code you can use to pull items out with a redstone pulse.
while true do
term.clear()
term.setCursorPos(1,1)
print("How many items do you want to pull out?")
write("Number: ")
local input = tonumber(read())
for i = 1,input do
rs.setOutput("back",true)
sleep(.1)
rs.setOutput("back",false)
sleep(.1)
end
end

More advanced with menu:
local options = {
"Diamond",
"Iron",
"Gold"
--you can add more in here
}
local function opt(m,mY)
n=1
l=#m
while true do
for i=1, l, 1 do
if i==n then
local x, y = term.getSize()
local b = string.len(">"..m[i].."<")/2
local x = (x/2)-b
term.setCursorPos(x,i+mY)
term.clearLine()
print(">"..m[i].."<")
else
local x, y = term.getSize()
b = string.len(m[i])/2
x = (x/2)-b
term.setCursorPos(x,i+mY)
term.clearLine()
print(m[i]) end
end
a, b= os.pullEventRaw()
if a == "key" then
if b==200 and n>1 then n=n-1 end
if b==208 and n<l then n=n+1 end
if b==28 then break end
end
end
term.clear() term.setCursorPos(1,1)
return n
end


while true do
term.clear()
term.setCursorPos(1,1)
print("What item do you want?")
local item = opt(options,6) --the second parameter is the y position start point
if item == 1 then
term.clear()
term.setCursorPos(1,1)
print("How many items do you want?")
write("Number: ")
local number = tonumber(read())
for i = 1,number do
rs.setBundledOutput("back",colors.white) --change to whatever bundled color you need
sleep(.1)
rs.setBundledOutput("back",0)
sleep(.1)
end
elseif item == 2 then
--same thing for item 2
elseif item == 3 then
--same thing for item 3...and so on
end
end


#3 Zyme

  • Members
  • 7 posts

Posted 18 September 2012 - 10:22 PM

Thanks, will try this when I get further with the system.

I have problem however figuring out what machine to use to get X amount. When I tried the "filter" machine it takes a full stack on each redstone pulse. Is there another way?

And how would I support 200 chests with one cable?

#4 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 18 September 2012 - 10:25 PM

With the filter, it will only take out the item of a certain stack size. So if using filters on a diamond chest, you would need one in the filter to output one diamond at a time. This is the same for the retreiver.

#5 Zyme

  • Members
  • 7 posts

Posted 19 September 2012 - 12:06 AM

Thanks got this to work.

Just the last problem, having 200 chests how do I solve the computer sending signals to the correct chests? I can solve 3 chests but this amount?

#6 Matrixmage

  • Members
  • 116 posts
  • LocationAt my Computer coding for the Computer in my Computer

Posted 19 September 2012 - 12:29 AM

View PostZyme, on 19 September 2012 - 12:06 AM, said:

Thanks got this to work.

Just the last problem, having 200 chests how do I solve the computer sending signals to the correct chests? I can solve 3 chests but this amount?

you can use bundled cables to make it use 16 * (however many sides are open on the computer) but for more you could use multiple computers and rednet.

#7 hego555

  • Members
  • 89 posts

Posted 19 September 2012 - 12:39 AM

Wait tekkit has a old version of CC?

and the new version could do majical things like pull from chests?

(I SPELLED MAGICAL WRONG ON PURPOSE)

#8 Zyme

  • Members
  • 7 posts

Posted 19 September 2012 - 12:51 AM

What about using wireless to transmit to another computer that handles one floor and it is connected to wires?

So one computer on each floor. And one main computer with the options. Depending on what item I select it will contact a different computer that in turn sends the correct signal?

#9 uh20

  • Members
  • 11 posts

Posted 28 January 2013 - 06:10 PM

hello, because i have 3 factories spread apart, i am creating a chest system in combination with Tekkit lite in which you can send out minecarts with a certain catagory of chest contents from a depot.

do be warned that there is no fast way of bringing items about (my tests from depot to my closest factory about 50 blocks away takes a bit more than a minute, the filling of the cart alone takes about 30 seconds.

my own sorting system is close to being internally done, but i have not started on the touchscreen selection or the failsafes for when you order too many carts, if a cart can collide, when the computer reboots, etc.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users