Jump to content

Recommended Posts

Hey y'all!

So I'm having my bots farm in groups at the moment and need some simple way to get them to spend a couple minutes killing things before doing a mass-loot (both because it's more efficient and because otherwise they end up looking very bot-like.

I was hoping I would be able to figure it out using Avvi's sample plugin, but I am still in a little over my head (I am also wondering if his sample plugin might have way more code in there than I need, and I'm not particularly well-equipped to identify).

Thanks for any help!

8 hours ago, Droidz said:

Hello, use this code to disable looting:


wManager.wManagerSetting.CurrentSetting.LootMobs = false;

 

Thanks!

But is there a way to put that on a timer? Or maybe an even smarter idea I haven't had yet?

Because when you are farming low-level mobs, you don't just kill and loot them individually (especially if you are in a group). You kill a shit ton of them, then y'all loot.

6 hours ago, Stresse said:

But is there a way to put that on a timer? Or maybe an even smarter idea I haven't had yet?

I think that that WRobot will only try looting after it kills something. So if the line that droidz (LootMobs = false;) sent was used, and you killed 20 mobs, it would only loot things for after when you did LootMobs = true

1 hour ago, Stresse said:

@Avvi

No, it loots whatever is lootable (currently when I have two grouped up killing low-level mobs, one of them will start just following the other around looting their stuff).

Oh, well then that's great news!  In  that case, you can swap out my plugin template's pluginLoop with this:

 

    public void pluginLoop()
    {
        bool lootStuff = false;
        while (Products.IsStarted && _isLaunched)
        {

            if (!Products.InPause)
            {

		wManager.wManagerSetting.CurrentSetting.LootMobs = lootStuff;
		lootStuff= !lootStuff;
                Thread.Sleep(300000);
            }
        }

    }

 

It will wait 300,000 (5 minutes ) milliseconds and then it will flip the LootMobs value from False to True. After another 300,000 milliseconds  (5 minutes ) it will go from True to False. It will flip it over and over until the WRobot it turned off. 

 

Regarding my template, there are a lot of extra things in there. I added them so that there would be examples of many things ? . If you'd like, you can create a Setting that lets you set the milliseconds manually.

 

Or, you can copy what I've done below. (Replace pluginLoop and pluginSettings : Settings 

    public void pluginLoop()
    {
        bool lootStuff = false;

        while (Products.IsStarted && _isLaunched)
        {


            if (!Products.InPause)
            {

				wManager.wManagerSetting.CurrentSetting.LootMobs = lootStuff;
				lootStuff= !lootStuff;
                Thread.Sleep(_settings.timetowait);
            }
        }

    }


 [Serializable]
    public class pluginSettings : Settings
    {
        public pluginSettings()
        {
          
            timetowait = 300000;
        }

        [Setting]
        [Category("General Settings")]
        [DisplayName("Time to wait before looting stuff")]
        [Description("This is a Description.")]
        public int timetowait { get; set; }


        public static pluginSettings CurrentSetting { get; set; }

        public bool Save()
        {
            try
            {
                return Save(AdviserFilePathAndName("TemplateProjectName", ObjectManager.Me.Name + "." + Usefuls.RealmName));
            }
            catch (Exception e)
            {
                Logging.WriteError("TemplateProjectName > Save(): " + e);
                return false;
            }
        }

        public static bool Load()
        {
            try
            {
                if (File.Exists(AdviserFilePathAndName("TemplateProjectName", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
                {
                    CurrentSetting =
                        Load<pluginSettings>(AdviserFilePathAndName("TemplateProjectName",
                                                                      ObjectManager.Me.Name + "." + Usefuls.RealmName));
                    return true;
                }
                CurrentSetting = new pluginSettings();
            }
            catch (Exception e)
            {
                Logging.WriteError("TemplateProjectName > Load(): " + e);
            }
            return false;
        }
    }

 

 

 

Edited by Avvi

@Avvi

You are so awesome! I honestly can't thank you enough (I actually need to spend some time going around and "liking" all the posts you have made that have been so so helpful to me while I try to figure all this out)! You are my god!

One question: If I wanted different times for killing vs looting (if it splits it 50-50, there is going to be a lot of dead time during the looting phase), would I change it to:

    public void pluginLoop()
    {

        while (Products.IsStarted && _isLaunched)
        {
            bool lootStuff = false;

            if (!Products.InPause)
            {

        wManager.wManagerSetting.CurrentSetting.LootMobs = lootStuff;
        Thread.Sleep(300000); // spend 5 minutes killing shit
        lootStuff= !lootStuff;
                Thread.Sleep(60000); //spend 1 minute looting shit
            }
        }

    }

I'm going to try that and see what happens, but I have a sneaky suspicion I am going to have overlooked something.

unfortunately, that won't work.

That will make it do the following:

  1.  Set looting to the variables value.
  2.  Wait 5 minutes before doing anything
  3.  Flip the looting variable to the opposite value
  4. Wait for 1 minute
  5. Repeat

So you'll get something like this:

Variable value = false:

  1.  Set looting to false.
  2.  Make plugin wait 5 minutes before doing anything
  3. Set looting variable to true
  4.  Make plugin wait 1 minute before doing anything
  5. Repeat:
  6.  Set looting to True.
  7.  Make plugin wait 5 minutes before doing anything
  8. Set looting variable to False
  9.  Make plugin wait 1 minute before doing anything
  10. Repeat
  11.  Set looting to false.
  12.  Make plugin wait 5 minutes before doing anything
  13. Set looting variable to true
  14.  Make plugin wait 1 minute before doing anything
  15. Repeat

 

 

I think your desired outcome is something else. I'm guessing you want it to sometimes wait 5 minutes, and sometimes wait 1 minute?

 

14 minutes ago, Stresse said:

You are so awesome! I honestly can't thank you enough (I actually need to spend some time going around and "liking" all the posts you have made that have been so so helpful to me while I try to figure all this out)! You are my god!

 

I am glad I could help ? !!!

Edited by Avvi

 If your desire is to wait 5 minutes, and sometimes wait 1 minute, then something like this will work:

    public void pluginLoop()
    {        


        bool lootStuff = false;
        int longerTimeToWait = 300000;
        int shortTimeToWait = 60000;
        int actualTimeToWait = shortTimeToWait;

        while (Products.IsStarted && _isLaunched)
        {


            if (!Products.InPause)
            {

                wManager.wManagerSetting.CurrentSetting.LootMobs = lootStuff;
                lootStuff= !lootStuff;

                if(actualTimeToWait == longerTimeToWait){
                    actualTimeToWait = shortTimeToWait;
                }
                else{
                    actualTimeToWait = longerTimeToWait
                }
                Logging.Write("Waiting this long until switching looting status: " + actualTimeToWait);
                Thread.Sleep(actualTimeToWait); 

            }
        }

    }
Edited by Avvi

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...