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
  • buying items from the shop


    cuntismcgee

    Recommended Posts

    See if you can use the widget ID of the item in the shop to interact with it instead. That seems like it'd work. If you can't do it with the widget ID, Shop may need to be updated. Posting the full code will also help (Any surrounding code/if statements/whatever)

    Link to comment
    Share on other sites

    i called dreamlicker to come help you dont worry fham

     

    for some reason i thought you were joking til i noticed he did reply XD

     

    See if you can use the widget ID of the item in the shop to interact with it instead. That seems like it'd work. If you can't do it with the widget ID, Shop may need to be updated. Posting the full code will also help (Any surrounding code/if statements/whatever)

    ah dude, freggin sweet. i never would have thought of that. it actually did work. thank you good sir :)

     

    Edit: nvm lol the mouse gets stuck again and just moves around in random motions and so does the camera o.o

     

    heres the code:

    private void shop() {
    
                count = getInventory().count(Item);
                NPC shopKeeper = getNpcs().closest("Shop keeper");
    
                if (shopKeeper != null) {
                    if (!getInventory().isFull()) {
                        if (getInventory().contains("Coins")) {
                            if (!getLocalPlayer().isInteracting(shopKeeper)) {
                                if (shopKeeper.interact("Trade")) {
                                    sleepUntil(() -> getShop().isOpen(), Calculations.random(1000, 3000));
                                    if (getShop().isOpen() && getShop().contains("Bucket")) {
                                        sleepUntil(() -> getWidgets().getChildWidget(300, 2) != null, 0);
                                        getWidgets().getChildWidget(300, 1).interact("Buy 10");
                                        sleepUntil(() -> !getLocalPlayer().isInteracting(shopKeeper), Calculations.random(2000, 3500));
                                    }
                                }
                            }
                        }
                    } else {
                        state = 1;
                    }
            }
        }
    
    Link to comment
    Share on other sites

    Hey, I would recommend you to format your code differently. Right now you have all of the code in the same if statements. This might be causing problems because the code is looping over and over again and when it does some of those booleans inside if might be false and then code will not run.

     

    Try using this format, it will serve you better with the looping

     

    If inventory is not full

    If shop is open

    Purchase items

    Else

    Interact with shop npc

    Else

    State = 1

     

     

     

    In your code you are interacting first with the npc and then checking if the shop is open. In the next loop it will try to interact with the npc even though the shop is already open.

    Link to comment
    Share on other sites

    do what hashtag says 

    because your code can't possibly work atm :/

     

    try something like if(getShop().isOpen){ buystuff} else { shopkeeper.interact

    Link to comment
    Share on other sites

    Hey, I would recommend you to format your code differently. Right now you have all of the code in the same if statements. This might be causing problems because the code is looping over and over again and when it does some of those booleans inside if might be false and then code will not run.

     

    Try using this format, it will serve you better with the looping

     

    If inventory is not full

    If shop is open

    Purchase items

    Else

    Interact with shop npc

    Else

    State = 1

     

     

     

    In your code you are interacting first with the npc and then checking if the shop is open. In the next loop it will try to interact with the npc even though the shop is already open.

     

    thank you guys that was the problem. i wrote that after staying up like 24 hours and now that I've woken up the next day I can tell doing it that way was a terrible idea lol

    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.