SRL Archive - OSR Help

How To Read Specific Text?


Mister Snow

2012-05-14 10:07:08

Part II:

After using your:


function GetPrice: string; //this is what reads the values
begin
Wait(500+random(50));
Result := GetTextAtExWrap(252, 286, 273, 298, 0, 5, 2, 39372, 5, StatChars);
end;


Could I also call this number later?

I tried to do so:


TypeSendEx(GetPrice); //hoping that this types the "low" value and hits enter


But it does not seem to work.











I am trying to read:



Can someone help me, or point me to a tutorial that discusses this?

Thank you

Justin

2012-05-14 10:51:35

What I tested with:

Simba Script:


program Text;
{$i SRL/srl.simba}

function GetPrice: string;
begin
Result := GetTextAtExWrap(146, 285, 351, 298, 0, 5, 2, 39372, 5, StatChars);
end;

begin
ClearDebug;
writeln(GetPrice);
end.

Result:

1'295
Successfully executed.

Hope that is what you are looking for.

Mister Snow

2012-05-14 11:30:02

From: [J]ustin
What I tested with:

Simba Script:


program Text;
{$i SRL/srl.simba}

function GetPrice: string;
begin
Result := GetTextAtExWrap(146, 285, 351, 298, 0, 5, 2, 39372, 5, StatChars);
end;

begin
ClearDebug;
writeln(GetPrice);
end.

Result:

1'295
Successfully executed.

Hope that is what you are looking for.



Awesome, thank you a bunch for your help.

Mister Snow

2012-05-14 16:02:21

Part II:

After using your:


function GetPrice: string; //this is what reads the values
begin
Wait(500+random(50));
Result := GetTextAtExWrap(252, 286, 273, 298, 0, 5, 2, 39372, 5, StatChars);
end;


Could I also call this number later?

I tried to do so:


TypeSendEx(GetPrice); //hoping that this types the "low" value and hits enter


But it does not seem to work. It will just sit there and not type anything. No errors are thrown or anything.

Brandon

2012-05-14 16:20:18


{$I SRL/SRL.Simba}

Function GetPriceBox(Box: TBox): Integer;
var
Text: String;
begin
Text:= GetTextAtExWrap(Box.X1, Box.Y1, Box.X2, Box.Y2, 0, 5, 2, 39372, 55, 'StatChars');
Result:= StrToIntDef(ExtractFromStr(Text, Numbers), 0);
end;

var
ItemPrice, TotalPrice: TBox;

begin
SetupSRL;

ItemPrice:= IntToBox(538, 267, 602, 278); //From the pictures you posted.. Obviously you need to change these values.
TotalPrice:= IntToBox(671, 417, 736, 429); //Same as above..

writeln(GetPriceBox(ItemPrice));
writeln(GetPriceBox(TotalPrice));

TypeSendEx(ToStr(GetPriceBox(ItemPrice), False);
end.

Mister Snow

2012-05-14 19:35:37

From: Brandon

{$I SRL/SRL.Simba}

Function GetPriceBox(Box: TBox): Integer;
var
Text: String;
begin
Text:= GetTextAtExWrap(Box.X1, Box.Y1, Box.X2, Box.Y2, 0, 5, 2, 39372, 55, 'StatChars');
Result:= StrToIntDef(ExtractFromStr(Text, Numbers), 0);
end;

var
ItemPrice, TotalPrice: TBox;

begin
SetupSRL;

ItemPrice:= IntToBox(538, 267, 602, 278); //From the pictures you posted.. Obviously you need to change these values.
TotalPrice:= IntToBox(671, 417, 736, 429); //Same as above..

writeln(GetPriceBox(ItemPrice));
writeln(GetPriceBox(TotalPrice));

TypeSendEx(ToStr(GetPriceBox(ItemPrice), False);
end.



hmm, closed the parenthesis and still am getting errors:
[Error] (24:50): Invalid number of parameters at line 23
Compiling failed.

Yago

2012-05-14 20:08:56

From: Mister Snow
hmm, closed the parenthesis and still am getting errors:
[Error] (24:50): Invalid number of parameters at line 23
Compiling failed.


the last line should be

TypeSendEx(ToStr(GetPriceBox(ItemPrice)), False);

Unless your missing a parameter there…