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

[Resolved]Transferto Not Doing Anything, Expected Then Error

Started by popdog15, 30 July 2013 - 01:15 PM
popdog15 #1
Posted 30 July 2013 - 03:15 PM
I've made an enchanting program, and I'm trying to use the turtle.transferTo(16, 1) command to keep the enchantment slot filled with one item (book specifically) at any given time. It's giving me the error at line 33, 'then expected'

x = true
xp = peripheral.wrap("right")
autcollect = xp.setAutoCollect()
  print(autocollect)
  
   function toggleAutocollect()
while true do
local event, key = os.pullEvent("key")
		 if key == 57 then
		 autocollect = not autocollect
		 print("Auto collect is now :"..tostring(autocollect))
		  xp.setAutoCollect(autocollect)
		end
end
end
  
  function xpTurtleThings()
while true do
lvl = xp.getLevels()

turtle.attack()
for i = 1, 14 do
  turtle.select(i)
  os.sleep(.1)
   turtle.dropDown()
end
  print("I have "..lvl.." levels.")
if turtle.getItemCount(16) > 0 and lvl <= 30 then
turtle.select(16)
xp.enchant(30)
turtle.dropDown()
end
if turtle.getItemCount(16) < 0 and turtle.getItemCount(15) => 1 then -- Line 33
turtle.select(15)
turtle.transferTo(16, 1)
	end
end
end
parallel.waitForAny(toggleAutocollect, xpTurtleThings)
I can't seem to figure out what's wrong with this.
Grim Reaper #2
Posted 30 July 2013 - 03:21 PM
You have the operator:
=>
on line 33 which isn't actually a valid operator in Lua.

Try changing it to
>=
for greater than or equal to.
popdog15 #3
Posted 30 July 2013 - 03:23 PM
That got rid of the error… but it's still not moving an item.
popdog15 #4
Posted 30 July 2013 - 03:28 PM
Nevermind. I'm tired, and should've waited before posting. I had the item count must be less than zero, which isn't possible. Fixed it.