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
  • Widgets


    Astrate
     Share

    Recommended Posts

    What I'm trying to accomplish is getting a widgets text

    String Soldd = getWidgets().getWidgetChild(383, 3, 5).getText();

    From history, ex (" 4,720,403 coins")

    and removing the "coins" from the string

    String Soldd2 = Soldd.replace("coins", "");

    and parseInt the ("4,720,403") and storing it

    int Soldresult = Integer.parseInt(Soldd2);

    But everytime it runs through String Soldd it returns null, Any help?

    Link to comment
    Share on other sites

    1 hour ago, Nuclear Nezz said:

    Are you checking the right widget for text?

    i believe so, In game debug it shows Text: 3,400,000 coins

    Edited by Astrate
    Link to comment
    Share on other sites

    4 hours ago, Astrate said:

    What I'm trying to accomplish is getting a widgets text

    String Soldd = getWidgets().getWidgetChild(383, 3, 5).getText();

    From history, ex (" 4,720,403 coins")

    and removing the "coins" from the string

    String Soldd2 = Soldd.replace("coins", "");

    and parseInt the ("4,720,403") and storing it

    int Soldresult = Integer.parseInt(Soldd2);

    But everytime it runs through String Soldd it returns null, Any help?

    First of all, you can't parse int 4,720,403. You could parse int 4720403 instead.

    Try to open the history interface before running the script. If it's still null then most likely that widget doesn't exist or it has no text.

    Link to comment
    Share on other sites

    18 minutes ago, ozeki6 said:

    First of all, you can't parse int 4,720,403. You could parse int 4720403 instead.

    Try to open the history interface before running the script. If it's still null then most likely that widget doesn't exist or it has no text.

    it opens history first, Why does game debugger show text? And I understand the parsing now I'll fix that :P

    4c2f3ae9c58069ca4402a035b8fe91e9.png

    Edited by Astrate
    Link to comment
    Share on other sites

    1 hour ago, Astrate said:

    it opens history first, Why does game debugger show text? And I understand the parsing now I'll fix that :P

    4c2f3ae9c58069ca4402a035b8fe91e9.png

    Since I don't know what's the exact code you're using try just to print the widget's text.

    log(getWidgets().getWidgetChild(383,3,5).getText());

    I feel like the issue is elsewhere.

    Link to comment
    Share on other sites

    1 hour ago, ozeki6 said:

    Since I don't know what's the exact code you're using try just to print the widget's text.

    log(getWidgets().getWidgetChild(383,3,5).getText());

    I feel like the issue is elsewhere.

    It's 

    String example = getWidgets().getWidgetChild(383, 3, 5).getText();

     

    Link to comment
    Share on other sites

    Erh I'm so confused, I just checked and well I was having a problem of removing a space from the string to put it into an int, 

    [INFO]08:28:27: ITEM: 1,366,481 coins

    so I was running into difficulties with this so I went onto tutorialspoint online editor to do more tests with it, Works great as it should have so I was quite confused, I copied and pasted the log into tutorialspoint and I see this

    c32bad5f68301b2ca4983e192b4dc63e.png.5379eb9a7f6e0fa8dc4692dfb51bce34.png

     :) Thank you to all that has responded by the way, You've been a tremendous amount of help :)

     

    Edit: fixed all this, Idk what that dot is to be honest but just copied and pasted it :P
    (Yes setting my sleep a little longer did fix my problem btw)

    Edited by Astrate
    Link to comment
    Share on other sites

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