Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Looting based on GE price etc.. rather than id/name


    kamilo

    Recommended Posts

    Looking for feedback on idea on how to LOOT;

    1. Just loot based on id/String name

    2. Loot based on GE price; use a price grabber; scan all the items then check their prices to see if it's worth looting or not

    3. Create a personal price grabber a hashmap with Name/ID , Price; ofcourse the price doesn't have to be exact since it flutuates but the basic valuebility will be there

     

    Considering option 2; but concerned that scanning all ground items, then grabbing the price using json etc... might use up more memory/cpu

    don't mind spending a great deal of time making my own chart so all the data is already there and script won't have to scan over and over again

    please if you have experience with this let me know your thoughts, want the most efficient method

    ofcouse if you have better idea's feel free to list, i am looting in the wildy thus i wont know what might pop up thats why im so in depth 

    Link to comment
    Share on other sites

    Yep pretty much what Nex said, it isn't a difficult concept, and there's tons of classes floating around for grabbing the ge price of item. Simply iterate through ground items that aren't currently included in your map, store them with the value key and then act accordingly.

    Link to comment
    Share on other sites

    14 hours ago, Pseudo said:

    Yep pretty much what Nex said, it isn't a difficult concept, and there's tons of classes floating around for grabbing the ge price of item. Simply iterate through ground items that aren't currently included in your map, store them with the value key and then act accordingly.

    so basically what you're saying it store it all at once (lets say at start of script), and keep using that, as opposed to filter item and checking price by price

    Link to comment
    Share on other sites

    21 hours ago, Nex said:

    cache the prices and keep calling upon them, its easy to do, id suggest a hashmap

    what do u mean by cache the prices

    Link to comment
    Share on other sites

    14 hours ago, Pseudo said:

    Yep pretty much what Nex said, it isn't a difficult concept, and there's tons of classes floating around for grabbing the ge price of item. Simply iterate through ground items that aren't currently included in your map, store them with the value key and then act accordingly.

    ah what you're saying is scan the item once and store it, and if the item being scanned isn't on the map, add it? thats very smart ill think about this one

    Link to comment
    Share on other sites

    Nex and I are both saying pretty much the same thing. You make a new Map (look into Maps/Hashmaps if you're unfamiliar with them). You have a key and a value for each item in a hash map, so I.E. you may have the key as '"Limpwurt root' and the value as '400'. The prior being the name (or id), the latter the price. You then iterate through ground items and upon detecting one that doesn't have a key present in our map, you use a look up query, determine the price, and store it in the map.

    Link to comment
    Share on other sites

    I happen to have just written this so I thought I would share it and hopefully you can use it to adapt your own method. You'll have to make some changes/add additional code to your script but I've commented it to help you out.

    private GroundItem getGroundItemByValue() {
            Map<Integer, GroundItem> groundItems = new HashMap<>(); //Where we store the initial GroundItems
            for (GroundItem gi : getGroundItems().all()) {
                if (config.isValueable(gi.getName()) && gi.distance() < 10) { //Check against a list of valuables which has priority & not too far
                    log("Valuable found in AMOUNT");
                    return gi;
                } else if (isItemInList(gi.getName()) && gi.distance() < 7) { //Check against a list of desired items & not too far
                    if (config.getLootPrices().containsKey(gi.getName())) { //Check we've appraised this item before
                        groundItems.put(gi.getAmount() * config.getLootPrices().get(gi.getName()), gi);//Add to list of GroundItems since it's something we want, multiply the amount by the price and store it as the key, the GroundItem as the value.
                    } else { //We haven't appraised it, get the price and commit to memory. 
                        //I personally have this commented out as it's a bit slow for my script since the user could be killed but otherwise
                        //this is how I would to do it with getLootPrices() returning a HashMap<String, Integer>
                        config.getLootPrices().put(gi.getName(), config.getGrandExchangePrice(gi.getID()));
                    }
                }
            }
            //TreeMaps sort by key by default, add Collections.reverseOrder() to sort by descending order
            TreeMap<Integer, GroundItem> sortGroundItems = new TreeMap<>(Collections.reverseOrder());
            sortGroundItems.putAll(groundItems); //Copy our initial batch of GroundItems over to our TreeMap (now sorted desc)
            if (groundItems.size() > 0) {
                for (GroundItem e : sortGroundItems.values()) { //Loop them
                    if (canPickup(e)) { //Custom "canReach" function
                        log("Targetting: " + e.getName() + " = " + e.getAmount());
                        return e; //Return our most valuable ground item in reach.
                    }
                }
            }
            return null;
        }

     

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.