Jump to content

Selling items in GE


Magerange

Recommended Posts

I've been trying to implement @LoudPacks GE API here (no idea if it is outdated or not, but when I tested it for GE actions (buy & sell items in quantities, etc.), it did everything according to the code). Now I try to implement it in my local personal script and the script manages to get stuck in different places (terminal shows that commands have been executed though). I've been on this mission for the past two days but I get stuck without commands being executed...

So far I've made it that makes it to the GE, opens an offer, sets price for the item and then closes the offer window (strange that it doesn't do anything with the amount, eventhough it is noted in params).
So here is the snippet:

	private void sell() throws InterruptedException {
		getWalking().webWalk(GrandEx);
		GrandExchange GE = new GrandExchange(this);
		GE.openGE();
		GE.createSellOffer("Jug of water", 14, 300);
		GE.collectItems(false);
	}

Yes, I am aware of the GE API implemented in the OSBot API, but since I am new to Java in general this seemed easier. Perhaps you could point me in the right direction how my intended action would look in the code if I used original OsBot GE API instead?

Thank you!

Edited by Magerange
Link to comment
Share on other sites

1 hour ago, Magerange said:

I've been trying to implement @LoudPacks GE API here (no idea if it is outdated or not, but when I tested it for GE actions (buy & sell items in quantities, etc.), it did everything according to the code). Now I try to implement it in my local personal script and the script manages to get stuck in different places (terminal shows that commands have been executed though). I've been on this mission for the past two days but I get stuck without commands being executed...

So far I've made it that makes it to the GE, opens an offer, sets price for the item and then closes the offer window (strange that it doesn't do anything with the amount, eventhough it is noted in params).
So here is the snippet:


	private void sell() throws InterruptedException {
		getWalking().webWalk(GrandEx);
		GrandExchange GE = new GrandExchange(this);
		GE.openGE();
		GE.createSellOffer("Jug of water", 14, 300);
		GE.collectItems(false);
	}

Yes, I am aware of the GE API implemented in the OSBot API, but since I am new to Java in general this seemed easier. Perhaps you could point me in the right direction how my intended action would look in the code if I used original OsBot GE API instead?

Thank you!

It's better to just use the OSBot api.

Also, just some tips:

only webwalk if ge area does not contain player pos and we are very far away

use Banks.GRAND_EXCHANGE as it's in the bank location api and it's better to just call the area from that instead of making your own area which may be redundant.

every time the method sell is called it will create the GE object/class and it's better to just create it on the onstart once not every time it's called

i havent seen his snippet but i assume the open ge caters for opening the ge if it isnt open in the first place? because if it doesnt it will probably just spam click it open or somethin

  • Like 1
Link to comment
Share on other sites

1 minute ago, LoudPacks said:

Its mad outdated lmao

Couldn't just replied to a PM lol? But thanks for confirming.

 

On to the OSBot API - how come that I import the GrandExchange Class and use it in the script, but script shows that I do not use it...? The commands I call are allowed, but they do not work when testing the script on OSRS...

Maybe it's because I wrote it over LoudPacks API?

Link to comment
Share on other sites

1 hour ago, Magerange said:

I am aware of the GE API implemented in the OSBot API, but since I am new to Java in general this seemed easier. Perhaps you could point me in the right direction how my intended action would look in the code if I used original OsBot GE API instead?

Thank you!

You should probably learn Java before trying to script. That method is pretty bad, not going to sugarcoat it.

Link to comment
Share on other sites

4 hours ago, Magerange said:

Couldn't just replied to a PM lol? But thanks for confirming.

 

On to the OSBot API - how come that I import the GrandExchange Class and use it in the script, but script shows that I do not use it...? The commands I call are allowed, but they do not work when testing the script on OSRS...

Maybe it's because I wrote it over LoudPacks API?

Just write your own that works built on top of the osbot api. Also you can't have classes with the same names or it can use issues.

Link to comment
Share on other sites

1 hour ago, Magerange said:

Finally cracked it. Turns out you have to put in some hefty sleeps in between the commands. I guess it's because of heavy code that Alek has pushed together under GE API and the fact that GE tends to lag.

Putting a sleep before or after buyItem/sellItem won't change a single thing; that or you deobfuscated the jar, reversed the methods, then re-wrote them with your new sleeps in the method? I have no idea where you are putting these magical sleeps.

  • Like 1
Link to comment
Share on other sites

  • 4 years later...

sellItem() doesn't really appear to be working in 2021? sellItem(Box) works fine in opening the interface, but much of the time sellItems() just returns false having failed. I'm writing a merching script and having to rewrite wrappers around all these methods (eg. also around getOverallPrice() which randomly NPEs from time to time) is frustrating. Let me know if it's my fault -- short context on how I'm using it is below. Help much appreciated! Maybe it is also failing in a similar way nowadays for others.

if (free_box != null){
    log("found free box to bigSell in: " + free_box);
    getGrandExchange().sellItems(free_box);
    log("opened sell interface");
    sleep(approx(3000));
    boolean sold = getGrandExchange().sellItem(name2id(itemName), price, (int) this.inventory.getAmount(itemName));

 

Edited by galois69
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...