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
  • Try asking for help in the chatbox
  • Some nulls and and widgets visibility...


    greyb3ast
     Share

    Recommended Posts

    So i am having problem with logic i guess... When i do simple way everything works:

    if (getInventory().contains("Gold bar")) {
    //do stuff
    }
    

    but when i add more stuff script starts but does nothing not even throw a error or exception:

    WidgetChild b = getWidgets().getWidgetChild(446, 25);
    if (b != null && !b.isVisible() &&getInventory().contains("Gold bar")) {
    // do stuff
    }
    

    Any ideas what could i try?

    Link to comment
    Share on other sites

    Maybe because the widget is visible or maybe you meant " do stuff when b is not null and b IS visible"?

    Widget is NOT visible, and i meant do stuff when b is NOT visible.

    Edited by greyb3ast
    Link to comment
    Share on other sites

    Widget is NOT visible, and i meant do stuff when b is NOT visible.

    maybe when your widget is not visible it is null?

    Try to log them separately and see which one returns false. log(b != null + "") etc

     

    You could use 

    b == null || !b.visible()

    And if you are 100% sure it should work, then restart your client and try it again. Sometimes i get weird results until i restart my client.

    Edited by rexas
    Link to comment
    Share on other sites

    maybe when your widget is not visible it is null?

    Try to log them separately and see which one returns false. log(b != null + "") etc

     

    You could use 

    b == null || !b.visible()

    And if you are 100% sure it should work, then restart your client and try it again. Sometimes i get weird results until i restart my client.

    Thank you very much it works now you are my hero :D

    Link to comment
    Share on other sites

     Share

    ×
    ×
    • 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.