KeepBotting
03-21-2013, 10:57 PM
function RS07_GetStat(stat:string; bottom:integer):integer;
Returns the value of the stat specified by string stat and integer bottom.
Skill strings:
attack
strength
defense
ranged
prayer
magic
runecrafting
hitpoints
agility
herblore
thieving
crafting
fletching
mining
smithing
fishing
cooking
firemaking
woodcutting
function RS07_GetStat(stat:string; bottom:integer):integer;
var x, y, ox, oy, ox2, oy2, col, row, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9:integer;
begin
s0 := BitmapFromString(5, 8,
'000000FFFFFFFFFFFFFFFFFF000000FFFFFF0000000000000 00000' +
'FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF0000000 00000' +
'000000FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF0 00000' +
'000000000000FFFFFFFFFFFF000000000000000000FFFFFF0 00000' +
'FFFFFFFFFFFFFFFFFF000000');
s1 := BitmapFromString(3, 8,
'000000FFFFFF000000FFFFFFFFFFFF000000000000FFFFFF0 00000' +
'000000FFFFFF000000000000FFFFFF000000000000FFFFFF0 00000' +
'000000FFFFFF000000FFFFFFFFFFFFFFFFFF');
s2 := BitmapFromString(5, 8,
'000000FFFFFFFFFFFFFFFFFF000000FFFFFF0000000000000 00000' +
'FFFFFF000000000000000000000000FFFFFF0000000000000 00000' +
'FFFFFF000000000000000000FFFFFF000000000000000000F FFFFF' +
'000000000000000000FFFFFF000000000000000000000000F FFFFF' +
'FFFFFFFFFFFFFFFFFFFFFFFF');
s3 := BitmapFromString(4, 8,
'000000FFFFFFFFFFFF000000FFFFFF000000000000FFFFFF0 00000' +
'000000000000FFFFFF000000FFFFFFFFFFFF0000000000000 00000' +
'000000FFFFFF000000000000000000FFFFFFFFFFFF0000000 00000' +
'FFFFFF000000FFFFFFFFFFFF000000');
s4 := BitmapFromString(4, 8,
'FFFFFF000000000000000000FFFFFF000000000000000000F FFFFF' +
'000000000000000000FFFFFF000000FFFFFF000000FFFFFF0 00000' +
'FFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000F FFFFF' +
'000000000000000000FFFFFF000000');
s5 := BitmapFromString(4, 8,
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000F FFFFF' +
'000000000000000000FFFFFFFFFFFFFFFFFF0000000000000 00000' +
'000000FFFFFF000000000000000000FFFFFFFFFFFF0000000 00000' +
'FFFFFF000000FFFFFFFFFFFF000000');
s6 := BitmapFromString(5, 8,
'000000000000FFFFFFFFFFFF000000000000FFFFFF0000000 00000' +
'FFFFFFFFFFFF000000000000000000000000FFFFFF000000F FFFFF' +
'FFFFFF000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF0 00000' +
'000000000000FFFFFFFFFFFF000000000000000000FFFFFF0 00000' +
'FFFFFFFFFFFFFFFFFF000000');
s7 := BitmapFromString(4, 8,
'FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000FFFFFF0 00000' +
'000000FFFFFF000000000000000000FFFFFF000000000000F FFFFF' +
'000000000000000000FFFFFF000000000000FFFFFF0000000 00000' +
'000000FFFFFF000000000000000000');
s8 := BitmapFromString(5, 8,
'000000FFFFFFFFFFFFFFFFFF000000FFFFFF0000000000000 00000' +
'FFFFFFFFFFFF000000000000000000FFFFFF000000FFFFFFF FFFFF' +
'FFFFFF000000FFFFFF000000000000000000FFFFFFFFFFFF0 00000' +
'000000000000FFFFFFFFFFFF000000000000000000FFFFFF0 00000' +
'FFFFFFFFFFFFFFFFFF000000');
s9 := BitmapFromString(5, 8,
'000000FFFFFFFFFFFFFFFFFF000000FFFFFF0000000000000 00000' +
'FFFFFFFFFFFF000000000000000000FFFFFF000000FFFFFF0 00000' +
'000000FFFFFF000000000000FFFFFFFFFFFFFFFFFF0000000 00000' +
'000000000000FFFFFF000000000000000000000000FFFFFF0 00000' +
'000000000000000000FFFFFF');
if (not(GetColor(592, 175) = 2763390)) then
begin
Mouse(577, 178, 10, 10, True);
end;
if (stat = 'attack') or (stat = 'strength') or (stat = 'defense') or (stat = 'ranged') or (stat = 'prayer') or (stat = 'magic') or (stat = 'runecrafting') then
col := 1;
if (stat = 'hitpoints') or (stat = 'agility') or (stat = 'herblore') or (stat = 'thieving') or (stat = 'crafting') or (stat = 'fletching') then
col := 2;
if (stat = 'mining') or (stat = 'smithing') or (stat = 'fishing') or (stat = 'cooking') or (stat = 'firemaking') or (stat = 'woodcutting') then
col := 3;
if (stat = 'attack') or (stat = 'hitpoints') or (stat = 'mining') then
row := 1;
if (stat = 'strength') or ( stat = 'agility') or (stat = 'smithing') then
row := 2;
if (stat = 'defense') or (stat = 'herblore') or (stat = 'fishing')then
row := 3;
if (stat = 'ranged') or (stat = 'thieving') or (stat = 'cooking') then
row := 4;
if (stat = 'prayer') or (stat = 'crafting') or (stat = 'firemaking') then
row := 5;
if (stat = 'magic') or (stat = 'fletching') or (stat = 'woodcutting') then
row := 6;
if (stat = 'runecrafting') then
row := 7;
if (bottom = 0) then
begin
ox := 520 + (col*64);
oy := 179 + (row*31);
end;
if (bottom = 1) then
begin
ox := 532 + (col*64);
oy := 191 + (row*31);
end;
ox2 := ox + 9;
oy2 := oy + 9;
if (FindBitmapMaskTolerance(s1, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 10;
if (FindBitmapMaskTolerance(s2, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 20;
if (FindBitmapMaskTolerance(s3, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 30;
if (FindBitmapMaskTolerance(s4, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 40;
if (FindBitmapMaskTolerance(s5, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 50;
if (FindBitmapMaskTolerance(s6, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 60;
if (FindBitmapMaskTolerance(s7, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 70;
if (FindBitmapMaskTolerance(s8, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 80;
if (FindBitmapMaskTolerance(s9, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 90;
ox := ox + 6;
ox2 := ox + 9;
if (FindBitmapMaskTolerance(s0, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+0;
if (FindBitmapMaskTolerance(s1, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+1;
if (FindBitmapMaskTolerance(s2, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+2;
if (FindBitmapMaskTolerance(s3, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+3;
if (FindBitmapMaskTolerance(s4, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+4;
if (FindBitmapMaskTolerance(s5, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+5;
if (FindBitmapMaskTolerance(s6, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+6;
if (FindBitmapMaskTolerance(s7, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+7;
if (FindBitmapMaskTolerance(s8, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+8;
if (FindBitmapMaskTolerance(s9, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+9;
end;
Can be used like this:
function RS07_GetHitpoints:integer;
var HP1, HP2:integer;
begin
HP1 := (RS07_GetStat('hitpoints', 0));
HP2 := (RS07_GetStat('hitpoints', 1));
if (HP1 > 0) and (HP2 > 0) then
Result := round((HP1 / HP2) * 100);
end;
And then just call it:
if RS07_GetHitpoints < 80 then EatFood;
Returns the value of the stat specified by string stat and integer bottom.
Skill strings:
attack
strength
defense
ranged
prayer
magic
runecrafting
hitpoints
agility
herblore
thieving
crafting
fletching
mining
smithing
fishing
cooking
firemaking
woodcutting
function RS07_GetStat(stat:string; bottom:integer):integer;
var x, y, ox, oy, ox2, oy2, col, row, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9:integer;
begin
s0 := BitmapFromString(5, 8,
'000000FFFFFFFFFFFFFFFFFF000000FFFFFF0000000000000 00000' +
'FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF0000000 00000' +
'000000FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF0 00000' +
'000000000000FFFFFFFFFFFF000000000000000000FFFFFF0 00000' +
'FFFFFFFFFFFFFFFFFF000000');
s1 := BitmapFromString(3, 8,
'000000FFFFFF000000FFFFFFFFFFFF000000000000FFFFFF0 00000' +
'000000FFFFFF000000000000FFFFFF000000000000FFFFFF0 00000' +
'000000FFFFFF000000FFFFFFFFFFFFFFFFFF');
s2 := BitmapFromString(5, 8,
'000000FFFFFFFFFFFFFFFFFF000000FFFFFF0000000000000 00000' +
'FFFFFF000000000000000000000000FFFFFF0000000000000 00000' +
'FFFFFF000000000000000000FFFFFF000000000000000000F FFFFF' +
'000000000000000000FFFFFF000000000000000000000000F FFFFF' +
'FFFFFFFFFFFFFFFFFFFFFFFF');
s3 := BitmapFromString(4, 8,
'000000FFFFFFFFFFFF000000FFFFFF000000000000FFFFFF0 00000' +
'000000000000FFFFFF000000FFFFFFFFFFFF0000000000000 00000' +
'000000FFFFFF000000000000000000FFFFFFFFFFFF0000000 00000' +
'FFFFFF000000FFFFFFFFFFFF000000');
s4 := BitmapFromString(4, 8,
'FFFFFF000000000000000000FFFFFF000000000000000000F FFFFF' +
'000000000000000000FFFFFF000000FFFFFF000000FFFFFF0 00000' +
'FFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000F FFFFF' +
'000000000000000000FFFFFF000000');
s5 := BitmapFromString(4, 8,
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000F FFFFF' +
'000000000000000000FFFFFFFFFFFFFFFFFF0000000000000 00000' +
'000000FFFFFF000000000000000000FFFFFFFFFFFF0000000 00000' +
'FFFFFF000000FFFFFFFFFFFF000000');
s6 := BitmapFromString(5, 8,
'000000000000FFFFFFFFFFFF000000000000FFFFFF0000000 00000' +
'FFFFFFFFFFFF000000000000000000000000FFFFFF000000F FFFFF' +
'FFFFFF000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF0 00000' +
'000000000000FFFFFFFFFFFF000000000000000000FFFFFF0 00000' +
'FFFFFFFFFFFFFFFFFF000000');
s7 := BitmapFromString(4, 8,
'FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000FFFFFF0 00000' +
'000000FFFFFF000000000000000000FFFFFF000000000000F FFFFF' +
'000000000000000000FFFFFF000000000000FFFFFF0000000 00000' +
'000000FFFFFF000000000000000000');
s8 := BitmapFromString(5, 8,
'000000FFFFFFFFFFFFFFFFFF000000FFFFFF0000000000000 00000' +
'FFFFFFFFFFFF000000000000000000FFFFFF000000FFFFFFF FFFFF' +
'FFFFFF000000FFFFFF000000000000000000FFFFFFFFFFFF0 00000' +
'000000000000FFFFFFFFFFFF000000000000000000FFFFFF0 00000' +
'FFFFFFFFFFFFFFFFFF000000');
s9 := BitmapFromString(5, 8,
'000000FFFFFFFFFFFFFFFFFF000000FFFFFF0000000000000 00000' +
'FFFFFFFFFFFF000000000000000000FFFFFF000000FFFFFF0 00000' +
'000000FFFFFF000000000000FFFFFFFFFFFFFFFFFF0000000 00000' +
'000000000000FFFFFF000000000000000000000000FFFFFF0 00000' +
'000000000000000000FFFFFF');
if (not(GetColor(592, 175) = 2763390)) then
begin
Mouse(577, 178, 10, 10, True);
end;
if (stat = 'attack') or (stat = 'strength') or (stat = 'defense') or (stat = 'ranged') or (stat = 'prayer') or (stat = 'magic') or (stat = 'runecrafting') then
col := 1;
if (stat = 'hitpoints') or (stat = 'agility') or (stat = 'herblore') or (stat = 'thieving') or (stat = 'crafting') or (stat = 'fletching') then
col := 2;
if (stat = 'mining') or (stat = 'smithing') or (stat = 'fishing') or (stat = 'cooking') or (stat = 'firemaking') or (stat = 'woodcutting') then
col := 3;
if (stat = 'attack') or (stat = 'hitpoints') or (stat = 'mining') then
row := 1;
if (stat = 'strength') or ( stat = 'agility') or (stat = 'smithing') then
row := 2;
if (stat = 'defense') or (stat = 'herblore') or (stat = 'fishing')then
row := 3;
if (stat = 'ranged') or (stat = 'thieving') or (stat = 'cooking') then
row := 4;
if (stat = 'prayer') or (stat = 'crafting') or (stat = 'firemaking') then
row := 5;
if (stat = 'magic') or (stat = 'fletching') or (stat = 'woodcutting') then
row := 6;
if (stat = 'runecrafting') then
row := 7;
if (bottom = 0) then
begin
ox := 520 + (col*64);
oy := 179 + (row*31);
end;
if (bottom = 1) then
begin
ox := 532 + (col*64);
oy := 191 + (row*31);
end;
ox2 := ox + 9;
oy2 := oy + 9;
if (FindBitmapMaskTolerance(s1, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 10;
if (FindBitmapMaskTolerance(s2, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 20;
if (FindBitmapMaskTolerance(s3, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 30;
if (FindBitmapMaskTolerance(s4, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 40;
if (FindBitmapMaskTolerance(s5, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 50;
if (FindBitmapMaskTolerance(s6, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 60;
if (FindBitmapMaskTolerance(s7, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 70;
if (FindBitmapMaskTolerance(s8, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 80;
if (FindBitmapMaskTolerance(s9, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := 90;
ox := ox + 6;
ox2 := ox + 9;
if (FindBitmapMaskTolerance(s0, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+0;
if (FindBitmapMaskTolerance(s1, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+1;
if (FindBitmapMaskTolerance(s2, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+2;
if (FindBitmapMaskTolerance(s3, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+3;
if (FindBitmapMaskTolerance(s4, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+4;
if (FindBitmapMaskTolerance(s5, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+5;
if (FindBitmapMaskTolerance(s6, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+6;
if (FindBitmapMaskTolerance(s7, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+7;
if (FindBitmapMaskTolerance(s8, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+8;
if (FindBitmapMaskTolerance(s9, x, y, ox, oy, ox2, oy2, 10, 240)) then
Result := Result+9;
end;
Can be used like this:
function RS07_GetHitpoints:integer;
var HP1, HP2:integer;
begin
HP1 := (RS07_GetStat('hitpoints', 0));
HP2 := (RS07_GetStat('hitpoints', 1));
if (HP1 > 0) and (HP2 > 0) then
Result := round((HP1 / HP2) * 100);
end;
And then just call it:
if RS07_GetHitpoints < 80 then EatFood;