Why do you got a else in there?
The else was from the code when i tryed to add the itemcount but it always crashed so i tryed without it and forgot to remove the else[quote
name='jag_e_nummer_ett' timestamp='1351854741' post='46589']
What you could do is
turtle.select(1)
local slot = 1
function selectItem()
  if turtle.getItemCount(slot) == 0 then
	if slot == 16 then
	  return false
	end
	for i = slot+1, 16 do
	  if turtle.getItemCount > 0 then
		slot = i
		turtle.select(slot)
		return true
	  end
	end
	return false
  end
end
for i =0,10 do
  turtle.forward()
  while not selectItem do sleep(.5) end
  turtle.placeDown()
  turtle.turnLeft()
  turtle.forward()
  while not selectItem do sleep(.5) end
  turtle.placeDown()
  turtle.forward()
  while not selectItem do sleep(.5) end
  turtle.placeDown()
  turtle.turnRight()
  turtle.forward()
  while not selectItem do sleep(.5) end
  turtle.placeDown()
  turtle.turnRight()
  turtle.forward()
  while not selectItem do sleep(.5) end
  turtle.placeDown()
  turtle.forward()
  while not selectItem do sleep(.5) end
  turtle.placeDown()
  turtle.turnLeft()
  print(......bzzz......)
end
Now this code could've been made better, but to give you the basic idea..
I tryed this code and and it needs to be print"…….bzzz……." but thats my fault
when i tryed this code and it runs out of blocks in the first slot it keeps building with slot one selected, 
So, this is the code i have right now, 
for i =0,10 do
turtle.select(1)
local slot = 1
function selectItem()
  if turtle.getItemCount(slot) == 0 then
    if slot == 16 then
	  return false
    end
    for i = slot+1, 16 do
	  if turtle.getItemCount > 0 then
	    slot = i
	    turtle.select(slot)
	    return true
	  end
    end
    return false
  end
end
  turtle.forward()
  while not selectItem do sleep(.5) end
  turtle.placeDown()
  turtle.turnLeft()
  turtle.forward()
  while not selectItem do sleep(.5) end
  turtle.placeDown()
  turtle.forward()
  while not selectItem do sleep(.5) end
  turtle.placeDown()
  turtle.turnRight()
  turtle.forward()
  while not selectItem do sleep(.5) end
  turtle.placeDown()
  turtle.turnRight()
  turtle.forward()
  while not selectItem do sleep(.5) end
  turtle.placeDown()
  turtle.forward()
  while not selectItem do sleep(.5) end
  turtle.placeDown()
  turtle.turnLeft()
  print"......bzzz......"
end
it builds but when it runs out it doesn't select the next slot anyway to fix this ?