SRL Archive - SRL Suggestions

GetChatTextColorArray;


Press Play

2013-02-08 23:16:34

Among other things, I'm making a script, and I made this function for it. What do you guys think about this being added to SRL?

Basically, it returns a TIntegerArray; one integer(colour) for every line of text in the chat box. My test results and screenshot are an example of the output:

Yes, I'm a noob, I didn't free my bitmap.

It can be very useful and versatile in my opinion. Ofcourse, more colours can/will/should be added too :)

function GetChatTextColourArray: TIntegerArray;
var
i: Integer;
tmpTPA: TPointArray;
begin
SetLength(Result, 8);
for i := 0 to 7 do
begin
Result[i] := -1;

if FindColors(tmpTPA, clBlack, 7, (349 + (i * 14)), 497, (351 + (i * 14))) then
if FindColors(tmpTPA, clBlue, 7, (349 + (i * 14)), 497, (351 + (i * 14))) then
Result[i] := clBlue // Player chat
else
Result[i] := clBlack;

if FindColors(tmpTPA, clRed, 7, (349 + (i * 14)), 497, (351 + (i * 14))) then
Result[i] := clRed; // Unlocking new music, bird nest drop

if FindColors(tmpTPA, clYellow, 7, (349 + (i * 14)), 497, (351 + (i * 14))) then
Result[i] := clYellow; // Currently used when a demon appears somewhere

if FindColors(tmpTPA, 16776960, 7, (349 + (i * 14)), 497, (351 + (i * 14))) then
Result[i] := 16776960; // Cyan - GE buy/sell process completed

if FindColors(tmpTPA, 30446, 7, (349 + (i * 14)), 497, (351 + (i * 14))) then
Result[i] := 30446; // Orange - Daily Challenge (assignment + completion)
end;
end;

Le Jingle

2013-02-08 23:35:23

if you add more colors, wouldn't it be less code to make a local tia with all the colors, so then you have an inner loop to iterate through the chat colors?

I think if the include doesn't have this, it could come in handy for finding important chat texts (ex. there's an action/text that happens in red that you look out for)

Press Play

2013-02-08 23:40:13

From: Le Jingle
if you add more colors, wouldn't it be less code to make a local tia with all the colors, so then you have an inner loop to iterate through the chat colors?

Yes, I did think about this, but initially, I only had 2-3 colours in there. I would probably change it if I add it to the includes.

From: Le Jingle
I think if the include doesn't have this, it could come in handy for finding important chat texts (ex. there's an action/text that happens in red that you look out for)

Yes, that red action text is important for this like fire spirit thing (bonifres), nests (ivy/wc) and such. Also, for challenges, if anyone wants to make a script for that.