PDA

View Full Version : Find text in chat window... How do I do this?



solarwind
10-20-2006, 07:52 PM
Hi all, I am a new member so please help me!

I know a little scar, I have successfully made a gnome agility training script. However, my script still needs antirandoms, antibans (easy to put in, i can do it later). Hower, my script tends to misclick about 20% of the time, for example, I know how to get and check the text at the upper left corner of teh rs screen and check for items and their options. However, sometimes, it tends tomisclick due to lag and stuff, so it messes up, thinking that it successfully clicked the item.

But I know a way to fix that. For example, when you walk across the log, it says in the chat window: You walk across the slippery log... or something like that.

If I can find a way to get that text and confirm that that text was said, (which means a successful click), then I can fix my script.

-------------------------------------------------------------------------------

My question is: How do I get and read text in the chat window (not player typed text), just normal text?

-------------------------------------------------------------------------------

Please help me. If I can find out how to do this, my script will be foolproff (it even has human text and mouse functions)!.


If I can find a way to do this, I promise to give back to the community.

Thanks in advance!!

I Pick Axes
10-20-2006, 09:26 PM
InChat and InChatMulti are functions that return booleans, true if they found your phrase.
InChat takes one string and InChatMulti takes three. They return true if the entire string is found anywhere on the most recent status/chat line.

For your example, use something like

repeat
WalkAcrossLog;
until (InChatMulti('cros', 'log', lipp'));

You should run that check with your choice of three (relatively unique) slices of the chat text.

EDIT: To clarify. These are functions that return a True/False value, and so you use them with conditionals like ifs or the checks in a loop structure. You don't need to look for the entire message, but the message must contain your entire string.

EDIT further: InChatMulti is true if any one of the three is found.

solarwind
10-20-2006, 09:57 PM
Omg! Thanks soo much! I've also found a function called: FindChatText

That searches for the text anywhere in the chat window, I'll use either one where appropriate.

Also, what if I want to find _player typed_ chat strings... For example, anti ban functions...

For example, If someone types in "agility lvls?", I'll search for the keyword "agility" and "lvls" and make an auto response.

Also, how do I find player typed strings that are _not_ in the chat window, but the main playing window. (I might need to do this if the chat window gets too crowded to get the messeges from doing obstacles).

One last thing... After this is done (probably in two or three days at the max), where could I post my script (so that everyone can use it)?
My script is wicked, lol, people actually respond to my stuff and I babble some more stuff (automatically).

I Pick Axes
10-20-2006, 10:57 PM
I think you use FindChat for that.

solarwind
10-21-2006, 12:22 AM
Hey, thanks a lot for the answers, however, I have one more question.

When I use InChat, it prints out the last line of text in the chat (lilke it's supposed to). However, it misses some characters almost all the time.

For example, I examined a manole and it said this in my rs chat:
"There's a cover over this manhole."

When I used InChat, this is what it printed out:
"t re's a cover over this manhole."

So, it missed some characters. Any thoughts on how I can fix this?

Thanks in advance!