Jump to content
bosshunts

Bitman text

Recommended Posts

This "simple" task is actually more complicated than it sounds. If the text is not one of the Windows standard font (most games are not) then you have to develop your own font set letter by letter. And if the color/size/shape of the text varies that complicates it further. A screenshot of what you are trying to do here would help a lot here.

Link to comment
Share on other sites

You can count colors to get a percentile of the HP, and Mana remaining.

The Area-boxes must be modified to the correct ingame coordinates, I just tested it on the image you supplied.

 

This is a normal technique used often in RS-botting for a bunch of things, including HP (at least in RS3).

 

function GetManaPercent(): Double;
var
 x: Int32;
 Area:TBox;
begin
 Area := Box(274,440,391,440); 
 x := CountColor(11141120, Area.x1,Area.y1,Area.x2,Area.y2);
 Result := x / (Area.x2-Area.x1+1) * 100;
end;


function GetHPPercent(): Double;
var
 x: Int32;
 Area:TBox;
begin
 Area := Box(274,417,391,417); 
 x := CountColor(170, Area.x1,Area.y1,Area.x2,Area.y2);
 Result := x / (Area.x2-Area.x1+1) * 100;
end;

begin
 WriteLn(GetHPPercent());
 WriteLn(GetManaPercent());
end.

This avoids you the "trouble" having to work with scars OCR-engine, tho might not be to hard, if all you need is the number-chars. Tho I do see a bit of smoothing-effects on the characters, so that might cause some trouble, but it does not seem to be to much.

Edited by slacky
Link to comment
Share on other sites

That would be the easiest. Stick with reading bars and forget about the text if you can. It won't give you your actual hp/mana unless your max is known in advance but far less work.

 

Edit: That was fun. Tried Zezina for all of 2 minutes. The tutorial has you climb down a set of steps to find some old guy standing there with no obvious way to interact and the tutorial doesn't tell you what to do next. Fiddled with it a bit then got bored and logged out. One more game I will never play lol.

Edited by Bixby Sayz
Link to comment
Share on other sites

I moved the coodinates the the right place and I got this

300
300
Successfully executed (49.3102 ms)

If it is a percent, why is it 300 and not 100?

 

You have moved the coords incorrectly then. As clearly shown in my example code both Y's should be the same position, meaning Y1, and Y2 = same. Else the output would be to large, this is obvious if you look at the simple math used to calc the percentile.

>> Area := Box(274,417,391,417);

>> Area := Box(274,440,391,440);

Edited by slacky
Link to comment
Share on other sites

I had everything working correctly yesterday. I used this script.

function GetManaPercent(): Double;
var
 x: Int32;
 Area:TBox;
begin
 Area := Box(184,274,301,274); 
 x := CountColor(11141120, Area.x1,Area.y1,Area.x2,Area.y2);
 Result := x / (Area.x2-Area.x1+1) * 100;
end;


function GetHPPercent(): Double;
var
 x: Int32;
 Area:TBox;
begin
 Area := Box(184,251,301,251); 
 x := CountColor(170, Area.x1,Area.y1,Area.x2,Area.y2);
 Result := x / (Area.x2-Area.x1+1) * 100;
end;

var
 Int: Integer;

begin
 Int :=0;
 repeat      
 if GetHPPercent() < 80 then
 ClickMouse(591, 52, mbLeft);
 if GetManaPercent() < 80 then
 ClickMouse(982, 422, mbRight);  
 Wait(900);   
   inc(Int);
 until Int = 9999;
end.

That was working fine. But then I tried to restart my Zezenia Client and it couldn't find the values of my HP/mana any more.

I tried to use this script again

function GetManaPercent(): Double;
var
 x: Int32;
 Area:TBox;
begin
 Area := Box(184,274,301,274); 
 x := CountColor(11141120, Area.x1,Area.y1,Area.x2,Area.y2);
 Result := x / (Area.x2-Area.x1+1) * 100;
end;


function GetHPPercent(): Double;
var
 x: Int32;
 Area:TBox;
begin
 Area := Box(184,251,301,251); 
 x := CountColor(170, Area.x1,Area.y1,Area.x2,Area.y2);
 Result := x / (Area.x2-Area.x1+1) * 100;
end;

begin
 WriteLn(GetHPPercent());
 WriteLn(GetManaPercent());
end.

I reset the coodinates to the correct place and I still get an error. It will not tell me the percentage. This is the outcome I get.

Successfully compiled (44.3464 ms)
0
0
Successfully executed (69.7709 ms)

Can anyone give me an explanation or a solution?

Link to comment
Share on other sites

I assume it's the colors that has been changed ingame, try adding quite a bit of tolerance:

function GetManaPercent(): Double;
var
 x: Int32;
 Area:TBox;
begin
 Area := Box(184,274,301,274); 
 x := CountColorTol(11141120, Area.x1,Area.y1,Area.x2,Area.y2,50);
 Result := x / (Area.x2-Area.x1+1) * 100;
end;


function GetHPPercent(): Double;
var
 x: Int32;
 Area:TBox;
begin
 Area := Box(184,251,301,251); 
 x := CountColorTol(170, Area.x1,Area.y1,Area.x2,Area.y2,50);
 Result := x / (Area.x2-Area.x1+1) * 100;
end;

begin
 WriteLn(GetHPPercent());
 WriteLn(GetManaPercent());
end.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...