Astrate 1 Share Posted January 4, 2019 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 More sharing options...
Nuclear Nezz 2055 Share Posted January 4, 2019 Are you checking the right widget for text? Link to comment Share on other sites More sharing options...
Astrate 1 Author Share Posted January 4, 2019 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 Link to comment Share on other sites More sharing options...
ozeki6 32 Share Posted January 5, 2019 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 More sharing options...
Astrate 1 Author Share Posted January 5, 2019 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 Link to comment Share on other sites More sharing options...
ozeki6 32 Share Posted January 5, 2019 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 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 More sharing options...
Astrate 1 Author Share Posted January 5, 2019 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 More sharing options...
Im A Baller 348 Share Posted January 5, 2019 1 hour ago, Astrate said: It's String example = getWidgets().getWidgetChild(383, 3, 5).getText(); Try to log the string and tell us what it outputs in the logger. Link to comment Share on other sites More sharing options...
Astrate 1 Author Share Posted January 5, 2019 It logs it just fine, I found my problem sleep() wasn't long enough ( I BELIEVE) I'm about to test it out Link to comment Share on other sites More sharing options...
Astrate 1 Author Share Posted January 5, 2019 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 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 (Yes setting my sleep a little longer did fix my problem btw) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.