Sicilian7 9 Share Posted August 9, 2020 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 More sharing options...
TheRevelo 7 Share Posted August 9, 2020 Get the Widget of the Completion bar, and then just get the Text Color. Thats how it worked for me Link to comment Share on other sites More sharing options...
Xtra 31 Share Posted August 9, 2020 Look through the API, you can do what you're asking with ithttps://dreambot.org/javadocs/org/dreambot/api/methods/grandexchange/GrandExchange.html Link to comment Share on other sites More sharing options...
Pixel_Life 24 Share Posted August 9, 2020 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.