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

Running Farms with Modems and Turtles..

Started by JoePwnz, 11 December 2015 - 09:38 PM
JoePwnz #1
Posted 11 December 2015 - 10:38 PM
Hello,
since i only know a few basics in CC i need some help at a quite complex turtle farming method..
First of all i want to apologize for my bad english :)/>

Alright so what do i want to do?
I want to build a Computer controlled turtle farms (wheat, carrots and some stuff that you need a hoe to farm)
I want to use the turtles only for planting the seeds and i use dispenser for flushing the seeds down a collecting point..
Im planning to use about 10-15 growing platforms
what should happen?

In order:

Click on the computer which uses the button api something like Harvest..
then the computer outputs a redstone signal for the flushing process,
after that the computer stops the flushing process after like 20 seconds or so.
The turtles gets activated and runs their programs which i will write later..
and go back to their starting point, then they will give the main computer a signal for being ready and after all turtles have done their job,
i want them to wait 1 hour or so and the entire process loops…
(i dont know how the turtles will communicate with the main computer.. ) This is where i need help
I just need some help via skype or something or TS3 i own a TS server so i preffer TS..

Have a nice day!! I hope i get some good help from you guys!
Edited on 11 December 2015 - 11:35 PM
Lupus590 #2
Posted 11 December 2015 - 11:37 PM
break down your program and use functions. get the turtle to plant one seed, then a row of seeds then a small section, then a group of sections
JoePwnz #3
Posted 12 December 2015 - 12:33 AM
Thanks for the answer.. the main problem is i dont know how to use the wireless modems i only need some help for the main computer and the turtles to set delays and automations
and let the main computer control all the turtles..
Lupus590 #4
Posted 12 December 2015 - 01:07 AM
the rednet api is the easiest way to use modems in my opinion
JoePwnz #5
Posted 12 December 2015 - 02:09 AM
The problem is i only know the basics of cc.. thats why im asking here someone to help me like ingame.. or a little code which can run programs via wireless modems.. because i dont know how it works with turtles and computers.. And it shouldnt sound bad, but im only at the bottom of basics if you can say that.. look at my other forum thread 1 year ago with the farming turtle.. since that post i didnt even made a code..
KingofGamesYami #6
Posted 12 December 2015 - 02:22 AM
This tutorial looks fairly decent, it's a small bit outdated but should give you the basic idea. I would recommend using the wiki link Lupus590 posted to learn about the current version of the commands.
JoePwnz #7
Posted 12 December 2015 - 11:09 AM
Wow thanks for the answers! Since in started coding again, and knowing nothing about cc anymore im unable to make any codes.. my brain just doesnt want to understand it for some reason.. i cant even make a farming script just for the planting of seeds.. Im working on a farmscript for about 4 hours now and i cant even make that possible.. I dont want to waste your time guys :D/> but thanks for the answers i need to learn the basics again.. or i will make a simpler farm which dont need CC Have a nice weekend!
Lupus590 #8
Posted 12 December 2015 - 12:57 PM
If you are free at the moment then I can help you on CC Collage
JoePwnz #9
Posted 13 December 2015 - 10:51 AM
If you are free at the moment then I can help you on CC Collage
if you want you can join my MP server, we run Monster 1.6.4.. And you can help me while building it..

If you have skype you can see my skype name in my profile.. feel free to add me!
Lupus590 #10
Posted 13 December 2015 - 03:06 PM
Having reread your OP, I think I can help from here.

I'll sound like I'm repeating you a bit, but read this through.
This is everything your system needs to do from its point of view:
  1. Main computer receives harvest command (either from a button, remote command, or timer)
  2. Main computer begins water-assisted harvest by outputting a redstone signal
  3. After a timer has gone off, main computer turns off redstone signal, stopping the water
  4. Main computer sends replant signal to turtles (via rednet)
Switching to turtles point of view:
  1. Turtles receive replant signal from main computer (via rednet)
  2. Turtles gather supplies and begin replant
  3. Turtles finish replant and return to their original positions
  4. Turtles each send a signal to signify completion of task to main computer (via rednet)
  5. Turtles wait for another replant command
Switching back to main computer:
  1. Main computer receives signal from every turtle, this means that all turtles have done their tasks
  2. Main computer waits for another harvest command
JoePwnz #11
Posted 13 December 2015 - 04:25 PM
This is exactly what im talking about! This is how i thought about it.. But the problem is, i cant programm it.. thats where i need the help Someone who could help me ingame or teach it to me while building it
Lupus590 #12
Posted 13 December 2015 - 07:48 PM
Here is some psudo code to get you started, if you still need help then I can jump on your sever tomorrow.


--#Main Computer
while true do
  event = pullevent()
  if event == havestComand then
	activateWater()
	sleep(15)
	deactivateWater()
	for each turtle do
	  rednet.sendMessage(turtle,"Replant")
	 end
	waitForReplyFromTurtles()
  end
end


--#Turtle
while true do
  event = pullEvent()
  if event == replantMessage then
	getSupplies()
	plantMyPart()
	dumpExcess()
	rednet.sendMessage(mainComputer,"Done")
  end
end

Here are the wiki pages you should need: http://computercraft...ednet_%28API%29 http://computercraft...ki/Os.pullEvent http://computercraft...urtle_%28API%29

And if you are really stuck: http://lua-users.org/wiki/LuaDirectory

edit: code fix to main computer
Edited on 14 December 2015 - 01:44 PM