PDA

View Full Version : Some new HP getting stuff!!! Muhahaa! :D



Pentti
07-14-2007, 10:12 AM
Just made these today, and worked pretty good for me, takes about 100milliseconds to find hp bar + calcute the hp left. (No lag, no game tab) :D
Function HPBoxCanvas:TCanvas;
Function GetTopLeft(Canvas:TCanvas):TPoint;
Function GetBottomRight(Canvas:TCanvas):TPoint;
Function GetHPBarPoints:TBox;
Function HPLeft:Extended;



Please post comments!

Const ShowdaGoddamnDecimalsYesOrNoYouDecide=True;
Function HPBoxCanvas:TCanvas;
var
TempBmp:Integer;
begin
TempBmp:=BitMapFromString(0,0,'');
CopyClientToBitmap(TempBmp,240,145,285,173)
Result:=GetBitMapCanvas(TempBmp);
end;

Function GetTopLeft(Canvas:TCanvas):TPoint;
var
xx,yy:Integer;
begin
For xx:=0 to 45 do
For yy:=0 to 28 do
If(Canvas.Pixels[xx,yy]=65280)Then
begin
Result.X:=xx;
Result.Y:=yy;
Exit;
end;
end;

Function GetBottomRight(Canvas:TCanvas):TPoint;
var
xx,yy:Integer;
begin
For yy:=45 downto 0 do
For xx:=28 downto 0 do
If(Canvas.Pixels[xx,yy]=65280)or(Canvas.Pixels[xx,yy]=255)Then
begin
Result.X:=xx;
Result.Y:=yy;
Exit;
end;
end;

var
x,y:integer;
Function GetHPBarPoints:TBox;
var
TempBR,TempTL:TPoint;
DaBmpCanva:TCanvas;
begin
if(Not(FindColor(x,y,255,240,145,285,173)))then
Exit;
DaBmpCanva:=HPBoxCanvas;
TempTL:=GetTopLeft(DaBmpCanva);
TempBR:=GetBottomRight(DaBmpCanva);
if(TempTL.X+2<TempBR.X)then
begin
Result.X1:=TempTL.X;
Result.Y1:=TempTL.Y;
Result.X2:=TempBR.X;
Result.Y2:=TempBR.Y;
Writeln('X: ('+Inttostr(TempTL.X+240)+','+inttostr(TempBR.X+28 5)+')')
Writeln('Y: ('+Inttostr(TempTL.Y+145)+','+inttostr(TempBR.Y+17 3)+')')
Writeln('HP bar size (X*Y)='+inttostr( (TempBR.Y-TempTL.Y)*(TempBR.X-TempTL.X) )+' X('+inttostr(TempTL.X)+','+inttostr(TempBR.X)+') Y('+inttostr(TempTL.Y)+','+inttostr(TempBR.Y)+')')
end;
end;

Function HPLeft:Extended;
var
TempBR,TempTL:TPoint;
DaBmpCanva:TCanvas;
xx,yy:Integer;
HPBarLength:Integer;
begin
if(Not(FindColor(x,y,255,240,145,285,173)))then
Exit;
DaBmpCanva:=HPBoxCanvas;
TempTL:=GetTopLeft(DaBmpCanva);
TempBR:=GetBottomRight(DaBmpCanva);
HPBarLength:=TempBR.X - TempTL.X
yy:=TempTL.Y+3;
For xx:=TempBR.X downto TempTL.X do
If(DaBmpCanva.Pixels[xx,yy]=65280)Then
begin
Result:=((xx-TempTL.X) / HPBarLength)*100;
Exit;
end;
end;

var
Timer:integer;

begin
Repeat
ClearDebug;
Timer:=GetsystemTime;
GetHPBarPoints;
Writeln('HP bar points took: '+inttostr(GetsystemTime-Timer)+'ms')
wait(500)
Timer:=GetsystemTime;
if ShowdaGoddamnDecimalsYesOrNoYouDecide then
Writeln(FloatToStr(HPLeft)+'% HP left') else
Writeln(IntToStr(Round(HPLeft))+'% HP left')

Writeln('Hp left + points took: '+inttostr(GetsystemTime-Timer)+'ms')
wait(1000)
until(False)
end.

MasterKill
07-14-2007, 10:27 AM
how that look rly nice, and its fast. thats cool man :D

frist post ;)

Pentti
07-14-2007, 10:33 AM
how that look rly nice, and its fast. thats cool man :D

frist post ;)
Haha! Thanks dude. :D

Ilm1
07-14-2007, 10:50 AM
oo cool :D

Pentti
07-14-2007, 10:51 AM
oo cool :D
Hehe Kiitti. :D Ko tuo scripti on auki on kivempi taistella runes iha normaalistiki. :D

yanix
07-14-2007, 10:52 AM
yeah nice

Pentti
07-14-2007, 10:53 AM
yeah nice
thanks dude! :D

BobboHobbo
07-14-2007, 11:36 AM
Looks awesome and complicated.

Probly works good as i can see from other people.

Pentti
07-14-2007, 12:28 PM
Looks awesome and complicated.

Probly works good as i can see from other people.
Thanks!
Well, it has now always worked for me when have I tested it, hasnt failed yet. :D

n3ss3s
07-14-2007, 12:41 PM
Ja sitte ei ku pk :D

Pentti
07-14-2007, 12:42 PM
Ja sitte ei ku pk :D
Hehe. :D

teuneboon
07-14-2007, 01:36 PM
gs!(good script :P)

Pentti
07-14-2007, 01:37 PM
gs!(good script :P)
TItisnsf! (Thanks, I think it still needs some fixing!). :D

Santa_Clause
07-14-2007, 01:42 PM
Competing with Yoho eh? Seems good.

Pentti
07-14-2007, 01:44 PM
Competing with Yoho eh? Seems good.
Thanks and nah, not actually competing with him, I just wanted to make these and see how this would work. :D
I had the idea ready how to do this when I saw the topic where someone asked for function like this, so I had to try. :D

Santa_Clause
07-14-2007, 01:49 PM
Well I guess I'm not the only one. I was about to make it for my fighter when I found that you two did...no point trying now.

itSchRis917
07-14-2007, 07:29 PM
I like your constant name Pentti :D


ShowdaGoddamnDecimalsYesOrNoYouDecide;

WhiteShadow
07-14-2007, 11:17 PM
I was just about to make one using canvases.

Oh well, looks nice, but please, learn standards foo. :p :)

Pentti
07-15-2007, 08:17 AM
I like your constant name Pentti :D


ShowdaGoddamnDecimalsYesOrNoYouDecide;

Hehe. Well I had to name it as something. :D

I was just about to make one using canvases.

Oh well, looks nice, but please, learn standards foo. :p :)
Thanks!
Ye ye, sure you was. :D
Guess how many times people have been coming to tell me "Pentti your standards are all fucked up man"
And dude, I dont give a fuck about standards. :D
Hehe, I hate them. I do it my own way.