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
  • Grand Exchange - buy / sell


    ginahana1

    Recommended Posts

    Hey,

    I need some help with my scripting journey using DreamBot.

    My script and most of my scripts will probably use GE at some point, but the problem is I can't buy anything from GE! It is possible to sell, but not buy!

    I am 100% sure that I am not restricted or something. I looked up docs ( Yes, i know that this exist, but it does not work... 😕 -> GrandExchange.buyItem("Cosmic rune", 100, 95)), tried everything (even typing in searchbar using Keyboard to serach for an item - because GrandExchange.searchItem("Cosmic rune") does not work either) and nothing worked - except the fact that that I can buy something only if the item that I want to buy is the last bought item.

    Can you please provide me some snippets that contain buying items from GE? If you have some snippets that contain selling I would be happy too, but the point is buying.

    Thanks in advance for repsonse! And sorry for my english :D

    Link to comment
    Share on other sites

    16 hours ago, MaximusPrimo said:

    If you could post a larger snippet of your code for buying it would be easier to see what is going on in your code

    Here are few snippets I made to try diffrent solutions. There was more attempts yesterday - I wrote these snippets for the answer right now. Just like i said - nothing works except selling (buy, search etc. doesnt work all the way).  Thats why i asked for some ready to use snippets to understand what am I doing wrong, or what conception I dont understand (This is my first Dreambot script and actually first Java code).

     

    		GrandExchange.open(); //works
    		Sleep.sleep(1000, 1500); //works
    		GrandExchange.openBuyScreen(0); //works
    		Sleep.sleep(500, 1000); //works
    		if(GrandExchange.isSearchOpen()) {
    			log("Grand exchange search open!");     //works
    			GrandExchange.searchItem("Cosmic rune"); // does not work - no search
    			log("Should search cosmic rune!"); //works
    		}
    		GrandExchange.close();
    		
    		////////////////////////////////////////////////////////////////////////////
    		
    		GrandExchange.open(); //works
    		Sleep.sleep(1000, 1500); //works
    		GrandExchange.openBuyScreen(0); //works
    		Sleep.sleep(500, 1000); //works
    		if(GrandExchange.isBuyOpen()) {
    			log("Buy window is open"); //works
    			GrandExchange.buyItem("Cosmic rune", 10, 92); // does not work - only if the last searched item is cosmic rune it will buy it.
    			log("Should buy cosmic rune using .buyitem"); // works
    			
    		}
    		GrandExchange.close();
    		
    		////////////////////////////////////////////////////////////////////////////
    		
    		GrandExchange.open(); //works
    		Sleep.sleep(1000, 1500); //works
    		GrandExchange.buyItem("Cosmic rune", 2, 93); //opens buy screen, but still doesn't buy the item. If the last searched item is cosmic rune it will buy, buy only after that.
    		GrandExchange.close(); //works

     

    Link to comment
    Share on other sites

    • 3 weeks later...
    13 hours ago, TheSaint said:
    	GrandExchange.buy(itemName, Quanity, Price);

     

    First of all there is nothing like just .buy :D And second of all - for some people that doesn't work what you had in mind - i tried many solutions including yours and they didint work for some reason 😕 

    Link to comment
    Share on other sites

    import org.dreambot.api.methods.grandexchange.GrandExchange;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    @ScriptManifest(name = "GE Test", description = "", author = "TheSaint",
            version = 1.0, category = Category.MONEYMAKING, image = "")
    public class Main extends AbstractScript {
        
        @Override
        public int onLoop() {
            if (!GrandExchange.isOpen()) {
                GrandExchange.open();
            } else if (GrandExchange.isReadyToCollect()) {
                GrandExchange.collect();
            } else if (GrandExchange.getOpenSlots() > 0) {
                GrandExchange.buyItem("Jug of wine", 1, 5000);
            } else {
                log("No open slots available to buy items.");
            }
            return 2000;
        }
    
    }

     

    Link to comment
    Share on other sites

    I already tried something like you posted. I will try anyway again later this day to check if it works diffrently this time.

    If it will not work i will post a snippet of the code.

    Thanks for your help :)

    Link to comment
    Share on other sites

    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...

    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.