SRL Archive - SRL Archives

Fixed GetChatBoxText !!


Naike

2008-12-23 18:44:29

Mine didnt work, i don't know if it was only happening for me but i took the time to sort it out.. ( All that was needed was 2 tolerance, on color 0?! Shouldnt be needed but fixed now anyways.)

function GetChatBoxText(Line, TextCol: Integer): string;
var
P: TPoint;
cArr: TPointArray;
B: TBox;
begin
P := TextCoords(Line);
if (FindColorsTolerance(cArr, TextCol, MCX1, P.y, MCX2, P.y + 13, 2)) then
begin
B := GetTPABounds(cArr);
Result := Trim(GetTextAtEx(B.x1 - 1, B.y1 - 2, 0, SmallChars, False, False,
0, 1, TextCol, 80, False, tr_AllChars));
end;
end;

Wizzup?

2008-12-24 05:44:38

Did anyone else have this error? Did this fix it for you?

Naum

2008-12-24 05:48:30

No, its working fine for me, It iputted the right text.

Maybe its a problem with your SCAR/SRL, N1ke??

Naike

2008-12-24 06:33:51

It fixed my problem..

Using Scar 3.15 with rev 30.

The problem was FindColorsSpiral not finding the black text.
But to save someone else the trouble which may have the same problem i
thought i post it.

tarajunky

2008-12-24 13:39:14

GetBlackChatMessage isn't working for me.

Naike

2008-12-25 06:10:00

tarajunky, then this is your fix as all finding text in chat functions are based on GetChatBoxText.

Enjoy ;)

tarajunky

2008-12-25 12:53:22

Yep, that fixed my problem.

EvilChicken!

2008-12-25 16:28:19

I don't really get it.
The text color is black, right? 0, clBlack, whatever, you name it.
Why do we need to add tolerance for it to work, could someone explain that to me?

Naike

2008-12-25 16:51:43

Ask Freddy1990 as FindColorsTolorance is his function..

Wizzup?

2008-12-25 19:36:59

Does Tolerance 1 work as well?

lordsaturn

2008-12-26 01:10:01

I think it doesn't only add tolerance to the color, but to the text finding as well. It would make sense to as why it would work with 2 tolerance rather than 0.

tarajunky

2008-12-26 02:05:11

Tolerance 1 also works for me. Tolerance 0 kills it.

n3ss3s

2008-12-26 09:56:16

I thought it was Wizzup or someone who told me 1 tol is sometimes required?

One of the mysteries only Freddy knows about once again…

EvilChicken!

2008-12-26 10:20:04

Then, thisisjustweird, why does it work with 0 tolerance for me?

I just took the time to test it >10 times, and it worked fine for me every time.
But, I doubt that having 1 tolerance extra will make any difference at all, if that's what needs to be done for it to work for most people.

One question though, when it says "You have items waiting in your Grand Exchange collection box!" in the RS chat box, why does the result of GetDebugLine come out as this:

You have items waiting in your Grand Exchange collection box! @@@@@@

Naum

2008-12-26 12:10:36

I think it takes the extra spaces at the end of the text and converts them into @'s. Thats happened before with me aswell :)

Naike

2008-12-26 15:00:43

I just took 2 tolerance as i wasnt sure 1 would do the job, all the time 100% ;)