SRL Archive - OSR Help

On Screen text HELP!


Hexless

2013-03-03 17:13:07

Okay so ive made this thieving bot but i need to know if theres a way to detect if something is said by a npc e.g 'Get your hands off there' so the script can stop thieving and kill the guard if anyone knows how to do that please tell me it would be greatly helpful
Thanks

Sjoe

2013-03-03 17:27:52

From: Hexless
Okay so ive made this thieving bot but i need to know if theres a way to detect if something is said by a npc e.g 'Get your hands off there' so the script can stop thieving and kill the guard if anyone knows how to do that please tell me it would be greatly helpful
Thanks


If it shows on the chat, u can use function GetBlackChatMessage: string;

Hexless

2013-03-03 17:29:52

From: Sjoekeloe
If it shows on the chat, u can use function GetBlackChatMessage: string;


Ahhhhhhh….. so if some like 'You cannot steal during combat' appears in the chatbox will that work?

Noob King

2013-03-03 17:30:28

Detecting the overhead text wouldn't work too well since you wouldn't be able to distinguish who the guard is talking too. If that is what you are asking about that is.

Hexless

2013-03-03 17:31:32

From: Noob King
Detecting the overhead text wouldn't work too well since you wouldn't be able to distinguish who the guard is talking too. If that is what you are asking about that is.

oh okay :\

Hexless

2013-03-03 17:32:32

From: Sjoekeloe
If it shows on the chat, u can use function GetBlackChatMessage: string;


also will this work with 07scape/oldscape?

Sjoe

2013-03-03 17:40:21

From: Hexless
also will this work with 07scape/oldscape?


Probably got to edit the coords?

Hexless

2013-03-03 17:45:00

From: Sjoekeloe
Probably got to edit the coords?

how do i do tht im new to this :\

Sjoe

2013-03-03 17:50:16

From: Hexless
how do i do tht im new to this :\


I think this is the base function. (I used function list to search)
So edit this: (I hope the fonts don't need changing )


function GetChatBoxText(Line, TextCol: Integer): string;
var
P: TPoint;
cArr: TPointArray;
B: TBox;
begin
Result := '';
P := TextCoords(Line);
if (FindColorsTolerance(cArr, TextCol, MCX1, P.y, MCX2, P.y + 13, 0)) then
begin
B := GetTPABounds(cArr);
result := Trim(GetTextAtExWrap(b.x1-1,p.y,B.x2+1,p.y+13,0,5,2,TextCol,0,SmallChars));
end;
end;

Or simply use GetTextAtExWrap() :)

Hexless

2013-03-03 18:02:59

From: Sjoekeloe
I think this is the base function. (I used function list to search)
So edit this: (I hope the fonts don't need changing )


function GetChatBoxText(Line, TextCol: Integer): string;
var
P: TPoint;
cArr: TPointArray;
B: TBox;
begin
Result := '';
P := TextCoords(Line);
if (FindColorsTolerance(cArr, TextCol, MCX1, P.y, MCX2, P.y + 13, 0)) then
begin
B := GetTPABounds(cArr);
result := Trim(GetTextAtExWrap(b.x1-1,p.y,B.x2+1,p.y+13,0,5,2,TextCol,0,SmallChars));
end;
end;

Or simply use GetTextAtExWrap() :)


Thank you! ill try it out tomorrow :)