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

Run plugin when bot is stopped?

jim87

New Member
Joined
Aug 26, 2011
Messages
445
Reaction score
7
Hello!

I'm creating a data analyzer using HB to retrieve data from the client. I'd like to know if it's possible to run a plugin indipendently if you're running the bot or not (bot started or stopped).

Is it possible? Or should I create a "void bot"? Seems a hacky way.

Thanks!
 
Code:
private void SpamButton1_Click(object sender, EventArgs e)
        {
            if (!TheSettings.Instance.SpamButton1) TheSettings.Instance.SpamButton1 = true;
            else TheSettings.Instance.SpamButton1 = false;
            if (TheSettings.Instance.SpamButton1) StartSpamming();
        }


        private void StartSpamming()
        {
            _ButtonSpammer = new Thread(ButtonSpammer) { IsBackground = true };
            _ButtonSpammer.Start();
        }


        private static Thread _ButtonSpammer;
        private static void ButtonSpammer()
        {
            while (TheSettings.Instance.SpamButton1)
            {
                KeyboardManager.KeyUpDown((char)Keys.D1);
                Thread.Sleep(1000);
            }
            _ButtonSpammer.Abort();

//RUN ALL YOUR CRAP INSIDE THIS BACKGROUND THREAD. BUT IF YOU NEED TO LOCATE OBJECTs IN GAME YOU'LL ALSO NEED TO CALL "ObjectManager.Update()" before checking those objects.


        }
 
Np.

I've had to use background threads many times.

If you need a way to send parameters to it I'll post that in here as well :)
And obviously I just used another instantiated class to monitor when to start/stop.
 
I've done a node sniffer, which I use in combination with a portable MySQL database. I used MySQL instead of XML because data is huge and MySQL is made for this type of job... and I can easily extract data without having to parse enormous data. So far it's working just fine ^^ Next step will be to find the best paths-per-zone, just like the Routes addon does, blacklisting the nodes not in the highest mesh position. Any idea? ^^
 
1) Don't use threads unless you're absolutely sure you can deal with any race conditions. (We do provide locking objects to allow for thread safety, however documentation on them is pretty sparse.)
2) We suggest putting your stuff inside the Pulse() method of a plugin, or "empty" BotBase.
3) As far as anything that does nothing but "log" nodes and whatnot, I'd highly suggest a plugin over a BotBase. But if its for personal use, either or works.

4) SQLite > MySQL for this type of stuff. Trust me. (Unless of course you're pushing this data to a web server somewhere, in which case, continue on :))
 
SQLite has limited use for data manipulation (yes I agree that SQLite is great if only for collecting data and analyzing separately in bulk). My idea is indeed to create a mini website storing the maps. As of the routes, I may create a PHP script to run on-the-fly to prevent duplicates and thus banning-routes.

Any idea on the routing calculation? I have some ideas about how to exclude the nodes in the caverns, but I have absolutely no idea on how to create a "best route" (I only know how to pass node by node, thus not optimizing the trip).

Also, if I'm going to host a public HB profiles creation website, I'm gonna have a separate website from my works, as I don't want to expose my person.
 
This is gonna be sexy.

But as far as data collection the otherwise empty plugin would be best.
The multi-thread was just in-line with what you asked for.

Apoc is beastmode.

But seriously I love the web hosted idea. Will help later if HB gets the massive improve to receiving commands like "Gather 'Mithril Ore' for 2 Hours 0 Minutes"
 
Back
Top