PDA

View Full Version : [Help] If Stat > 20 Then



3volution
12-09-2006, 01:27 AM
How would i make a procedure that changes the fighting style once you reach a certain level?

Example: If attack is 40 then it switches fight mode to Strength

Thanks for your help!

krunkjuice
12-09-2006, 01:43 AM
{************************************************* ******************************
function GetSkillLevel(skill: String): Integer;
By: RsN
Description: Gets level of specified skill
************************************************** *****************************}
function GetSkillLevel(skill: String): Integer;
var
T: Tpoint;
TmpResult: string;
i: Integer;
begin
GameTab(2);
case lowercase(skill) of
'attack': T := SkillCoords(1, 1);
'hitpoints': T := SkillCoords(1, 2);
'mining': T := SkillCoords(1, 3);
'strength': T := SkillCoords(2, 1);
'agility': T := SkillCoords(2, 2);
'smithing': T := SkillCoords(2, 3);
'defence': T := SkillCoords(3, 1);
'herblore': T := SkillCoords(3, 2);
'fishing': T := SkillCoords(3, 3);
'ranged': T := SkillCoords(4, 1);
'thieving': T := SkillCoords(4, 2);
'cooking': T := SkillCoords(4, 3);
'prayer': T := SkillCoords(5, 1);
'crafting': T := SkillCoords(5, 2);
'firemaking': T := SkillCoords(5, 3);
'magic': T := SkillCoords(6, 1);
'fletching': T := SkillCoords(6, 2);
'woodcutting': T := SkillCoords(6, 3);
'runecrafting': T := SkillCoords(7, 1);
'slayer': T := SkillCoords(7, 2);
'farming': T := SkillCoords(7, 3);
end;
tmpResult := GetTextAtEx(T.x + 12, T.y + 12, 100, StatChars, False, True, 0, 5, -1, 2, True, tr_Digits);
if (Trim(tmpResult) = '') then
for i := 1 to 5 do
begin
tmpResult := GetTextAtEx(T.x + i + 12, T.y + 12, 100, StatChars, False, True, 0, 5, -1, 2, True, tr_Digits);
if (Trim(tmpResult) <> '') then
Exit;
end;
if (not (Trim(tmpResult) = '')) then
Result := StrToInt(Trim(GetTextAtEx(T.x + 12, T.y + 12, 100, StatChars, False, True, 0, 5, -1, 2, True, tr_Digits)));
end;



{************************************************* ******************************
procedure SetFightMode(oFightMode: Integer);
By: SRL Dev Team
Description: GameTab 1 Related Functions. Sets Fightmode.
************************************************** *****************************}
procedure SetFightMode(oFightMode: Integer);
begin
GameTab(1);
Wait(200 + Random(50));
if (oFightMode = 1) and (not (GetColor(612, 276) = 1908609)) then
Mouse(607, 271, 30, 10, True);
if (oFightMode = 2) and (not (GetColor(695, 278) = 1974408)) then
Mouse(690, 271, 30, 10, True);
if (oFightMode = 3) and (not (GetColor(610, 334) = 1908609)) then
Mouse(606, 325, 30, 10, True);
if (oFightMode = 4) and (not (GetColor(691, 331) = 1974408)) then
Mouse(690, 324, 30, 10, True);
end;

So maybe something like this


Procedure SwitchSkill;
begin
if(GetSkillLevel('attack')) := 40 then
SetFightMode(2);
end;

Boreas
12-09-2006, 03:58 AM
except change the := to >

check out set lowest in fakawis goblin killer

3volution
12-09-2006, 04:46 AM
Thanks :D

c0de
12-09-2006, 01:29 PM
Procedure SwitchSkill;
begin
if(GetSkillLevel('attack')) := 40 then
SetFightMode(2);
end;

The '':='' is used to assign something to a variable while ''='' is used to compare.