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
  • WorldMap API and Widgets -- how to get the GrandChild ID values?


    Recommended Posts

    Posted

    I wasn't able to find an existing API for interacting with the World Map -- likely because it isn't exactly a necessary bot action.

    I've been implementing my own API via interacting with the widgets, but I've run into a little trouble.  Things work for now, but I'm thinking it is mostly by luck in that the internal ordering of Widgets has the correct/ideal Parent widget appearing first.

    Some of the widgets on the map are GrandChild widgets, with their own individual sub-IDs.  However, using the existing Widgets/ChildWidget APIs, it appears that the reported value for "getID()" on a GrandChild widget is actually the Parent's ID.  And the "getParentID()" is actually the GrandParent's ID.

    Essentially I am looking for a way to find the Parent widget from a Child widget.

    • If Widgets had unique IDs, and the child knew the Parent's unique ID, that could work
    • If there was a direct API call/reference from a ChildWidget to its Parent, that could work

    Currently my implementation that "works" looks like the below.  However, considering that the RealID value appears to be the same for all the widgets under a given top-level-ish widget, I'm surprised this works at all.

    
        public static WidgetChild GetParentWidget(WidgetChild child) {
            return Widgets.get(widgetChild -> widgetChild.getRealID() == child.getRealParentID());
        }

     

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • 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.