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

Parallel Error?

Started by popdog15, 25 July 2013 - 11:17 PM
popdog15 #1
Posted 26 July 2013 - 01:17 AM
It's an enchanting program, using the misc peripherals enchanting turtle with a sword attached as well. It's used for a mob farm, hence the 'dropDown' 1 - 14 to drop loot. Anyway, I'm trying to add functionality so that I may turn off autocollect and get the XP from the room, for anvils and such. It's giving me the error whenever I press space (57) parallel:22:startup:11 attempt to concatenate string and boolean


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 :"..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 then
turtle.select(16)
xp.enchant(30) 
  end
end
end
parallel.waitForAny(toggleAutocollect, xpTurtleThings)
Not sure what to do :/
Grim Reaper #2
Posted 26 July 2013 - 01:23 AM
The variable autocollect is a boolean (true or false) and therefore can't be concatenated with a string unless you use tostring (autocollect) or some other conditional to convert the value to a string.
popdog15 #3
Posted 26 July 2013 - 02:33 AM
The variable autocollect is a boolean (true or false) and therefore can't be concatenated with a string unless you use tostring (autocollect) or some other conditional to convert the value to a string.
Thank you, that let me fix it.