SRL Archive - OSR Help

TPA is found but ATPA isn't


rj

2013-09-04 18:14:52

So my code:
{$I SRL/SRL.Simba}
{$i SRL/srl/misc/debug.simba}
var
Bmp: integer;

function v_get_tile:string;
var
xTPA, yTPA: tpointarray;
xATPA, yATPA: t2dpointarray;
txtstring:string;
begin
FindColorsTolerance(xTPA, 65535, 440, 13, 469, 27, 0);
FindColorsTolerance(yTPA, 65535, 480, 13, 513, 25, 0);
xATPA := splitTPAEx(xTPA, 1, 10);
yATPA := splitTPAEx(yTPA, 1, 10);
sortATPAFromFirstPointX(xATPA, point(0, 0));
sortATPAFromFirstPointX(yATPA, point(0, 0));
// result is string until I figure this out..
result:= getTextATPA(xATPA, 5, 'v_numbs') + getTextATPA(yATPA, 5, 'v_numbs');
// DebugTPA(xTPA, 'bmp');
DebugATPA(xATPA, 'bmp');
end;
begin
ActivateClient;
wait(1000);
Writeln(v_get_tile);
end.

finds the TPA correctly:


But.. the ATPA is wrong:


therfor I get annoying results like 
I don't understand what the problem is.

GREEN GIANT

2013-09-04 19:15:42

From: Officer Barbrady
So my code:
{$I SRL/SRL.Simba}
{$i SRL/srl/misc/debug.simba}
var
Bmp: integer;

function v_get_tile:string;
var
xTPA, yTPA: tpointarray;
xATPA, yATPA: t2dpointarray;
txtstring:string;
begin
FindColorsTolerance(xTPA, 65535, 440, 13, 469, 27, 0);
FindColorsTolerance(yTPA, 65535, 480, 13, 513, 25, 0);
xATPA := splitTPAEx(xTPA, 1, 10);
yATPA := splitTPAEx(yTPA, 1, 10);
sortATPAFromFirstPointX(xATPA, point(0, 0));
sortATPAFromFirstPointX(yATPA, point(0, 0));
// result is string until I figure this out..
result:= getTextATPA(xATPA, 5, 'v_numbs') + getTextATPA(yATPA, 5, 'v_numbs');
// DebugTPA(xTPA, 'bmp');
DebugATPA(xATPA, 'bmp');
end;
begin
ActivateClient;
wait(1000);
Writeln(v_get_tile);
end.

finds the TPA correctly:


But.. the ATPA is wrong:


therfor I get annoying results like
I don't understand what the problem is.


Shouldn't the result be an integer? Maybe try changing the output to an integer and try something like;

s:= getTextATPA(xATPA, 5, 'v_numbs') + getTextATPA(yATPA, 5, 'v_numbs');
Result:= StrToInt(s)

rj

2013-09-04 19:37:12

Edit, here is the new code, can someone verify if I am doing the fonts correctly?

{$I SRL/SRL.Simba}
{$i SRL/srl/misc/debug.simba}
var
Bmp: integer;

function v_get_tile:string;
var
xTPA, yTPA: tpointarray;
xATPA, yATPA: t2dpointarray;
txtstring:string;
i:Integer;
begin
FindColorsTolerance(xTPA, 65535, 440, 13, 469, 27, 0);
FindColorsTolerance(yTPA, 65535, 482, 13, 513, 25, 0);
//result := GetTextAtExWrap(440, 13, 469, 27, 0, 2, 1, 65535, 50, 'v_numbs');
xATPA := splitTPAEx(xTPA, 1, 10);
yATPA := splitTPAEx(yTPA, 1, 10);
DebugATPABounds(xATPA)
//Writeln(Length(xATPA));
sortATPAFromFirstPointX(xATPA, point(0, 0));
sortATPAFromFirstPointX(yATPA, point(0, 0));
result:= getTextATPA(xATPA, 5, 'v_numbs') + getTextATPA(yATPA, 5, 'v_numbs');
// DebugATPABounds(xATPA)
for i := 0 to high(xATPA) do
Writeln(Length(xATPA[i]));
end;
begin
ActivateClient;
// wait(1000);
Writeln(v_get_tile);
end.

rj

2013-09-09 05:47:35

A bit late.. but the problem was the fonts were saved as .png instead of .bmp