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
  • How to check if GE offer completed?


    Sicilian7

    Recommended Posts

    When my script has put in a GE offer, how can I tell distinguish between the following:

    1) Offer is still waiting, i.e. 0 out of x items have been bought/sold. Game shows empty bar inside the offer's slot.

    2) Offer is partially completed, i.e. 2 out of x items have been bought/sold. Game shows a partially filled bar that is colored yellow.

    3) Offer was canceled. Game shows a red bar.

    4) Offer was completed. Game shows a green bar.

    Link to comment
    Share on other sites

    You can use the methods in the GrandExchangeItem Object class to get the offer details which can be used to determine the progress of the offer.  

    https://dreambot.org/javadocs/org/dreambot/api/methods/grandexchange/GrandExchangeItem.html

     

    For #3: I cancel an offer with 

    getGrandExchange().cancelOffer(slotNumber);

    and then when cancelOffer() returns true you can then collect the item and/or coins.

     

    For # 1, 2, and 3 something like this:

    int slotNumber;
    int quantity;
    int getPrice;
    int getTransferredAmount;
    int getTransferredValue;
    int getValue;
    int itemID;
    String itemName;
    
    //Determine offer status for each Grand Exchange slot
    for (GrandExchangeItem geItem : getGrandExchange().getItems()) {
    	slotNumber = geItem.getSlot();
    
    	if (getGrandExchange().isSlotEnabled(slotNumber) && getGrandExchange().slotContainsItem(slotNumber)) {
    
    		//Get slot information to variables
    		quantity = geItem.getAmount();
    		getPrice = geItem.getPrice();
    		getTransferredAmount = geItem.getTransferredAmount();
    		getTransferredValue = geItem.getTransferredValue();
    		getValue = geItem.getValue();
    		itemName = geItem.getName();
    		itemID = geItem.getID();
    
    		log("Slot: " +slotNumber);
    		log("Item Name [" +itemName+ "] Item ID: [" +itemID+ "]");
    		log("Quantity: [" + quantity + "] * Price: [" + getPrice + "] = Value: [" + getValue + "]");
    		log("Transferred Amount: [" + getTransferredAmount + "] Transferred Value: [" + getTransferredValue + "] cashBack: [" +cashBack+ "]");
    		
    		if (geItem.isBuyOffer()) {
    			if (quantity == getTransferredAmount) {
    				log("Buy offer, 100% bought");
    			} else if (getTransferredAmount == 0) {
    				log("Buy offer, nothing bought");
    			} else if (getTransferredAmount > 0 && getTransferredAmount < quantity) {
    				log("Buy offer, partially completed");
    			}
    		} else if (geItem.isSellOffer()) {
    			if (quantity == getTransferredAmount) {
    				log("Sell offer, 100% sold");
    			} else if (getTransferredAmount == 0) {
    				log("Sell offer, nothing sold");
    			} else if (getTransferredAmount > 0 && getTransferredAmount < quantity) {
    				log("Sell offer, partially completed");
    			}
    		}
    	} else if (getGrandExchange().isSlotEnabled(slotNumber) && !getGrandExchange().slotContainsItem(slotNumber)) {
    		log("Empty");
    	} else if (!getGrandExchange().isSlotEnabled(slotNumber)) {
    		log("Disabled - Members Only");
    	} else {
    		log("ERROR: Unable to determine slot status!"); //This happens sometimes in my experience
    	}
    }

     

    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.