SRL Archive - OSR Help

Check For Level Up Hitpoints


S_rose94

2014-04-25 17:59:04

I have recently created a working combat bot, I have created a progress report that will display level ups by recording the initial level when the script starts and taking that away from the current level, this works for stats such as strength and attack, but for hitpoints, due to the fact that it is a combat script and it records the top number in the stats and not the bottom when i take damage I get minus numbers in levels gained, how do I fix this so that it will use the bottom stat number not the top? or any other way I can fix this thanks in advance.

rj

2014-04-25 19:14:10

[spoiler=hard way]I had a function that got all the stat levels

procedure tStatInfo.getSkills;
var
i, k, basex, basey, c:integer;
begin
self.setSkillNames();
openTab(TAB_STATS);
basex := 586;
basey := 300;
for i := 0 to 2 do
for k := 0 to 6 do
begin
try
self.skillLevel[c] := StrToInt(getSimpleText([65535], basex + (i * 54), basey + (k * 32), basex + 14 + (i * 54), basey + 11 + (k * 32), 'statchars07'));
except
self.skillLevel[c] := -1;
end;
c := c + 1;
end;
end;

the main point of concentration here is the formula:

self.skillLevel[c] := StrToInt(getSimpleText([65535], basex + (i * 54), basey + (k * 32), basex + 14 + (i * 54), basey + 11 + (k * 32), 'statchars07'));

x1 = basex + (i * 54)
x2 = basey + (k * 32)
y1 = basex + 14 + (i * 54)
y2 = basey + 11 + (k * 32)

base x and y are the top left coordinates of where the number starts, 54 is the x amount of pixels between each stat going left to right, 32 is the amount of pixels between each stat going up and down


So the formula would be:

function getStatBox(column, row:integer):Tbox;
begin
result := intToBox(586 + (column * 54), 586 + 14 + (column * 54), 300 + (row * 32), 300 + 11 + (row * 32)));
end;

This function gets the box in which the text is inside. What you have to edit is the number 586 and 300 to the lower number of the attack skill.


[/spoiler]


The easiest way to do this would be:

function getSimpleText(Color, tol:integer;x1, y1, x2, y2:integer;font:string):String;
var
textTPA:TPointArray;
textATPA:T2DPointArray;
begin
findColorsTolerance(textTPA, color, x1, y1, x2, y2, tol);
textATPA := SplitTPAEx(textTPA, 1, 10);
filtertpasbetween(textatpa, 0, 1);
SortATPAFromFirstPointX(textATPA, Point(0, 0));
result := getTextATPA(textATPA, 3, font);
end;

Use this function, and insert the x1, y1, x2, and y2 of the text

So it would look like

getSimpleText(textColor, tolerance, x1, y1, x2, y2, 'statchars07');