All pastes #3185663 Raw Edit

Xp Farm Programs v4

public unlisted lua v1 · immutable
#3185663 ·published 2015-10-08 17:22 UTC
rendered paste body
-- OLD VERSIONS:-- http://pastebin.ca/3185540 V1-- http://pastebin.ca/3185585 V2-- http://pastebin.ca/3185601 V3-- _PROGRAM 1local robot : require("robot")local robot : require("sides")while true dorobot.setLightColor(0x00FF00) --green  print("Running...")robot.use(sides.front, false, math.huge)        end         --[[ Collect In front of him (Essence berry bush)) once with right-click      And use the equipped tool (Watering Can) at the same time for infinite duration. ]]-- _PROGRAM 2local robot : require("robot")local component : require("component")while true doif robot.count(1) = 64 then do=component.inventory_controller.equip()endwhile true doif robot.use()else endendend-- _PROGRAM 2.1local robot : require("robot")local component : require("component")function checkSwitch()robot.setLightColor(0xF4FF0D) --yellowif robot.count(1) > 50 then=component.inventory_controller.equip()expUse()else expUse()endfunction expUse()robot.setLightColor(0x00FF00) --green  print("Extracting...")if robot.use()else checkSwitch()endwhile true docheckSwitch()end-- Program 2 and 2.1 are the same program just written differently, they won't be both running. I will choose the best one.--[[  Check If the main slot contains 64 items or in program 2.1 if it contains more than 50,       If True, it will swap the content of the tool slot with the selected slot.	  Then robot will use right-click If it can place/use an item (Condensed Essence Berry),	  If it CANT place it then it will switch to next step.]]				-- _PROGRAM 3local robot : require("robot")local component : require("component")num = 1function row123()robot.turnLeft()robot.use()robot.turnAround()robot.use()robot.turnLeft()robot.forward()robot.turnLeft()robot.use()robot.turnAround()robot.use()robot.turnLeft()robot.forward()robot.turnLeft()robot.use()robot.turnAround()robot.use()robot.turnLeft()robot.forward()robot.turnLeft()robot.use()robot.turnAround()robot.use()robot.turnLeft()robot.forward()robot.turnLeft()robot.use()robot.turnAround()robot.use()robot.turnLeft()robot.forward()robot.turnLeft()robot.use()robot.turnAround()robot.use()robot.turnLeft()robot.turnAround()robot.up()endfunction row4()robot.turnLeft()robot.use()robot.turnAround()robot.use()robot.turnLeft()robot.forward()robot.turnLeft()robot.use()robot.turnAround()robot.use()robot.turnLeft()robot.forward()robot.turnLeft()robot.use()robot.turnAround()robot.use()robot.turnLeft()robot.forward()robot.turnLeft()robot.use()robot.turnAround()robot.use()robot.turnLeft()robot.forward()robot.turnLeft()robot.use()robot.turnAround()robot.use()robot.turnLeft()robot.forward()robot.turnLeft()robot.use()robot.turnAround()robot.use()robot.turnLeft()robot.turnAround()robot.down()robot.down()robot.down()endfunction droptime() for i = 1, 16 do   turtle.select(num)   turtle.dropDown()   num = num + 1  end  num = 1    turtle.select(1) end-- Is this function better than function droptime()  ??-- @Mimiru--				function dropInventoryDown()--				 for i = 1, robot.inventorySize() do -- drop entire inventory--					robot.select(i)--					robot.dropDown()--				end--					robot.select(1)--				endwhile true do   robot.setLightColor(0x0000FF) --blue  print("Waiting...")  sleep(10)endwhile true do   robot.setLightColor(0x00FF00) --green  print("Harvesting...")  row123()  row123()  row123()  row4()  robot.setLightColor(0xFF0000) --red  print("Dropping items...")  droptime()end--[[ Robot start over a chest and a charger is placed behind it, the robot is facing Air, on his side, Bushes stacked 4 height in a row of 5.     The robot will then move forward once, look left and collect (robot.use), do a turn around, collect, turn left and move forward until it reach	 the end of the first row, then it would go up, turn around and repeat for the first 3 rows. 	 At the last row and last bush, it will collect and then go down 3 times to then proceed to drop his inventory in the chest below it,	 cycling through his inventory slots, then reselect the first slot and wait 10 seconds to get recharged.]]	 -- CREDITS -- Thanks to the IRC Channel especially Mimiru who helped me understand lua better and provided a lot of code changes ;)-- Thanks to OpenComputers Devs for making such an amazing mode! And thanks to Gangsir &  BANDITDRAGON, I used their codes as an template for my programs!-- You guys are amazing! <3