3 posts
Posted 17 October 2013 - 05:15 PM
Hello, I'm pretty new with computercraft and need some help with programming. I'm going to build a skyscraper and I need to use at least three different types of blocks, but let's say I fill the first four slots with stone. First question is: How do I make the turtle to select the first slot, and when that slot is empty it goes on to the second slot, third slot and then fourth slot?
Second question: How do I make the turtle to move to a chest and refill the four slots when they're empty, and then go back and resume where it stopped?
Any help appreciated :)/>
8543 posts
Posted 17 October 2013 - 05:28 PM
Split into new topic.
You might check the turtle API page on the wiki and look up turtle.select and turtle.getItemCount.
3 posts
Posted 17 October 2013 - 05:45 PM
I still don't get how to put it all together. Any suggestions?
1522 posts
Location
The Netherlands
Posted 17 October 2013 - 06:13 PM
Since you are new here, I will tell how it goes around here. This isn't to sound mean at all, just to get you started.
In this forum it is preferred if you try first and then ask for help. You should try to explain it very carefully, so we know what you are looking for.
Also, post your current code when possible via:
http://www.pastebin.com Of course you can ask: "do something for me" but I can guarantee that not much people will respond then.
Now, I have the feeling, correct me if I'm wrong, that you haven't looked at the wiki page:
http://www.computercraft.info/wiki/Turtle_(API)Mess arround with those functions in creative mode to try to get them to work. If you could not get it to work, we certainly will help you. But first try it yourself. :)/>
331 posts
Posted 25 October 2013 - 05:30 AM
Since you are new here, I will tell how it goes around here. This isn't to sound mean at all, just to get you started.
In this forum it is preferred if you try first and then ask for help. You should try to explain it very carefully, so we know what you are looking for.
Also, post your current code when possible via:
http://www.pastebin.com Of course you can ask: "do something for me" but I can guarantee that not much people will respond then.
Now, I have the feeling, correct me if I'm wrong, that you haven't looked at the wiki page:
http://www.computercraft.info/wiki/Turtle_(API)Mess arround with those functions in creative mode to try to get them to work. If you could not get it to work, we certainly will help you. But first try it yourself. :)/>/>
what he said ^ im only doing this since it seems you may not of found a solution and i recently made this
try this code
local function sort(usedItems)
usedItems = usedItems or 1
for cSlot = 1, usedItems do -- go through these slots
turtle.select(cSlot)
local space = turtle.getItemSpace(cSlot)
for rSlot = usedItems+1,16 do
if turtle.compareTo(rSlot) then
turtle.select(rSlot)
turtle.transferTo(cSlot,space)
end
end
sleep(0)
end
end
put that in your program then follow these steps
1. put all your different building blocks in the first slots ( eg. 1 stone 2 brick 3 wood )
2. put blocks to refill in the other slots
3. call sort(number of different blocks) often to auto refill stacks with the same material
7508 posts
Location
Australia
Posted 25 October 2013 - 05:53 AM
-snip-
Giving people answers is why they keep asking for them without first trying themselves.
892 posts
Location
Where you'd least expect it.
Posted 25 October 2013 - 03:00 PM
-snip-
Giving people answers is why they keep asking for them without first trying themselves.
Exactly!
When one asks for a fish, give them a rod.
When all else fails, test the turtle functions on the Lua prompt. If you want it to move, make sure you refuel it.