Jump to content

How to check if a chat interface contains a message (String)?


KMJT

Recommended Posts

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 by KMJT
  • Like 1
Link to comment
Share on other sites

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

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 by Divinity
Link to comment
Share on other sites

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 by KMJT
Link to comment
Share on other sites

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

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

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

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?

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...