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

little help with xpturtles (miscperipherals)

Started by monkeybee11, 19 March 2013 - 11:07 PM
monkeybee11 #1
Posted 20 March 2013 - 12:07 AM
hi tryed wrighting a program for my auto exp farm and wanted to upgrade it to auto enchant
but it keeps coming back with errors :S
(have not unlocked brain in a jar on the server im playing on so for now its just sucking up the xp mobs drop)

if true then do
   turtle.attack()
   turtle.setAutoCollect(autocollect)
   turtle.select(16) --book or tools in this slot
   turtle.enchant("30")
end
if false then do
   turtle.attack()
   turtle.setAutoCollect(autocollect)
end

ofc its a meele xp turtle
plz and thx for the help :)/>
Viproz #2
Posted 20 March 2013 - 01:08 AM
hi tryed wrighting a program for my auto exp farm and wanted to upgrade it to auto enchant
but it keeps coming back with errors :S
(have not unlocked brain in a jar on the server im playing on so for now its just sucking up the xp mobs drop)

if true then do
   turtle.attack()
   turtle.setAutoCollect(autocollect)
   turtle.select(16) --book or tools in this slot
   turtle.enchant("30")
end
if false then do
   turtle.attack()
   turtle.setAutoCollect(autocollect)
end

ofc its a meele xp turtle
plz and thx for the help :)/>


turtle.enchant("30") //Edit : Wow i didn't realise i was turtle. sorry fot that
You need to give an int, not a string so remove the "".


turtle.setAutoCollect(autocollect) //Edit :Wow i didn't realise i was turtle. sorry fot that
This require a bool (true or false) so i don't know what is your autocollect var.

Anf wtf is your if true then do ???

You need to learn a little bit lua to use it.
monkeybee11 #3
Posted 20 March 2013 - 01:28 AM
hi tryed wrighting a program for my auto exp farm and wanted to upgrade it to auto enchant
but it keeps coming back with errors :S
(have not unlocked brain in a jar on the server im playing on so for now its just sucking up the xp mobs drop)

if true then do
   turtle.attack()
   turtle.setAutoCollect(autocollect)
   turtle.select(16) --book or tools in this slot
   turtle.enchant("30")
end
if false then do
   turtle.attack()
   turtle.setAutoCollect(autocollect)
end

ofc its a meele xp turtle
plz and thx for the help :)/>


turtle.enchant("30")
You need to give an int, not a string so remove the "".


turtle.setAutoCollect(autocollect)
This require a bool (true or false) so i don't know what is your autocollect var.

Anf wtf is your if true then do ???

You need to learn a little bit lua to use it.
if true kill then enchant when turtle has 30lvls
if it cant do the enchant just keep hacking and slashing
Viproz #4
Posted 20 March 2013 - 01:36 AM
well, you realy need to learn how to program, you can watch the direwolf20's vidéo or the SethBling's ones, in your code, if the syntax was correct, it would just run the first part, if false then will never run.
monkeybee11 #5
Posted 20 March 2013 - 01:37 AM
have watched them but its just to much for my head to handle @_@
Viproz #6
Posted 20 March 2013 - 01:52 AM

xpPeripheral = peripheral.wrap("right") -- mabe it's left i don't remember it when there is a sword
xpPeripheral.setAutoCollect(true) -- you don''t need to execute it more than one time (sorry for double cote, it''s not rendering well without in the forum)

while true do -- this loop will always run
	turtle.attack()
	if xpPeripheral.getLevels() >= 30 then
		turtle.select(16) --book or tools in this slot
		xpPeripheral.enchant(30)
	end
	sleep(0.5) -- to don''t run it too fast.
end

this will work !

PS : it's very hard to switch between c++ and lua (i put // instad of – in my first post ;)/>)