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
  • Widget help


    Zompies

    Recommended Posts

    Can someone please explain how to use widgets because i'm having trouble with this. I have

    WidgetChild cookInterface = getWidgets().getWidgetChild(317, 2); 

    Something along those lines and i have in if statement.

    if(cookInterface.isVisible){cookInterface.interact("Cook all");} 

    But I get a null pointer exception. I am not sure how to detect if the widget is on the screen can someone please help?

    Link to comment
    Share on other sites

    The problem is most likely that you're trying to check if the widget is visible before it is open.. thus making cookInterface null.

     

    i have and != null but still its messing up

    Link to comment
    Share on other sites

    Can someone please explain how to use widgets because i'm having trouble with this. I have

    WidgetChild cookInterface = getWidgets().getWidgetChild(317, 2); 
    Something along those lines and i have in if statement.

    if(cookInterface.isVisible){cookInterface.interact("Cook all");} 
    But I get a null pointer exception. I am not sure how to detect if the widget is on the screen can someone please help?

     

    if (cookInterface != null && cookInterface.isVisible()) :P

    Link to comment
    Share on other sites

    try checking that the parent node isnt null first?....  



    if(getWidgets().get(317)!=null)
         WidgetChild cookInterface = getWidgets().getWidgetChild(317, 2);

    Link to comment
    Share on other sites

    • 3 months later...

    Can someone please explain how to use widgets because i'm having trouble with this. I have

    WidgetChild cookInterface = getWidgets().getWidgetChild(317, 2); 

    Something along those lines and i have in if statement.

    if(cookInterface.isVisible){cookInterface.interact("Cook all");} 

    But I get a null pointer exception. I am not sure how to detect if the widget is on the screen can someone please help?

     

    How did you find the 317 and 2 numbers? I am having a horrible time figuring out how to work with widgets. (I actually want to check for the cooking interface, as well).

    Link to comment
    Share on other sites

    How did you find the 317 and 2 numbers? I am having a horrible time figuring out how to work with widgets. (I actually want to check for the cooking interface, as well).

     

     

    Use our widget hover debugger (Tools -> Debug -> Widget Hover or something like that)

    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.