I'm still working on randoms yea :p gj, was trying to recompile smart for PS but I gave up
Printable View
Good job boys.
Ok so far I got program to do it I just got to transform into a function/procedure:
Simba Code:Program testP06;
{$I SRL/SRL.Simba}
{$I SRL/SRL/Misc/Debug.Simba}
{$I P06Include/P06Include.Simba}
Const
YourHealth = 10;
var
GreenP,RedP,MyHP:Integer;
Health,HealthPercent,AllP,HpPercentMissing,Missing_Health:Extended;
PercentHP:Extended;
Procedure ShowHealth;
Begin
if (RedP < 1) or (GreenP < 1) Then
Begin
Exit;
End;
AllP := (RedP + GreenP);
HpPercentMissing := (RedP/AllP);
Missing_Health := (MyHP*HpPercentMissing);
Health := ((MyHp) - (Missing_Health));
PercentHP := ((RedP/AllP)*100);
Writeln('I have about ' + ToStr(Health)+ ' HP left');
Writeln('Percent:' + ToStr(PercentHP));
End;
Procedure WriteColors;
Begin
Writeln('Green:' + IntToStr(GreenP));
Writeln('Red:' + IntToStr(RedP));
End;
Procedure CountColors;
Begin
GreenP := CountColorTolerance(65280,245,140,281,154,3);
RedP := CountColorTolerance(255,245,140,281,154,3);
End;
Begin
SetupP06Include;
ActivateClient;
Wait(500);
P06_MakeCompassNorth;
P06_MakeCameraAngleHigh;
MyHP := YourHealth;
CountColors;
WriteColors;
ShowHealth;
End.
Edit- Not making all those functions, they can be built in easily with the script, but feel free to add above one
There is now SPS for '06 Scape?
Awesome! :) Maybe if jagex does bring back 07' Scape, this could possibly be used? Or would the normal SPS be used?
I believe this sps would work, maybe with tiny modifications, don't worry, all the work I have done here, I will do for 07 scape aswell ;)
Depending on how different it is from a private server, I bet most of this code will work there aswell, I think the game UI and such are simular if not the same between 06-07
This would make scripting for the new-old runescape much easier. Thank you .
Scar and srl were around back in 07, theres a bunch of old SRL stuff out there in the records somewhere (SRL3 Coh3n or someone mentioned?) I'll have a look for that one day,
But when I started P06 Include, it was a learning experience, 07 scape will be a mission ;) I have a better understanding after this, and will be a hell of a lot faster this time round
I'm going to abandon my hp detection method and use textwrap for stats to get the current hp
Reading HP is so easy on on old RS. :D
Reading percent from HP bar is not 100% accurate but it works fine.Simba Code:program Test;
{$I SRL/SRL.simba}
{$I SRL/SRL/misc/Debug.simba}
procedure SetBoxToBounds(var Box : TBox; X1,Y1,X2,Y2 : Integer);
begin
if (Box.x1 < X1) then Box.x1 := X1;
if (Box.x2 > X2) then Box.x2 := X2;
if (Box.y1 < Y1) then Box.y1 := Y1;
if (Box.y2 > Y2) then Box.y2 := Y2;
end;
procedure DebugTPA_ATPA(TPA: TPointArray; ATPA: Array of TPointArray; First : Integer);
var
BMP, Col, x, y, i, width, height: Integer;
TPABox : TBox;
begin
GetClientDimensions(width,height);
BMP := BitmapFromClient(0,0,width-1,height-1);
DrawTPABitmap(BMP,TPA,ClWhite);
for i:=0 to High(ATPA) do
begin
if i = First then
Col := ClRed
else
Col := ClPurple;
TPABox := GetTPABounds(ATPA[i]);
SetBoxToBounds(TPABox,0,0,width-1,height-1);
for x := TPABox.x1 to TPABox.x2 do
begin
FastSetPixel(BMP,x,TPABox.y1,Col)
FastSetPixel(BMP,x,TPABox.y2,Col)
end;
for y := TPABox.y1 to TPABox.y2 do
begin
FastSetPixel(BMP,TPABox.x1,y,Col)
FastSetPixel(BMP,TPABox.x2,y,Col)
end;
end;
DebugBitmap(BMP);
FreeBitmap(BMP);
end;
function GetHpPercent : Integer;
var
CombinedTPA, GreenTPA, RedTPA : TPointArray;
CombinedATPA, GreenATPA, FinalATPA : Array of TPointArray;
X1,Y1,X2,Y2, i,j,k, BoxWidth : Integer;
ExcludeBoxes : Array of TBox;
TempBox : TBox;
BadTPA : Boolean;
begin
Result := -1;
X1 := 232;
Y1 := 139;
X2 := 287;
Y2 := 163;
FindColorsTolerance(GreenTPA,65280,X1,Y1,X2,Y2,0);
FindColorsTolerance(RedTPA,255,X1,Y1,X2,Y2,0);
CombinedTPA := CombineTPA(GreenTPA,RedTPA);
if (High(CombinedTPA) > 0) then
begin
SplitTPAWrap(CombinedTPA,1,CombinedATPA);
SetArrayLength(ExcludeBoxes,0);
j := 0;
for i:=0 to High(CombinedATPA) do
begin
TempBox := GetTPABounds(CombinedATPA[i]);
BoxWidth := TempBox.x2-TempBox.x1;
if not (BoxWidth = 29) then
begin
SetArrayLength(ExcludeBoxes,j+1);
ExcludeBoxes[j] := TempBox;
end;
end;
SplitTPAWrap(GreenTPA,1,GreenATPA);
SetArrayLength(FinalATPA,0);
k := 0;
for i:=0 to High(GreenATPA) do
begin
BadTPA := False;
for j:=0 to High(ExcludeBoxes) do
if PointInBox(MiddleTPA(GreenATPA[i]),ExcludeBoxes[j]) then
BadTPA := True;
if not BadTPA then
begin
SetArrayLength(FinalATPA,k+1);
FinalATPA[k] := GreenATPA[i];
end;
end;
SortATPAFrom(FinalATPA,Point(260,151));
DebugTPA_ATPA(GreenTPA,FinalATPA,-1);
if (Length(FinalATPA) < 1) then Exit;
TempBox := GetTPABounds(FinalATPA[0]);
BoxWidth := TempBox.x2-TempBox.x1;
Result := Round(BoxWidth*100/29);
end;
end;
var
HPLevel, HPPerc : integer;
begin
ClearDebug;
HPLevel := 11;
repeat
HPPerc := GetHPPercent;
if (HPPerc = -1) then
Writeln('HP: cant find HP bar.')
else
Writeln('HP: ' + IntToStr(Round(HPLevel*HPPerc/100)));
until False;
end.
It works only at highest camera angle.
Yea but what could you be doing that needs 100% accuracy, just eat when theres more than a 50% red bar on screen I guess ;)
Using the text wouldn't be accurate? :(
Ima just use text, I can see it now releasing auto fighter: "HALP THEE BOT EATS WHEN IT'S NOT SUPPOSED TOO!!"
What does this script actually do sir?
It's not a script, it makes it 100x easier to make scripts, basically a library
examples
http://i.imgur.com/nfghrS7.png
http://villavu.com/forum/showthread.php?t=44942
can't really talk atm, but,
Skype:
Quote:
DannyRS DannyRS