I'm not familiar with getting text off the screen, and I'm wondering how I would go about getting how many points I have in pest control?
Here is what I'm talking about...
Any help is greatly appreciated.
~iCURiP
I'm not familiar with getting text off the screen, and I'm wondering how I would go about getting how many points I have in pest control?
Here is what I'm talking about...
Any help is greatly appreciated.
~iCURiP
I suggest you to modificate existing function ,which reads hp/energy/prayer etc. ,because it's quite advanced. To do this go to Simba\Includes\SRL\srl\core\gametab.simba to function GetMMLevels. And add new option to case at line 755(if you use slr5) ,like this:
Simba Code:'pcpoints' : TP := Point(33,63);
Inside Point() you should put coords of upper-left corner point of text box.
Simba Code:function GetMMLevels(LevelType: string; var ColorSign: string): Integer;
var
Colors : TIntegerArray;
Signs: TStringArray;
P: TPointArray;
TP: TPoint;
I{,cl}: Integer;
B: TBox;
W,H{, T}: integer;
SearchBox : TBox;
begin;
Result := -1;
ColorSign := '';
case LowerCase(Leveltype) of
'health', 'hp', 'hitpoints', 'constitution': TP := Point(715,27);
'prayer', 'pray' : TP := Point(730,66);
'summon', 'summoning' : TP := Point(715,140);
'run','energy' : TP := Point(730,105);
'pcpoints' : TP := Point(33,63); // <--- here is line you added
else
begin;
srl_Warn('GetMMLevels', 'Invalid LevelType: ''' + LevelType + '', warn_AllVersions);
Exit;
end;
end;
Colors := [65280, 65535, 2070783, 255];
Signs := ['Green', 'Yellow', 'Orange', 'Red'];
GetClientDimensions(w,h); //We donnot want to search out of the clients area!
SearchBox := IntToBox(TP.X, TP.Y, Min(w-1,TP.X + 30), min(h-1,TP.Y + 15));
for I := 0 to 3 do
begin
With SearchBox do
FindColorsTolerance(P, Colors[i], x1, y1, x2, y2, 30);
if Length(P) < 1 then
Continue;
B := GetTPABounds(P);//GetTextAtEx works better for Simba for Run
Result := StrToIntDef(GetNumbers(GetTextAtEx(B.X1 - 1 , B.Y1 - 1, 30, statChars,
False, False, 0, 0, Colors[i], 20, False, tr_Digits)), -1);
if (Result > 0) then
begin
ColorSign := Signs[i];
Exit;
end;
end;
end;
Now in your script you can do it like this:
Simba Code:program example;
{$DEFINE SRL5}
{$DEFINE SMART}
//{$I SRL/SRL.scar}
{$I SRL/srl.simba}
function GetPCPoints: Integer;
var
ColorString: string;
begin
Result := Round(GetMMLevels('pcpoints', ColorString))
end;
begin
writeln(inttostr(GetPCPoints));
end.
For me it works
Code:Compiled successfully in 780 ms. 57 Successfully executed.
There are currently 1 users browsing this thread. (0 members and 1 guests)