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
  • Purchasing items from shop bug


    kamilo

    Recommended Posts

    so i use this snippet to buy item from the shop 

    getShop().purchaseTen(itemName);

    and sometimes when the shop is open and this command doesn't register and keeps repeating

     

    but first my code checks

    if (getShopt().is Open) {
    	
    	if (!getShop().isOpen) {
    
    	// trade npc and open shop
    	]
    
    	if itemstock < desiredtock {
                        
             // dont buy
    
                              
    	{ else {
            
             // issue here because sometimes when my shop is open
             // i keep seeing 'itembought' in the log chat spam over and over again  
             // even though the BOT is stuck on shop screen (which is open)        
             // hence this snippet is being repeated if the shop interface is already open                     
    		
            getShop().purchaseTen(itemName);
        	log("Itembought");
                            
    }

     

    As explained above my code gets stuck at getShop().purchaseTen(itemName);

    but doesnt buy anything all i see is that log "itembought" in the debug console

     

    any thoughts on why this might be happening?

    oh fyi this repeats when the shop is ALREADY open, and the mouse is stuck at the item while the text repeats in the chat

     

    i added a close option to fix this, but doing so my bot trades the shop keeper twice everytime, 

    i also tried added if (getShop().isOpen()) inside the else frame AGAIN, to see perhaps it might fix it, but it doesnt

     

    as of now im thinking of trying shopscreen is open =! null to see if that might work

     

    any solutions to this? or did this happen to anyone else

    Link to comment
    Share on other sites

    Personally I would just check for the widget if the default is isOpen() for shops isnt working but checking for the widget, and if not null doing a sanity check of isVisible so something kinda like:

    public boolean shopOpen(int widgetId){
    	if(getWidgets().getWidget(widgetId) != null)
    		return getWidgets().getWidget(widgetId).isVisible();
    	return false
    }

    then I would maybe loop through the children until I found one that had the name of the item, and interact with it, but thats just because I personally have not worked with the shop api

    Link to comment
    Share on other sites

    You're probably going to have to post your actual code.

    What you have written there wouldn't compile at all. Which means clearly it's not what you're specifically doing.

     

    Edit:
    I would suggest moving your logic, though. I don't know why you have purchaseTen within your !open block.

    Should probably be:
    if(!open){open}
    else if(stock too low){hop or w/e you want}
    else{purchaseten}

    Link to comment
    Share on other sites

    On 11/10/2019 at 6:06 PM, Nuclear Nezz said:

    You're probably going to have to post your actual code.

    What you have written there wouldn't compile at all. Which means clearly it's not what you're specifically doing.

     

    Edit:
    I would suggest moving your logic, though. I don't know why you have purchaseTen within your !open block.

    Should probably be:
    if(!open){open}
    else if(stock too low){hop or w/e you want}
    else{purchaseten}

    do you have some well written open source scripts that utilize, nodes etc want to improve my scripting

    Link to comment
    Share on other sites

    9 hours ago, kamilo said:

    do you have some well written open source scripts that utilize, nodes etc want to improve my scripting

    I have open source scripts, but I'm not sure how up to date they are.

    You can also just go look through some of the tutorials or scripting snippets on the forums. I believe Articron has a pretty nice guide for nodes.

    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.