Jump to content

Buying from the Grand Exchange


uyfgfarOS

Recommended Posts

Hi all! I've had buying working before, so I've used code again, however in this script when I call the grandExchange.buyItem() method it writes "Grimy guam leaf" 2 times over, confirms without settings how many to buy then it ends up sending "Grimy guam leaf" on chat as it writes it a third time!

 

EDIT: ignore how many im buying and selling, it's purely just testing

if (buy == true)
     {
      //Sell all guam
         sleep(random(500,900));
         grandExchange.sellItem(250, 10, 50000);   
      sleep(random(5000,6000));
      grandExchange.confirm();
      sleep(random(700,1300));
    
      do
      {
       sleep(random(1,30));
      }
      while (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.PENDING_SALE);
     
      grandExchange.collect();
      getGrandExchange().buyItem(200, "Grimy guam leaf", 20, 100);
         sleep(random(700,1300));
         
         do
      {
       sleep(random(700,1300));
      }
      while (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.PENDING_BUY);
     
         
         grandExchange.collect();
      buy = false;

     }
Edited by uyfgfarOS
  • Like 2
Link to comment
Share on other sites

 

Hi all! I've had buying working before, so I've used code again, however in this script when I call the grandExchange.buyItem() method it writes "Grimy guam leaf" 2 times over, confirms without settings how many to buy then it ends up sending "Grimy guam leaf" on chat as it writes it a third time!

 

EDIT: ignore how many im buying and selling, it's purely just testing

if (buy == true)
     {
      //Sell all guam
         sleep(random(500,900));
         grandExchange.sellItem(250, 10, 50000);   
      sleep(random(5000,6000));
      grandExchange.confirm();
      sleep(random(700,1300));
    
      do
      {
       sleep(random(1,30));
      }
      while (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.PENDING_SALE);
     
      grandExchange.collect();
      getGrandExchange().buyItem(200, "Grimy guam leaf", 20, 100);
         sleep(random(700,1300));
         
         do
      {
       sleep(random(700,1300));
      }
      while (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.PENDING_BUY);
     
         
         grandExchange.collect();
      buy = false;

     }

http://osbot.org/forum/topic/90148-simple-ge-api

Link to comment
Share on other sites

Mine isn't sad.png

So I've imported the simple ge api and used the .createBuyOffer() method. It still types it out 3 times! So it must be something to do with my code I just can't figure it out. It doesn't repeat anything else 3 times just the buy offer

lol well for some reason sellItem doesnt work for me xD. I dunno man I guess you will have to make edits to the code

Link to comment
Share on other sites

Had that happen to me when client was laggy/low resource mode, it eventually corrects itself and buys item after 1-3 tries

 

Low resource mode? any more info on this? I leave mine to run but it just stops attempting to buy after typing the item in 3 times. Really annoying me because it's the only thing I need working to finish the script.

lol well for some reason sellItem doesnt work for me xD. I dunno man I guess you will have to make edits to the code

 

veerrrryyyy frustratingggg. pretty much rewrote the script (i was gonna do this anyway not just because of this problem) and still the same problem.

Link to comment
Share on other sites


	case BUY:
			grandExchange.collect();
			sleep(random(100, 200));
			RS2Widget buyButton = widgets.get(465, 7, 26);
			if (buyButton != null)
			{
				buyButton.interact();
				sleep(random(800, 900));
				keyboard.typeString(searchTerm);
				keyboard.sleep(5000);
				RS2Widget buySelection = widgets.get(162, 38, 1);
				sleep(random(500, 700));
				
				if (buySelection != null)
					{
					buySelection.interact();
					RS2Widget confirmButton = widgets.get(265, 27);
					RS2Widget buyPrice = widgets.get(465, 24, 52);
					RS2Widget quantity = widgets.get(465, 24, 49);
					sleep(random(200,300));
					
					if (buyPrice != null)
					{
						buyPrice.interact();
						sleep(random(900, 1200));	
						keyboard.typeString(price);
						keyboard.pressKey(13);
						keyboard.sleep(5000);
						sleep(random(200,300));
						
						if (quantity != null)
						{
							long quantityAmount = getInventory().getAmount("Coins");
							int quantityEquation = (((Number)quantityAmount).intValue() / Integer.parseInt(price) - 10);
							String quantityString = Integer.toString(quantityEquation);
							quantity.interact();
							sleep(random(600, 700));	
							keyboard.typeString(quantityString);
							keyboard.pressKey(13);
							keyboard.sleep(5000);
							sleep(random(200,300));
							grandExchange.confirm();
							ge = false;
						}			
					}
					}
			} 

Wrote my own buying method using widgets, finally working lol. Here's the code if anyone is having the same issue as me.

 

  • Like 1
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...