What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

[Plugin] Non-Stop Farm/Gathering for multiple toons/farms and with restart support

Voyager92

Member
Joined
Nov 3, 2014
Messages
287
Reaction score
1
Hey guys, searching through out the Internet for a decent non-stop Scarecrow/Farming plugin, and finding absolutelly nothing, only one or two that were not reliable, not to mention a bunch of people who never shared squat, I made a small plugin and decided to share with the community what I made using some examples from Out and from Xact.

Basically, it does non-stop farming, using multiple characters and multiple farms, I use it mostly for barleys and Onions, can be used for gathering also, just note you have to change the CollectItemsAtFarm if you use for something other than gathering/farming that cost 1 lp, also change the item and seed for what you want to use it.

It should be noted that if you put in settings this plugin to auto-start and in account settings you configure to close game after DC and restart checked accounts, your character will continue farming non-stop through the night, because it will restart after the DCs, obviously if you configure your account to auto-launch with chosen server and character.

This support multiple characters, each one working in a specific farm, considering AB doesn't have individual auto-start per char, it also support multiple farms, it should be noted that the property ids sometimes change and you also have to change it in the code.

Code:
using System;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using ArcheBuddy.Bot.Classes;

namespace YourNamespace {
    public class YourClass: Core {
        public void PluginRun() {
            while (true) {
                
                if (gameState == GameState.Ingame){
                
                    //get Labor points 
                    int labor = me.laborPoints;
                    
                    string item = "Onion"; // PUT WHAT YOU WANT TO GATHER/FARM HERE
                    string seed = "Onion Seed"; // PUT THE ITEM SEED NAME HERE


                    //if Labor > 200
                    if (labor > 200) {
                        
                        //get starting count of seed
                        var itemStart1 = itemCount(seed);
                        var itemStart2 = itemCount(item);
                        
                        Log("------------------------");
                        Log("Character: " + me.name);
                        Log("Total "+ item +": " + itemStart2);
                        Log("Total "+ seed +": " + itemStart1);
                        
                        // PUT CHARACTER 1 NAME HERE
                        if (me.name == "Charactername"){
                        
                        // PUT FARM IDs HERE, Use scarecrow plugin to get the farm IDs, use the numbers without ", in this case, I'm using 2 16x16, that when they r finished, 
                        // it takes a 5m break and it's already ready for harvest, in case of onions and barleys.
                        uint[] farms = {10909, 7292};
                            
                            foreach (uint farm in farms){
                                
                                Log("Farm: "+farm);
                                CollectItemsAtFarm(item, "Gathering: Spend 1 Labor to gather materials.", farm);
                                CollectItemsAtFarm(item, "Farming: Spend 1 Labor to harvest crops.", farm);
                                PlantItemsAtFarm(seed, farm);
                            }
                            
                        
                            } else if (me.name == "Charactername") { 

                        // PUT FARM IDs HERE, in this case using 1 16x16 and 5 8x8                        
                            uint[] farms = {6252, 18973, 22692, 7270, 6279, 16197};
                            
                            foreach (uint farm in farms){
                                
                                Log("Farm: "+farm);
                                CollectItemsAtFarm(item, "Gathering: Spend 1 Labor to gather materials.", farm);
                                CollectItemsAtFarm(item, "Farming: Spend 1 Labor to harvest crops.", farm);
                                PlantItemsAtFarm(seed, farm);
                            }
                            
                         } else if (me.name == "Charactername") { 
                        
                        // PUT FARM IDs HERE
                         uint[] farms = {18803, 18431};
                            
                            foreach (uint farm in farms){
                                
                                Log("Farm: "+farm);
                                CollectItemsAtFarm(item, "Gathering: Spend 1 Labor to gather materials.", farm);
                                CollectItemsAtFarm(item, "Farming: Spend 1 Labor to harvest crops.", farm);
                                PlantItemsAtFarm(seed, farm);
                            }
                            
                        } 
                        
                        // end else if
                        //else Thread.Abort();
                        
                        //get ending count of seed
                        var itemEnd1 = itemCount(seed);
                        var itemEnd2 = itemCount(item);
                        //get seed used and show in log
                        var used1 = itemStart1 - itemEnd1;
                        var used2 = itemEnd2 - itemStart2;
                        Log("------------------------");
                        Log("Character: " + me.name);
                        Log(item+" Gathered: " + used2);
                        Log(seed+" Used: " + used1);


                        //if Labor < 200 wait 
                    } else {
                        Log("Labor under 200, waiting to regen");
                    }


                    //Jump once  
                    Jump(true);
                    Log("JUMP! JUMP!");
                    Thread.Sleep(500);
                    Jump(false);


                    //Generate random time between 4-5 minutes       
                    Random random = new Random();
                    var mseconds = random.Next(240, 300) * 1000;
                    var seconds = mseconds / 1000;
                    Log("Waiting for " + seconds.ToString() + " seconds");


                    //sleep for random time
                    Thread.Sleep(mseconds);
                }
                else Thread.Sleep(30000);
            }
        }
    }
}
 
Thank you for sharing finally a plugin that works. I have no idea why it won't work with the STRING for the farm. I changed this in my plugin to the farmid and it worked. So my plugin works perfect now. For some reason the ArcheBuddy is having problems reading strings I guess. I have no idea, but thank you finally someone that helped me figure out what was wrong with mine.

CollectItemsAtFarm(Azalea, "Gathering: Spend 1 Labor to gather materials.", "JoeBobJr"); <--- this does NOT Work
CollectItemsAtFarm(Azalea, "Gathering: Spend 1 Labor to gather materials.", 12354); <--- This works with no issues
 
Thank you for sharing finally a plugin that works. I have no idea why it won't work with the STRING for the farm. I changed this in my plugin to the farmid and it worked. So my plugin works perfect now. For some reason the ArcheBuddy is having problems reading strings I guess. I have no idea, but thank you finally someone that helped me figure out what was wrong with mine.

CollectItemsAtFarm(Azalea, "Gathering: Spend 1 Labor to gather materials.", "JoeBobJr"); <--- this does NOT Work
CollectItemsAtFarm(Azalea, "Gathering: Spend 1 Labor to gather materials.", 12354); <--- This works with no issues

Np man, but if you are using exactly like that, the name is probally wrong, the correct would be "Joebobjr".
 
CollectItemsAtFarm(Azalea, "Gathering: Spend 1 Labor to gather materials.", "JoeBobJr"); <--- this does NOT Work
CollectItemsAtFarm(Azalea, "Gathering: Spend 1 Labor to gather materials.", 12354); <--- This works with no issues

I always go with IDs. Maybe you have more then one farm thats why?
 
I always go with IDs. Maybe you have more then one farm thats why?

Yeah I do have more then one farm right close to each other but it's never been an issue until about a week ago. As long as I put the owner of the farm in the code it would gather from both farms. We had an update about a week ago that broke it. Now I have to put the ID which is okay with me. I don't mind using that but I must not have studied the API long enough to know I could use an ID there because I never thought to try that.

I've used this code for weeks now without any issues till a week ago. So I'm not sure what happened to the bot something happened in one of the updates to mess up the string.
 
I don't mind using that but I must not have studied the API long enough to know I could use an ID there because I never thought to try that.

Just popping here to say that setting up Visual Studio is more helpful than anything else you could do if you want to get more familiar with archebuddy API and improve your C# coding skills. The autocompletion and display of overloads makes it very easy and intuitive to explore the API (and anything C#/.NET related) while writing code, without having to stop what you're doing to browse the documentation.
 
Just popping here to say that setting up Visual Studio is more helpful than anything else you could do if you want to get more familiar with archebuddy API and improve your C# coding skills. The autocompletion and display of overloads makes it very easy and intuitive to explore the API (and anything C#/.NET related) while writing code, without having to stop what you're doing to browse the documentation.


I want to learn to code for ab because I am tiered of wanting something done and having to wait or pay for someone else to code it. I have delt with a lot of mmos and seen a lot of code but I still have no idea. Are you saying C# would be the best to learn for coding plugins in AB? Would C# also be best for any of the buddy bots?
 
Hi, im very new, but im using your code, and works fine in my farm.

But i have one question. How can i run it, what code i need mod to use in my family farms?

I want plant and harvest in family scarecrows, but i change the farm id but it only jump.

Scarecrow default plugin work in family scarecrow but doesnt do loops. Any one can help?

Thanks
 
Hi, im very new, but im using your code, and works fine in my farm.

But i have one question. How can i run it, what code i need mod to use in my family farms?

I want plant and harvest in family scarecrows, but i change the farm id but it only jump.

Scarecrow default plugin work in family scarecrow but doesnt do loops. Any one can help?

Thanks

I use in my family farms, and it works alright as long as they have permission, actually the characters who work on the farms, are just part of the family, not the owners, in case they get banned.

And after they run for the first time, they jump and wait for 4-5m until the next run.
 
Voyager, my toon do this:

On family farm (2 near, but i only write the ID of one) and only have permisions in this farm.

Then, the toon, plant, and when finish doesnt gather, they move to the close farm and say: you dont have permisions to plant
And dont go back :(

I miss something special to edit?
 
Voyager, my toon do this:

On family farm (2 near, but i only write the ID of one) and only have permisions in this farm.

Then, the toon, plant, and when finish doesnt gather, they move to the close farm and say: you dont have permisions to plant
And dont go back :(

I miss something special to edit?

Considering that IDs are individual per farm, it should not do that, are you using the ID or the name? Also, about the gathering, make sure the name is correct in the String item, remember that it is case sensitve, and that if you are farming/gathering something that cost more than 1 lp, you need to change accordingly.

If that doesn't work, maybe you should share your code here.
 
Last edited:
Considering that IDs are individual per farm, it should not do that, are you using the ID or the name? Also, about the gathering, make sure the name is correct in the String item, remember that it is case sensitve, and that if you are farming/gathering something that cost more than 1 lp, you need to change accordingly.

If that doesn't work, maybe you should share your code here.


Finally i get it runing. I delete all, recopy, and change the 2-3 things (name and seeds) and now, after 1h its doing it well


THANKS FOR ALL! :)
 
can I change the plant type to optimal and motion type to standart,which behave the same to scarecrows plugins?
 
The problem on the Russian server. IT IS IMPORTANT! (Seeds, plants, but does not collect.)
What is happening is that I am trying to put on the landing and "Аир", in the English version, he is called "Iris". In my version, it looks like this:
b000i6s4T8u196k6.png

Enter the script as follows:
K04016e4N8N1o7E0.png

Eventually got:
O030U6w4h8j1w8R7.png

Tried to change the name as it's called in my inventory ("Аир" = Eng "Iris".) But in the end got this:
r0t0D664v8L197z8.png

That is me shows the number of Iris, which I have in inventory, not in the garden. What do I do?
 
The problem on the Russian server. IT IS IMPORTANT! (Seeds, plants, but does not collect.)
What is happening is that I am trying to put on the landing and "Аир", in the English version, he is called "Iris". In my version, it looks like this:
b000i6s4T8u196k6.png

Enter the script as follows:
K04016e4N8N1o7E0.png

Eventually got:
O030U6w4h8j1w8R7.png

Tried to change the name as it's called in my inventory ("Аир" = Eng "Iris".) But in the end got this:
r0t0D664v8L197z8.png

That is me shows the number of Iris, which I have in inventory, not in the garden. What do I do?

Did you change the lines below to Cyrillic to reflect as it is in the game?

Code:
CollectItemsAtFarm(item, "Gathering: Spend 1 Labor to gather materials.", farm);
CollectItemsAtFarm(item, "Farming: Spend 1 Labor to harvest crops.", farm);

Also, it should be noted that if to gather/farm Iris you spend more than 1 lp, you should change accordingly, for example, to Garlic is something along the lines:
Code:
CollectItemsAtFarm(item, "Farming: Spend up to 2 Labor to harvest crops.", farm);
 
Back
Top