bosshunts Posted April 3, 2014 Share Posted April 3, 2014 Hello. I am trying a way to find the text of a bitman. I need the script to recognize when the numbers are lower than 'x' and press F11 when the numbers are lower than 'x' Can anyone help me out with this? Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted April 3, 2014 Share Posted April 3, 2014 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. Quote Link to comment Share on other sites More sharing options...
bosshunts Posted April 4, 2014 Author Share Posted April 4, 2014 I am trying to make an auto healer for this game. Zezenia. I figure if I can just get the values of the health and mana, then I could just do a less than function. Quote Link to comment Share on other sites More sharing options...
slacky Posted April 4, 2014 Share Posted April 4, 2014 (edited) 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 April 4, 2014 by slacky Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted April 4, 2014 Share Posted April 4, 2014 (edited) 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 April 4, 2014 by Bixby Sayz Quote Link to comment Share on other sites More sharing options...
bosshunts Posted April 4, 2014 Author Share Posted April 4, 2014 (edited) 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? Edited April 4, 2014 by bosshunts Quote Link to comment Share on other sites More sharing options...
slacky Posted April 5, 2014 Share Posted April 5, 2014 (edited) 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 April 5, 2014 by slacky Quote Link to comment Share on other sites More sharing options...
bosshunts Posted April 5, 2014 Author Share Posted April 5, 2014 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? Quote Link to comment Share on other sites More sharing options...
slacky Posted April 6, 2014 Share Posted April 6, 2014 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. Quote Link to comment Share on other sites More sharing options...
bosshunts Posted April 6, 2014 Author Share Posted April 6, 2014 I assume it's the colors that has been changed ingame, try adding quite a bit of tolerance: They did in fact change the colors ingame. I just found the new colors and substituted them for the old ones. Thank you. Quote Link to comment Share on other sites More sharing options...