Jump to content

battleguard

Members
  • Posts

    54
  • Joined

  • Last visited

  • Feedback

    100%

Posts posted by battleguard

  1. 11 hours ago, Alek said:

    States aren't bad, especially for this level of "abstraction" - I actually use them in a few of my scripts. There was a redundancy concern but I don't see that in your original concern you posted above.


    The only recommendation I have is to not return a null in your getState(), use something like "State.IDLE" - this will save you at some point! Now if your script was bigger, like if it had tanning support, perhaps "Tasks" would be better than states. If you had less, perhaps no banking at all, I'd suggest removing your states and just including everything in your onLoop.

    Just remember the more you abstract, the more the computer has to work. In your implementation, there's no performance concern at all. 
     

    For the answer to your question, as others have stated, you need to get an NPC in your onLoop. Think about this logically.

    Cow = getclosest("Cow");
    Cow = alive
    Player->Attack(Cow);
    Cow = dead
    Player->Attack(Cow); // ERROR: Cow doesnt exist

    You must now get a new closest cow.

     

    Now to remove this "redundancy" by searching for a new cow in both the getState() and onLoop(), think about it more logically (again). How about you combine the attack/search state?

    If your inventory isnt full, you're not animating, and you're in the cow pen, return State.ATTACK.

    In your attack state code, here you can implement searching for the cow and attacking it.

    Its nice to see a developer for a bot that actually takes the time to write very informative responses. I am sure you have seen these type of questions time and time again but you still tailor a unique response and dont just tell them to use the search function so kudos to you!

    • Like 3
  2. embeded resources will not work in osbot you will have to download the images from the web or you can put them in your osbot data folder.

    Here is some example code of where I try to load a file from the osbot data directory and if not found I download it from the web and create the cache

    https://github.com/battleguard/easyalch/blob/master/src/script/services/PriceLoader.java#L100

    Here someones example snippet of a file utility class

     

  3. double profitPerHour = (long) (profit * (3600000.0 / elapsedTimeMs));

    This is pretty basic logic but it works like this:

    Total Profit / TotalTimeElapsedInMilliseconds = Profit per Millisecond

    Then since you want it in hours you times it by the number of milliseconds in an hour (3600000) to now get profit per hour

  4. How do I get this script to loot arrows properly when ranging. It seems to after the kill it will loot the stuff from the kill then it gets stuck in a state where it spam clicks the safe spot and spam clicks looting arrows getting it stuck in an infinite loop.

    • Like 1
  5. 5 minutes ago, Apaec said:

    Since all the data is constant, may as well store it in an enum, but yeah this looks good :)

    Ya I forgot java allows enums to store more than just a single value im used to c# enums. Thanks I fixed above code.

    • Like 1
  6. You need to learn to use classes for grouping items together. If you use this class throughout your script you will remove all of your redundant code where you have to check each type. (Edit as EagleScript said Enum Classes will make this way better so here is the same thing written with enums now)

     

    public enum Potion {
            IRIT(259, 101),
            TOADFLAX(2998, 3002),
            AVENTOE(261, 103),
            KWUARM(263, 105),
            CANDENTINE(265, 107),
            LANTADYME(2481, 2483);
    
            public final int HerbPrice;
            public final int Margin;
            public final int UnfinishedPrice;
            public final String Name;
            public final int HerbId;
            public final int UnfinishedId;
            private final String UnfinishedName;
    
            Potion(int herbId, int unfinishedId) {
                Name = name().substring(0,1).toUpperCase() + name().substring(1).toLowerCase();
                UnfinishedName = Name + " potion (unf)";
                HerbId = herbId;
                UnfinishedId = unfinishedId;
                // TODO: you should make your GE lookup class methods static so you dont need to instiantiate this.
                GrandExchange ge = new GrandExchange();
                HerbPrice = Math.max(ge.getBuyingPrice(HerbId), ge.getSellingPrice(HerbId));
                UnfinishedPrice = Math.min(ge.getBuyingPrice(UnfinishedId), ge.getSellingPrice(UnfinishedId));
                Margin = UnfinishedPrice - HerbPrice;
            }
        }
    
    // here is how you would get the current potion you are using
    Potion highestMarginPotion = Arrays.stream(Potion.values()).max(Comparator.comparingInt(p -> p.Margin)).get();

    Please make sure you know how to use classes though before using this code.

  7. Neither of those two examples are snippets btw but an entire script. Snippets are what you see in the snippet section such as

    - grab ge prices
    - skill tracker
    - inventory tracker
    - Timers
    - Paint Helper
    - Gui Helper
    - Conditional Sleep Util
    - Number Formatters
    etc...

     

  8. I get that jar in memory warning also when building with intellij, but the script will still update when you hit refresh on the script selector on the next run. Check and see if the last modified date is changing on the compiled jar when you build.

  9. 15 hours ago, Unclaimed said:

    Botting on 4 accounts on the same IP is an insta ban dude, you live and you learn and now your IP is flagged forever son

    This is definitely not true not sure why so many people believe IP flagging is such a huge deal. I have been botting on the same IP with up to 10 bots a day and they get banned periodically but if they were IP flagging they would all be banned way quicker than they are. You would see a huge difference in ban rates from when you initially started botting till now because they would be banning way quicker just by checking your ip.

  10. This can easily be done but you have to create the webwalk event and pass it to the exector instead of calling the web walking methods inside of the walking class. Just tested this code and it will never run. If you use intellij you can look at the obbed source code of web walking event and see what goes inside to figure these things out quicker.

            Position alkharidBank = new Position(3269, 3167, 0);
            WebWalkEvent webWalkEvent = new WebWalkEvent(varrock);
            webWalkEvent.setEnergyThreshold(Integer.MAX_VALUE);
            this.execute(webWalkEvent).hasFinished();

    https://osbot.org/api/org/osbot/rs07/event/WebWalkEvent.html#setEnergyThreshold-int-

     

    osbot code that handles runnng in WebWalkEvent

    Spoiler
    
    public class WebWalkEvent extends Event {
        public WebWalkEvent(Position... IIIiiiiiIIII) {
            IIIiiiiiIIII.iiiiIiiIIIIi = CoN.IIIiiiiiIIII;
            IIIiiiiiIIII.iIiIiiiIiIII = null;
            IIIiiiiiIIII.iiIiIiiIIIii = null;
            IIIiiiiiIIII.iiiIiiiiiiii = null;
            IIIiiiiiIIII.IiIiiiiIiIii = 1300L;
            IIIiiiiiIIII.IIiiIiiiiiiI = null;
            IIIiiiiiIIII.iiIIiiiiiiiI = -1L;
            IIIiiiiiIIII.IIIIIiiiIIii = 5;
            IIIiiiiiIIII.IiiIIiiiIIIi = 15; // DEFAULT RUN ENERGY SET HERE TO 15
            IIIiiiiiIIII.IiiiiiiiiiIi = true;
            IIIiiiiiIIII.IiIIiiiiIIII = null;
            IIIiiiiiIIII.IIIiiiiiIIII = false;
            IIIiiiiiIIII.IiiiiiiiIIii = 3;
            IIIiiiiiIIII.iIIIiiiIiIII = null;
            IIIiiiiiIIII.iiIiiiiiIIii = IIIiiiiiIIII.IIIiiiiiIIII ? 70 : 20;
            IIIiiiiiIIII.iiiIiiiIIiii = null;
            IIIiiiiiIIII.IIIIIiiiiiIi = false;
            IIIiiiiiIIII.iIiIiiiIiIII = IIIiiiiiIIII;
        }
    
        public WebWalkEvent setEnergyThreshold(int IIIiiiiiIIII) {
            IIIiiiiiIIII.IiiIIiiiIIIi = IIIiiiiiIIII; // YOU CAN OVERRIDE DEFAULT HERE
            return IIIiiiiiIIII;
        }
    
        public int execute() throws InterruptedException {
          ...
           if (var16 instanceof ClickMouseEvent && IIIiiiiiIIII.getSettings().getRunEnergy() > IIIiiiiiIIII.IiiIIiiiIIIi) {
              IIIiiiiiIIII.getSettings().setRunning(true); // CHECKS CURRENT ENERGY VS SET ENERGY AND TURNS ON RUN IN THE EXECUTE LOOP
           }
          ...
        }
    }

     

     

    • Like 1
  11. 4 hours ago, Destrupt said:

    Interesting, would be helpful if you have random stacks of items in your bank. Have you got any proggies? :D

    I’ll buy a bunch of items today and see if I can get a longer progress picture. The main benefit of this script is it’s great if you want to alchemy for a profIt by just buying a bunch of armor items that have very low buy limits  but will make money when alchemy. 

  12. This is a basic High Level Alchemy Script that supports the following things.

    - Automatically setting up item in best spot
    - Alching Multiple items in one run
    - Nice GUI thats show all items in your inventory worth alching with pictures and item names
    - Profit per alch based off of current osbuddy price for item and nature rune
    - Minimalist paint
    - Accurate Alching times for human alching

    TODO:
    - Cleanup view code
    - Add back in support for low level alchemy
    - Add back in customizable alching times
    - Add in support for changing alch position randomly

     

    Link to Download Jar: https://github.com/battleguard/easyalch/releases/download/1.0/EasyAlch.jar

    Link to view source code: https://github.com/battleguard/easyalch

    Startup Gui:

    easyalch-gui.PNG.956fa152979981d433cf55c44592af9c.PNG

    Runtime Paint

    easyalch-runtime-gui.PNG.3475bc6697cc776eb936ff1d5dcdee43.PNG

     

    This script was written initially by me over 6 years ago so it was interesting to rewrite and see what all has not changed since then.
    (Original Code from 6 years ago: https://gist.github.com/battleguard/3109764)

    Let me know if you have anything you want me to add and if this is something I should try and pursue to get on the SDN. Its just a simple alcher but I could not find any on the SDN that had all the features from my old script so that is why I decided to bring it back.

     

  13. 12 minutes ago, Burundanga said:

    wait a second, why would you do 7qp runs on p2p accounts? u have no trade restriction if mems

    haha your kidding I did not know that... Well that saves half the time then for getting the account ready. Does this also apply for selling items on the grand exchange because I sell items I collect before muling the money.

  14. 6 minutes ago, R3G3N said:

    Are you using your own IP or a proxy? Are you using the OSBot client when manually doing tutorial and 7qp or using the OSRS client?

    its all on my home IP with no proxy and I use the osbuddy client when manually doing it. I really dont think using a proxy though while doing the tutorial script will fix it I think tutorial island is just super ban prone in general.

    I might try buying some accounts as the guy above suggested but im sure those are done through a script also so I dont think that will make much difference. Do people notice a drastic difference in bans based off which tutorial island script they use I could try buying the one on the sdn instead of using explv free one.

  15. I have a private script that I made that requires just 7QP and I am able to run them the full 14 days of membership with no bans almost always if I manually do the tutorial island and 7QP's. If I run a script though for the Tut and 7QP's they get banned in 2-5 days always. It seems crazy that I can run my private script everyday for 14 days straight and not get banned but just running 30 minutes of botting for tutorial island and 7QP's always gets them flagged and banned 2-5 days later. I also am resting these accounts for 3 days after completing the 7QP's.

    Does everyone just manually do the tutorial island and beginner quests for P2P farming or am I missing something because it really stinks to have to manually make 10 new accounts every 14 days and get them 7QP's.

    Any tips or advice would be appreciated thanks

     

     

  16. 23 minutes ago, liverare said:

    Whenever I make a custom API for OSBot, I extend the API class onto that object:

    Also, RSBuddy can read your Grand Exchange offers without you ever having to be present at the GE. My guess is that there are configs you can use to read your offers. It'd be more optimal to these, because you're likely to have fewer IDs and a lot less code. Furthermore, you don't have to rely on Widgets nearly as much, which is something you should definitely consider doing, because Jagex seem to be playing around with an awful lot of them as of late.

    https://osbot.org/api/org/osbot/rs07/api/Configs.html

    Also, the bot has config listener too: https://osbot.org/api/org/osbot/rs07/listener/ConfigListener.html

     

     

    The configs do not hold the current grand exchange trade data sadly it must be in a hook that osbot has not implemented.

  17. If you want to get away from using static ids for things like getting the box widgets you should look into using bounding box sizes, x and y values for figuring out which box is what. For the buy and sell button on the box you can use Sprite ID's. That is how it is done in the OSBOT source code.

    • Like 1
  18. 1 hour ago, d0zza said:

    The new directory is OSBot\data. You can get this directory in your script by doing getDirectoryData() and then concatenate the file name onto that.

    the problem with the Osbot\data folder is I want to be able to bake resources into my jar so I do not have to download all the files off the web and put the cached version into the osbot\data folder. For example if I had images for my paint it would be nice to just put them in my resources folder instead of having to store them online and then download them when I want to run the script. Sure once I run it once I could cache them in the users osbot\data folder but I would rather not have to do that.

     

    Also if that is the case now that OSBOT/data is supposed to be used for now on hopefully one of the mods can remove this sticky it might save some other scripter a couple hours of headache.

  19. I have followed every step in this tutorial and have verified the resource file is in the right spot on the jar and have tried this with a non osbot jar and everything works, but I cannot get this working in OSBOT at all. My guess is there has been security permissions that have changed this this post was made. Can anyone verify this still works because I have tried everything.

  20. I really hope someone can answer my question because it looks like the jar starts up the script application org.osbot.BotApplication with the JVM argument -XX:+DisableAttachMechanism which makes it impossible to do any sort of profiling or creating heap dumps. @Alec hopefully you can clear this up.

    This really stinks because you can never then use these tools to diagnose memory problems in your script or look at cpu hotspots in your script etc...

×
×
  • Create New...