KMJT Posted May 14, 2014 Share Posted May 14, 2014 (edited) This is the method I used to use with no problem but lately it does not seem to work anymore: private boolean isTextInOpenInterfaces(String message) { return searchInterfacesForText(message) != null && !searchInterfacesForText(message).isEmpty(); } It is returning false even when the String is clearly in the chat interface. It was working fine before for months. Edited May 14, 2014 by KMJT 1 Link to comment Share on other sites More sharing options...
TheScrub Posted May 14, 2014 Share Posted May 14, 2014 This is the method I used to use with no problem but lately it does not seem to work anymore: private boolean isTextInOpenInterfaces(String message) { return searchInterfacesForText(message) != null && !searchInterfacesForText(message).isEmpty(); } It is returning false even when the String is clearly in the chat interface. It was working fine before for months. i wrote my own search function works fine Link to comment Share on other sites More sharing options...
Apaec Posted May 14, 2014 Share Posted May 14, 2014 onMessage()? Link to comment Share on other sites More sharing options...
Dog_ Posted May 14, 2014 Share Posted May 14, 2014 (edited) use onMessage. searchInterfacesForText most likely doesn't search grandchildren (idk but chatbox messages might be grandchildren). Edited May 14, 2014 by Rawr Link to comment Share on other sites More sharing options...
Apaec Posted May 15, 2014 Share Posted May 15, 2014 public void onMessage(String message) throws InterruptedException { if (message.contains("sup")) { //do stuff } } ? override it for game messages Link to comment Share on other sites More sharing options...
Isolate Posted May 15, 2014 Share Posted May 15, 2014 public void onMessage(String message) throws InterruptedException { if (message.contains("sup")) { //do stuff } } ? override it for game messages i assumed this was just general messages in the chat box, didnt know it'd work for widgets?? Link to comment Share on other sites More sharing options...
Apaec Posted May 15, 2014 Share Posted May 15, 2014 i assumed this was just general messages in the chat box, didnt know it'd work for widgets?? Assumed we were talking about ingame here my bad Link to comment Share on other sites More sharing options...
KMJT Posted May 15, 2014 Author Share Posted May 15, 2014 Assumed we were talking about ingame here my bad Yeah I am talking about the npc chat interface, my bad probably should have made it more clear Link to comment Share on other sites More sharing options...
KMJT Posted May 16, 2014 Author Share Posted May 16, 2014 Looking for help still Link to comment Share on other sites More sharing options...
Extreme Scripts Posted May 16, 2014 Share Posted May 16, 2014 (edited) This is the method I used to use with no problem but lately it does not seem to work anymore: private boolean isTextInOpenInterfaces(String message){ return searchInterfacesForText(message) != null && !searchInterfacesForText(message).isEmpty();}It is returning false even when the String is clearly in the chat interface. It was working fine before for months. When you search for the string it's case sensitive and you have to include the punctuation, have you tried that? Edited May 16, 2014 by Divinity Link to comment Share on other sites More sharing options...
KMJT Posted May 17, 2014 Author Share Posted May 17, 2014 (edited) When you search for the string it's case sensitive and you have to include the punctuation, have you tried that? Yes, it is the exact case sensitivity and punctuation. I still don't see any way in the API to confirm that certain text is in the npc chat interface. I debugged the interfaces in game and even when I hover over the text sentence, it does not highlight, making me believe it isn't even hooked? Before I remember when I hovered over the sentences, they would highlight. For example, the first sentence is 0, 2nd is 1, and so on. This is how I used to confirm text in an interface. But now I can't even do that? No clue what to do. Edited May 17, 2014 by KMJT Link to comment Share on other sites More sharing options...
Dog_ Posted May 17, 2014 Share Posted May 17, 2014 Yes, it is the exact case sensitivity and punctuation. I still don't see any way in the API to confirm that certain text is in the npc chat interface. I debugged the interfaces in game and even when I hover over the text sentence, it does not highlight, making me believe it isn't even hooked? Before I remember when I hovered over the sentences, they would highlight. For example, the first sentence is 0, 2nd is 1, and so on. This is how I used to confirm text in an interface. But now I can't even do that? No clue what to do. http://osbot.org/osbot2_api/org/osbot/rs07/api/ui/RS2InterfaceChild.html#getMessage() Link to comment Share on other sites More sharing options...
Nezz Posted May 17, 2014 Share Posted May 17, 2014 getMessage(), searchInterfacesForText(String text), etc are all broken. You're correct when saying that the hook is broken. It's not broken on all situations, I know that much. Example: "Click here to continue" returns fine. You won't be able to check based on the text. You can try to find a specific interface parent/child to look for. Probably going to have to focus on the parent/child ID's of the "Click here to continue" If you're selecting a chat option, the interfaces should still be available for each one. If there are not options for specific chat actions, you can just use continueDialogue(), which will return true if the "Click here to continue" is available, false if it is not there. You can use isInDialogue(), but this only works in the dialogues where the NPC is saying something to you, I believe. If you can tell me one thing, I may be able to suggest a course of action.Are there any conversation instances where you select an option of chat?Example:NPC says "Can you take the quest?" >click "Click here to continue" >4 options come up "That's much too scary for me!""I can take the quest." "Your face is ugly." "Thanks!" If any of these situations happen, let me know so I can more accurately give advice. ^.^ Link to comment Share on other sites More sharing options...
KMJT Posted May 17, 2014 Author Share Posted May 17, 2014 getMessage(), searchInterfacesForText(String text), etc are all broken. You're correct when saying that the hook is broken. It's not broken on all situations, I know that much. Example: "Click here to continue" returns fine. You won't be able to check based on the text. You can try to find a specific interface parent/child to look for. Probably going to have to focus on the parent/child ID's of the "Click here to continue" If you're selecting a chat option, the interfaces should still be available for each one. If there are not options for specific chat actions, you can just use continueDialogue(), which will return true if the "Click here to continue" is available, false if it is not there. You can use isInDialogue(), but this only works in the dialogues where the NPC is saying something to you, I believe. If you can tell me one thing, I may be able to suggest a course of action. Are there any conversation instances where you select an option of chat? Example: NPC says "Can you take the quest?" >click "Click here to continue" >4 options come up "That's much too scary for me!" "I can take the quest." "Your face is ugly." "Thanks!" If any of these situations happen, let me know so I can more accurately give advice. ^.^ Yes, there are times during the chat where I need to choose from a number of options (for example, 4 different choices). It is not all just a "click here to continue" chat. Cheers. Link to comment Share on other sites More sharing options...
Nezz Posted May 17, 2014 Share Posted May 17, 2014 Yes, there are times during the chat where I need to choose from a number of options (for example, 4 different choices). It is not all just a "click here to continue" chat. Cheers. Get the interfaces of those, put them into a 2d int array, int[][] interfaces = new int[][]{{123,4},{123,5}}; Make a method that is set up something like public void goThroughChat(int[][] interfaces){ for(int[] interface : interfaces){ if(client.getInterface(interface[0]) != null && client.getInterface(interface[0]).getChild(interface[1]) != null) interact with that interface; else{ if(isInDialogue()) continueDialogue(); else start conversation } } If that makes any sense. So if the option is available, do it. Otherwise, check if you're in a dialogue. If you're not in a dialogue, start the dialogue. Do you need me to explain anything else? 1 Link to comment Share on other sites More sharing options...