zanko360 1 Share Posted January 4, 2019 Greetings, I previously posted similar issue in script help forum. Now I know this is an error because I tested it with string.charAt(index). Problem is that method "getText()" of grandChild object is returning all spaces not in ASCII/UNICODE (32 decimal) space but actualy non-breaking space (160 decimal) UNICODE. I was having issues comparing 2 Exact same names one got from list of Friend objects with .getName() nethod which returns the space in the player's name with regular space (32 decimal) and second got from grandChild.getText() . I don't know if this is an issue with the method or the text is stored in client's widget like this but either way this makes comparing the 2 impossible and some mighty headaches debugging this. Would be great if someone could change this to return regular space (32 decimal encoding) so one could compare with other strings normally without banging head in wall for 5hours lol Link to comment Share on other sites More sharing options...
zanko360 1 Author Share Posted January 4, 2019 Also check this out https://github.com/jgm/peg-markdown/issues/16 Link to comment Share on other sites More sharing options...
Nuclear Nezz 2040 Share Posted January 6, 2019 We return what RS gives us, that's about it. I think we did some char replacing with character names somewhere, but I'm hesitant to do it in too many places. I'd prefer our getters to give you what RS gives you, not what we give you. Link to comment Share on other sites More sharing options...
zanko360 1 Author Share Posted January 6, 2019 Yes but see when someone tries to get friends from friend's list and tries to make a selection so comparing with some other list of REAL names of players with actual spaces it doesn't work. How can one possibly figure that its not a space and is a non-breaking space. Would be cool if you just added something like for(int j=0; j < string.length(); j++) { if((int)string.charAt(j) == 160) { char temp[] = string.toCharArray(); temp[j] = ' '; string = String.valueOf(temp); } } really only that code to save hours for many scripters not that hard and nobody needs non-breaking its just stupid Link to comment Share on other sites More sharing options...
zanko360 1 Author Share Posted January 6, 2019 I am saying all the person can see for space is... a blank space you can't differentiate between a space and non-breaking space by looking at the friends list or widgets its impossible. So any normal person would assume its just a "space" 32 Link to comment Share on other sites More sharing options...
Nuclear Nezz 2040 Share Posted January 6, 2019 There's an API for friends, I'm pretty sure if you use the api it already does swap the spaces. Link to comment Share on other sites More sharing options...
zanko360 1 Author Share Posted January 6, 2019 In my own example I had to message players that are in friendlist choosen from a list in script. So I needed a way to interact with friends. Yes you can get friends with "Friends.getFriends()" but I know of no way to send them pm without widgets interact("Message") and then doing " keyboard.type("The message", true); ". Could be wrong I but checked all the methods in a list I have in word and on the site api docs couldn't find a messageFriend method Link to comment Share on other sites More sharing options...
zanko360 1 Author Share Posted January 6, 2019 Probably is much easier for developers like to to make all non-breaking space from widgetChild.getText() to space 32 then adding method messageFriend. Then all problems dissapear. Just a wild guess there don't have any idea what programming client is like so no hate pls Link to comment Share on other sites More sharing options...
NovaGTX 106 Share Posted January 9, 2019 Is there a reason why you couldn't use a clan chat instead of friends? Edit* Or if you're trying to trigger something in another script do it locally. Just a few guesses I've taken from the very limited amount of information you've given about it. Link to comment Share on other sites More sharing options...
zanko360 1 Author Share Posted January 10, 2019 @NovaGTX No that is not what I tried to do. Say my script added players from surrounding got from getPlayers().all() . The result of this gets in a List<Player> . Then the names get through some filters and the script add the remaining to friendlist. The people that are online get messaged; The script iterates through the friendlist with widgets and checks if the name got from "WidgetChild.getText()" matches with the name got from "List<Player>.get(iterator).getName()"; with the .equals() or .contentEquals() methods of String class. Both of the results of .getText() and .getName() are String object. But comparing the names of the player from list and the same player from friendlist is only true if the player doesn't have a space in the name even if its the name of the same player lol. Because the space got from "WidgetChild.getText()" is not a "space 32" but a "non-breaking space 160". So I had to add another method to replace all the 160 with 32 Unicode, and THEN do "WidgetChild.interact("Message"); " Before I got to that point I debugged my code for HOURS because I didn't know from looking at the names that "looked" the same in game and console output, since there is no visual difference both just a blank space so I thought the problem was in my code(Made me go insane) but actually its just that "WidgetChild.getText()" returns non-breaking space for spaces in the players names in friendlist. No I can't use clanchat on a lvl 3 acc with a skilltotal bellow 150 and there is no use if I could since I needed my script to message players from friendlist. I think it should be better for WidgetChild.getText() to return normal space for the non-breaking space that the client gets from osrs. So it can be comparing with everything else, I see no use in getting non-breaking space?? Only complications. Or a method to message friends without widgets so you could do something like friends.getFriend().message() Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.