Results 1 to 5 of 5

Thread: [Help] If Stat > 20 Then

  1. #1
    Join Date
    Dec 2006
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default [Help] If Stat > 20 Then

    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!

  2. #2
    Join Date
    Mar 2006
    Posts
    67
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    {*******************************************************************************
    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;

    Code:
    {*******************************************************************************
    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

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

  3. #3
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    except change the := to >

    check out set lowest in fakawis goblin killer

  4. #4
    Join Date
    Dec 2006
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks

  5. #5
    Join Date
    Apr 2006
    Posts
    710
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by krunkjuice View Post
    Code:
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •