SRL Archive - RS3 Help

Finding text in chatbox function


Brotein

2014-02-10 14:56:37

I'm actually trying to write this script at work so I can't compile or test it but I'm a little lost with bit of code.

So trying to write a function that'll look for text in the chat box(for a bird nest). So my thought is use findTextOnLines() to search the chatbox for the message that says the bird nest fell. I will have my script check every time it checks for the player's animation(which is once a second), so it will detect the line of text as soon as it appears. This will be safe because it will click on the tree again right after, bumping the chat message up. So I need to find that line of text in the bottom of the chat box(most recent message).

So the function is
function TRSChatbox.findTextOnLines(txt: TStringArray; lines: TIntegerArray): boolean;
I can't find any documentation, but I was wondering what elements of the array correspond to lines of text in the chatbox. I just want the bottom most line of text. Sorry I'm at work so can't get a picture but here's it in text.

Our chatbox:
///////////////////////////////////////////////////////

Welcome to runscape!
Guy123: You a bot?
SUOMI: Yes…
A bird's nest has fallen!!!
///////////////////////////////////////////////////////

Would element 0 be the top line or the bottom line?

The Mayor

2014-02-10 15:02:21

From: Brotein
I'm actually trying to write this script at work so I can't compile or test it but I'm a little lost with bit of code.

So trying to write a function that'll look for text in the chat box(for a bird nest). So my thought is use findTextOnLines() to search the chatbox for the message that says the bird nest fell. I will have my script check every time it checks for the player's animation(which is once a second), so it will detect the line of text as soon as it appears. This will be safe because it will click on the tree again right after, bumping the chat message up. So I need to find that line of text in the bottom of the chat box(most recent message).

So the function is
function TRSChatbox.findTextOnLines(txt: TStringArray; lines: TIntegerArray): boolean;
I can't find any documentation, but I was wondering what elements of the array correspond to lines of text in the chatbox. I just want the bottom most line of text. Sorry I'm at work so can't get a picture but here's it in text.

Our chatbox:
///////////////////////////////////////////////////////

Welcome to runscape!
Guy123: You a bot?
SUOMI: Yes…
A bird's nest has fallen!!!
///////////////////////////////////////////////////////

Would element 0 be the top line or the bottom line?


Zero is the bottom most line (the one above where you type). Seeing as it is a TIntegerArray, you can search on more than 1 line, this will search on the bottom 2 lines:


linechatbox.findTextOnLines(['bird nest whatever'], [0..1]);