Jump to content




Parallel Error?


  • You cannot reply to this topic
2 replies to this topic

#1 popdog15

  • Members
  • 82 posts

Posted 26 July 2013 - 12: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 :/

#2 Grim Reaper

  • Members
  • 503 posts
  • LocationSeattle, WA

Posted 26 July 2013 - 12: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.

#3 popdog15

  • Members
  • 82 posts

Posted 26 July 2013 - 01:33 AM

View PostGrim Reaper, on 26 July 2013 - 12:23 AM, said:

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.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users