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

API Request: get position of currently planted tree/animial/plant

nomercy4you

New Member
Joined
Mar 29, 2012
Messages
30
Reaction score
0
Is this already possible? I want to move around while planting, and sometimes the random planting is not random enough (in my opinion), is there a way to overload the algorithm function? Small example code would be nice :)
 
Is it available as source? I just want to know if there is any API function to get the position of the last (or next) item. I have already implemented random moving while planting but this still looks like botting as the moving is not connected to the planting.

Edit: ok, I saw that wrote you get the position of the last object in your plugin, I need exactly this API call, which function are you using?

Edit2: ok, seemss that I can use CoreInternal.NewDoodad Delegate.

I am no c# expert, how to bind a function to this delegate?
 
Last edited:
Greetings nomercy,
You are referring to an Event. That particular event triggers when a *new* doodad is discovered. This could be from planting or from coming into detection range. (If your moving)

Here is a quick example
Code:
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;

namespace onNewDoodadExample {
    public class mainClass : Core {
        public static string GetPluginAuthor() {
            return "user01";
        }
        public static string GetPluginVersion() {
            return "1.0.0.0";
        }
        public static string GetPluginDescription() {
            return "onNewDoodad Example";
        }
        
        // onNewDoodad Event Handler
        private void processNewDoodad(DoodadObject obj) {
            try {
                // The lazy way is to check the distance and assume that any new Doodads near you are yours.
                // A better way would be to match your unique ID with the owners ID on the doodad to verify its Yours, with a range of say 10 meters.
                if (me.dist(obj) < 5) {
                    Log("New Doodad Found: "+obj.X.ToString()+", "+obj.Y.ToString()+", "+obj.Z.ToString());
                }
            } catch (Exception error) {
                Log("There was an Error processing the newDoodad: "+error);
            }
        }
        
        public void PluginRun() {
            // public event CoreInternal.NewDoodad onNewDoodad
            onNewDoodad += processNewDoodad;
            while (true) {
                Thread.Sleep(100);
            }
        }
        public void PluginStop() {
            // Nothing to do here
        }
    }
}
 
Back
Top