Results 1 to 12 of 12

Thread: Compilation of script errors?

  1. #1
    Join Date
    Jan 2009
    Posts
    74
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Compilation of script errors?

    This is my new learning thread, so I hope no one minds if I learn this way. I like to keep organized =P

    Line 46: [Error] (254:11): Unknown identifier 'CreateTPAFromBMP' in script C:\Program Files\SCAR 3.15\includes\SRL/SRL/Core/Math.scar
    This is popping up when I try to run an autofighter. I'm not sure about how to correct this one and what it means. I'm slowly learning the basics, but this lookings a little advanced to me.
    ~Will test any script and post feedback at your leisure~

  2. #2
    Join Date
    Jan 2009
    Posts
    74
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Autofighter Script

    SCAR Code:
    {------------------------------Script Info-------------------------------------|
    | ScriptName   = Fast Fighter                                                  |
    | Author       = Narcle                                                        |
    | Description  = Fights any monster, food eating and HP regen.                 |
    | Version      = 3.02                                                          |
    | Date         = 11/03/08                                                      |
    |______________________________________________________________________________|
    |----------------------Instructions, Credits & Help info-----=-----------------|
    |                                                                              |
    | Instructions:                                                                |
    |   Setup: 1. Select form or no form [In constants - true/false]               |
    |          2. Input SRL-stats ID & Password [In constants]                     |
    |          3. Get a HP count of monster for form.                              |
    |          4. Make sure you use the Color picker and select 3 colors           |
    |               from monster, and copy/paste them into notepad.                |
    |          5. Read the "Need to knows" below.                                  |
    |          6. Push play!                                                       |
    |                                                                              |
    |          Need to knows:                                                      |
    |          -In the player form; (default) is next to each option, meaning      |
    |             you can leave it blank if you want it to use default settings.   |
    |          -Options for "Skill to train" are > strength, attack, defence,      |
    |             even, pure, accurate, rapid or longrange <                       |
    |                                                                              |
    | Credits:                                                                     |
    |  -HyperSecret for posting his SecretFighter (v0.50) script                   |
    |  -Chitin & Cruel100 for Testing and Suggestions                              |
    |______________________________________________________________________________}

    {.include srl/srl.scar}
    {.include SRL/SRL/misc/Users.scar}
    {------------------------------------------------------------------------------}
    {===============================Player Setup===================================}
    {------------------------------------------------------------------------------}
    Const
      MySRLID       = '';//example: '9999'
      MySRLPassword = '';//example: 'password'

      UseForm     = true;//Use form? [true/false] False uses DeclarePlayers;

    {==============================================================================}
    {!!!!!       If UseForm = true; then DeclarePlayers does not APPLY!       !!!!!}
    {==============================================================================}
    procedure DeclarePlayers;
    begin
      if not(UseForm) then
      begin
        HowManyPlayers := 1;//Change this accordingly
        NumberOfPlayers(HowManyPlayers);
        CurrentPlayer := 0;
     
        Players[0].Name :=''; //Character Name
        Players[0].Pass :=''; //Character Pass
        Players[0].Nick :=''; //Nickname 3 - 4 Letter's of char name
        Players[0].Active := True; //True if you want this player to be ran in the script, false if not
        Players[0].Booleans[0] := false;//Eat food? true/false
        Players[0].Integers[0] := 0;//1st color of monster
        Players[0].Integers[1] := 0;//2nd color of monster
        Players[0].Integers[2] := 0;//3rd color of monster
        Players[0].Strings[0] := '';//monster name
        Players[0].Strings[1] := 'even'; //the skill you want to train > strength, attack, defence, pure, even, accurate, rapid or longrange <

      {
        Players[1].Name :='';
        Players[1].Pass :='';
        Players[1].Nick :='';
        Players[1].Active:=True;
        Players[1].Booleans[0] := false;//Eat food? true/false
        Players[1].Integers[0] := 0;//1st color of monster
        Players[1].Integers[1] := 0;//2nd color of monster
        Players[1].Integers[2] := 0;//3rd color of monster
        Players[1].Strings[0] := '';//monster name
        Players[1].Strings[1] := 'even'; //the skill you want to train
      }

      {
        Players[2].Name :='';
        Players[2].Pass :='';
        Players[2].Nick :='';
        Players[2].Active:=True;
        Players[2].Booleans[0] := false;//Eat food? true/false
        Players[2].Integers[0] := 0;//1st color of monster
        Players[2].Integers[1] := 0;//2nd color of monster
        Players[2].Integers[2] := 0;//3rd color of monster
        Players[2].Strings[0] := '';//monster name
        Players[2].Strings[1] := 'even'; //the skill you want to train
      }

      {
        Players[3].Name :='';
        Players[3].Pass :='';
        Players[3].Nick :='';
        Players[3].Active:=True;
        Players[3].Booleans[0] := false;//Eat food? true/false
        Players[3].Integers[0] := 0;//1st color of monster
        Players[3].Integers[1] := 0;//2nd color of monster
        Players[3].Integers[2] := 0;//3rd color of monster
        Players[3].Strings[0] := '';//monster name
        Players[3].Strings[1] := 'even'; //the skill you want to train
      }


    {------------------------------------------------------------------------------}
    {========================Don't edit below this!===============================}
    {------------------------------------------------------------------------------}
      Writeln('No-Form Setup');
      end else
      begin
        Writeln('Form Setup, "DeclarePlayers" does not apply.');
        SRLPlayerForm(True, ['Eat Food'], ['Color 1','Color 2','Color 3'], ['Monster Name (tac)', 'Skill to train (even)'], []);
      end;
    end;

    const
      Version = '3.02';
      ScriptName = 'Fast Fighter';
     
    Type
      FUsers = Record
        Melee, Range, Magic, Setup, OutOfFood: Boolean;
        Combat: array of array of string;
        SkillIs, MobName: string;
        Colors: array of integer;
      end;
     
    var
      NAF: array [0..99] of FUsers;
      TKilled, Txp, TFoodate, TArrowAmount, StartXP, ArrowStartAmount, AttackFailed: integer;//Counters
      RoundTimer, FailTimer, LogoutTime: integer;//Timers
     
    procedure LogoutSeq(reason:string); forward;

    procedure NarclesINI;
    begin
      SRLid:= MySRLId;
      SRLpassword:= MySRLPassword;
      if not (MySRLID = '') and not(MySRLPassword = '') then
      begin
        if (ReadINI('NarclesINI', 'SRLid', AppPath+'Chars.ini')='') then
        begin
          writeln('#@ Your SRL id & password for SRL-stats has been stored in Chars.ini');
          writeln('## To update this just put in new MySRLid & MySRLpassword and push play');
          writeln('## After this is done you won''t have to put it in again for newer versions');
        end;
        WriteINI('NarclesINI', 'SRLid', MySRLID, AppPath+'Chars.ini');
        WriteINI('NarclesINI', 'SRLpassword', MySRLPassword, AppPath+'Chars.ini');
      end;
      if not(ReadINI('NarclesINI', 'SRLid', AppPath+'Chars.ini')='') then
      begin
        SRLid := ReadINI('NarclesINI', 'SRLid', AppPath+'Chars.ini');
        SRLPassword := ReadINI('NarclesINI', 'SRLpassword', AppPath+'Chars.ini');
        writeln('#@ SRL id & password loaded from ini file.');
      end;
    end;

    function StrInArr(Str: string; StrArr: TStringArray): Boolean;
    var
      i, H, L: integer;
    begin
      L := Low(StrArr);
      H := High(StrArr);
      for i := L to H do
        if Pos(LowerCase(Str), LowerCase(StrArr[i])) > 0 then
        begin
          Result := true;
          Exit;
        end;
    end;

    Function FFWait(Time: Integer): Boolean;
    var
      T: Integer;
    begin
      if not(loggedin) then exit;
      for T := 1 to time do
      begin
        if FindNormalRandoms then
        begin
           FindInventoryRandoms;
           Result := true;
        end;
        if FindTalk then
         Result := True;
        Wait(200 + Random(50));
      end;
    end;

    function InFight: Boolean;
    var
      x, y : Integer;
    begin
      Result := (FindColor(x, y, 65280, 242, 142, 283, 158)
        or FindColor(x, y, 255, 242, 142, 283, 158));
    end;

    function FightOnScreen: Boolean;
    var
      x,y:integer;
      B:TBox;
    begin
      B:=IntToBox(240, 140, 285, 160);
      result := FindColorSkipBox(x, y, 65280, MSX1, MSY1, MSX2, MSY2, B) or
        FindColorSkipBox(x, y, 255, MSX1, MSY1, MSX2, MSY2, B);
    end;

    Function MobsOnScreen: integer;
    var
      i: integer;
      Mobs : TPointArray;
    begin
      FindColorsTolerance(Mobs, 195836, 598, 67, 656, 105, 0);
      if High(Mobs) > 0 then
      begin
        RAaSTPA(Mobs, 4);
        for i := 0 to High(Mobs) do
        If InAbstractBox(590, 60, 656, 60, 646, 102, 600, 102, Mobs[i].x, Mobs[i].y) then
        begin
          result := result + 1;
        end;
      end;
    end;

    procedure AntiBan;
    begin
      if not LoggedIn then Exit;
      case Random(58) of
        0: wait(500+random(3000));
        1: begin
             RandomMovement;
             SetAngle(true);
           end;
        2: HoverSkill(NAF[CurrentPlayer].SkillIs ,false);
        3: PickUpMouse;
      end;
    end;


    function GetArrowCount:integer;
    begin
      GameTab(5);
      result := GetAmount(666, 249);
    end;

    function MyEatFood:boolean;
    var
      i,x,y:integer;
    begin
      gametab(4);
      for i := 1 to 28 do
      if ExistsItem(i) then
      begin
        MMouseItem(i);
        GetMousePos(x, y);
        wait(150+random(50));
        if (pos('Eat', rs_GetUpText) > 0) then
        begin
          Mouse(x,y,0,0,false);
          wait(50+random(50));
          if ChooseOption('Eat') then
          begin
            wait(350+random(150));
            Result := true;
            Exit;
          end;
        end;
      end;
    end;

    procedure HpCheck;
    var
      c:Integer;
      RunDir: String;
    begin
      if (not LoggedIn) or (HPPercent > 50) then
        Exit;
      if (HPPercent < 50) then
      begin
        Status('HP low doing HP checks...');
        if (Players[CurrentPlayer].Booleans[0]) and not (NAF[CurrentPlayer].OutOfFood) then
        begin
          if not InvEmpty then
            for c := 0 to 2 do
            begin
              if MyEatFood then
                Inc(ReportVars[2]);
              if (not LoggedIn) or (HPPercent > 50) then
                Exit;
            end;
          NAF[CurrentPlayer].OutOfFood := true;
        end;
        if not (Players[CurrentPlayer].Booleans[0]) or (NAF[CurrentPlayer].OutOfFood) then
        begin
          if (HPPercent < 25) then
            if (InFight) then
            begin
              RunDir := 'nsew';
              Status('Running away HP% < 25...');
              RunAway(RunDir[random(4)+1], true, 1, 10000 + random(2000));
            end;
          repeat
            Status('HP is ' + inttostr(HPPercent) + '%');
            FFWait(4);
            case random(5) of
              0: BoredHuman;
              1: RandomMovement;
            end;
            MarkTime(FailTimer);
            if not LoggedIn or (GetSystemTime > LogoutTime) then
              Exit;
          until (HPPercent > 50);
          SetAngle(true);
        end;
      end;
    end;

    procedure WaitFight;
    Var
      T: integer;
    begin
      Status('Waiting for Fight...');
      if NAF[CurrentPlayer].Range then
        T := GetSystemTime - 12000
      else
        T := GetSystemTime;
      while not InFight and (TimeFromMark(T) < 6000) do wait(100);
      Status('Fighting...');
      repeat
        FFWait(1);
        HpCheck;
      until(not InFight) or (not FightOnScreen) or (not LoggedIn)
    end;

    procedure Report;
    Var
      AmmoPerHour, XPpH, CurXP, CurAU, CurAmmo, I,H,M,S:integer;
    begin
      if not(LoggedIn) then
        LoginPlayer;
      WaitFight;
      ConvertTime(GetTimeRunning, H, M, S);
      GetAllLevels;
      CurXP := GetXP(NAF[CurrentPlayer].SkillIs);
      if (CurXP > StartXP) then
        ReportVars[1] := CurXP-Startxp;
      ReportVars[0] := Round(ReportVars[0]*0.7);//Miss Click rate
      TKilled := TKilled + ReportVars[0];//Total Kills
      Txp := Txp + ReportVars[1];//Total XP
      TFoodate := TFoodate + ReportVars[2];//Total Food Ate
      if NAF[CurrentPlayer].Range then
      begin
        CurAmmo := GetArrowCount;
        if (ArrowStartAmount > CurAmmo) then
         CurAU := ArrowStartAmount - CurAmmo;
        TArrowAmount := TArrowAmount + CurAU;
        AmmoPerHour := Round( TArrowAmount / (H+M/60.0) );
      end;
      if (HowManyPlayers = 1) then
      begin
        XPpH := Round( Txp / (H+M/60.0) );//XP per Hour
        Cleardebug;
        Writeln('***************************************************');
        Writeln(Padr('| Fast Fighter v'+Version, 23) +' | '+ Padr(inttostr(H) + 'h:' + inttostr(M) + 'm:' + inttostr(S)+'s', 23)+ ' |');
        Writeln('***************************************************');
        WriteLn(Padr('| Total Kills: ' + inttostr(TKilled), 23)+' | '+ Padr('Total XP: ' + inttostr(Txp), 23) + ' |');
        WriteLn(Padr('| XP/hour: ' + inttostr(XPpH), 23)+' | '+ Padr('Food Ate: ' + inttostr(TFoodate), 23) + ' |');
        WriteLn(Padr('| Round Kills: ' + inttostr(ReportVars[0]), 23)+' | '+ Padr('Round XP : ' + inttostr(ReportVars[1]), 23) + ' |');
       If NAF[CurrentPlayer].Range then
       begin
        writeln(Padr('| Ammo Remain: '+inttostr(GetArrowCount), 23) +' | '+ Padr('Ammo used: ' +inttostr(TArrowAmount), 23)+' |')
        writeln(Padr('| Ammo Used/hour: '+inttostr(AmmoPerHour), 23)+' | '+Padr('', 23)+' |');
       end;
        Writeln('***************************************************');
      end;
      if (HowManyPlayers > 1) then
      begin
        Players[currentplayer].Integers[11] := Players[currentplayer].Integers[11] + ReportVars[1];//XP
        Players[currentplayer].Integers[12] := Players[currentplayer].Integers[12] + ReportVars[0];//Kills
        Players[currentplayer].Integers[13] := Players[currentplayer].Integers[13] + CurAU;
        Players[currentplayer].Integers[15] := Players[currentplayer].Integers[15] + ReportVars[2];//FoodAte
        Players[currentplayer].Integers[31] := Players[currentplayer].Integers[31] + TimeFromMark(RoundTimer);
        Players[currentplayer].Integers[32] := Round((Players[currentplayer].Integers[11]*3600.0)/(Players[currentplayer].Integers[31]/1000.0))
        ClearDebug;
        Writeln('****************************************************************************');
        Writeln('| - Multi - Player - Fast Fighter v'+Version+' by Narcle_| Run Time: '+
         +Padr( inttostr(H) + 'h:' + inttostr(M) + 'm:' + inttostr(S)+'s',12)+' |');
        Writeln('****************************************************************************');
        Writeln('|  # | Nick | Active | XP Gained | Kills  | XP/Hour | Food ate | Ammo Used |');
        Writeln('| -- | ALL  | Totals | '+Padr(IntToStr(Txp),9) + ' | ' + Padr(IntToStr(TKilled),6)
          + ' | ------- | ' + Padr('Ate: ' + IntToStr(TFoodate),8) + ' | ' + Padr(IntToStr(TArrowAmount),9) + ' |');
        For I := 0 to HowManyPlayers - 1 do
        begin
          Writeln('| '+Padl(IntToStr(I), 2)+' | '+Padr(Players[i].Nick, 4)+' | '+ Padr(BoolToStr(Players[i].Active), 6)  + ' | ' +
          + Padr(IntToStr(Players[i].Integers[11]),9) + ' | ' + Padr(IntToStr(Players[i].Integers[12]),6) + ' | ' +
          + Padr(IntToStr(Players[i].Integers[32]),7) + ' | '+ Padr('Ate: ' + IntToStr(Players[i].Integers[15]),8) + ' | ' +
          + Padr(IntToStr(Players[i].Integers[13]),9) + ' |');
        end;
        Writeln('****************************************************************************');
      end;
      SendSRLReport;
    end;

    procedure WeaponLookup(var WeaponArr: array of array of string);
    var
      x, y, i, ii, T: integer;
      Xarr, Yarr: array of integer;
      TB: TBox;
      TP: TPointArray;
    begin
      Xarr := [595, 680, 595, 680];
      Yarr := [270, 270, 325, 325];
      GameTab(1);
      SetArrayLength(WeaponArr, 4);
      for i := 0 to 3 do
      begin
        SetArrayLength(WeaponArr[i], 4);
        MMouse(Xarr[i], Yarr[i], 12, 12);
        T := GetSystemTime + 3000;
        repeat
          Wait(200);
          if GetSystemTime > T then
            Exit;
        until FindColor(x, y, 10551295, 540, 205, 750, 465);
        wait(200);
        GetClientDimensions(TB.X2, TB.Y2);
        TB := IntToBox(0, 0, TB.X2, TB.Y2);
        FindColorsTolerance(TP, 10551295, TB.X1, TB.Y1, TB.X2, TB.Y2, 0);
        if Length(TP) = 0 then
          Exit;
        TB := GetTPABounds(TP);
        TB.Y1 := TB.Y1 + 1;
        for ii := 0 to 3 do
        begin
          WeaponArr[i][ii] := LowerCase(GetTextAtEx(TB.X1 + 1, TB.Y1, 0, SmallChars, False, True, 0, 1, - 1, 30, False, tr_AlphaNumericChars));
          TB.Y1 := TB.Y1 + 13;
        end;
        if (GetLetters(WeaponArr[0][0]) = '') then
        begin
          Writeln('');
          Writeln('Weapon Lookup failed, SCAR lost window focus. [Restart SCAR for SMART]');
          Writeln('Re-focus SCAR to the RuneScape window using the cross-hairs.');
          Exit;
        end;
      end;
    end;

    function SetCombat(Kind: string): boolean;
    var
      i, ii: integer;
    begin
      try
        for i := 0 to 3 do
         for ii := 0 to 3 do
          if (Pos(Lowercase(Kind), Lowercase(NAF[CurrentPlayer].Combat[i][ii])) > 0) then
          begin
            Result := SetFightMode(i + 1);
            NAF[CurrentPlayer].SkillIs := kind;
            Exit;
          end;
      except
        Writeln('');
        Writeln('Set Combat failed, SCAR lost window focus. [Restart SCAR for SMART]');
        Writeln('Re-focus SCAR to the RuneScape window using the cross-hairs.');
      end;
    end;

    procedure SetupPlayer;
    Var
      Mode, i:integer;
    begin
      if not LoggedIn then
       Exit;
      Status('Setting up player: '+Players[CurrentPlayer].Name+'...');
      MouseSpeed := RandomRange(14, 16);
      SetAngle(true);
      GetAllLevels;
      if not NAF[CurrentPlayer].Setup then
      begin
        WeaponLookup(NAF[CurrentPlayer].Combat);
        for i := 0 to 3 do
        begin
          if StrInArr('ranged', NAF[CurrentPlayer].Combat[i]) then
            NAF[CurrentPlayer].Range := true;
          if StrInArr('magic', NAF[CurrentPlayer].Combat[i]) then
            NAF[CurrentPlayer].Magic := true;
        end;
        if not (NAF[CurrentPlayer].Magic or NAF[CurrentPlayer].Range) then
          NAF[CurrentPlayer].Melee := true;
      end;
      if NAF[CurrentPlayer].Melee then
      begin
        case LowerCase(Players[CurrentPlayer].Strings[1]) of
          'attack','att': Mode := 1;
          'strength','str': Mode := 2;
          'defence', 'defense','def': Mode := 3;
          'shared', 'controlled','control': Mode := 4;
          'even','',' ','  ','   ':
            begin
              if (Players[CurrentPlayer].level[3] <= Players[CurrentPlayer].level[1]) and (Players[CurrentPlayer].level[3] <= Players[CurrentPlayer].level[2]) then
                Mode := 3;
              if (Players[CurrentPlayer].level[1] <= Players[CurrentPlayer].level[3]) and (Players[CurrentPlayer].level[1] <= Players[CurrentPlayer].level[2]) then
                Mode := 1;
              if (Players[CurrentPlayer].level[2] <= Players[CurrentPlayer].level[1]) and (Players[CurrentPlayer].level[2] <= Players[CurrentPlayer].level[3]) then
                Mode := 2;
            end;
          'pure':
            begin
              if Players[CurrentPlayer].level[2] < 15 then
                Mode := 2
              else if Players[CurrentPlayer].level[1] < 30 then
                Mode := 1
              else if Players[CurrentPlayer].level[2] < 25 then
                Mode := 2
              else if Players[CurrentPlayer].level[1] < 40 then
                Mode := 1
              else
                Mode := 2;
            end;
           else
           begin
             writeln('Incorrect skill to train, check your setup and make sure its spelled correctly.');
             Mode := 0;
           end;
        end;
        case Mode of
          1:if not SetCombat('attack') then
              if not SetCombat('strength') then
                SetCombat('defence');
          2:if not SetCombat('strength') then
              if not SetCombat('attack') then
                SetCombat('defence');
          3:if not SetCombat('defence') then
              if not SetCombat('strength') then
                SetCombat('attack');
          4:if not SetCombat('shared') then
              if not SetCombat('strength') then
                if not SetCombat('attack') then
                  SetCombat('defence');
          else
          begin
            SetFightMode(1);
            NAF[CurrentPlayer].SkillIs := 'attack';
          end;
        end;
      end;
      if NAF[CurrentPlayer].Range then
      begin
        case LowerCase(Players[CurrentPlayer].Strings[1]) of
          'accurate': SetFightMode(1);
          'rapid': Setfightmode(2);
          'longrange': Setfightmode(3);
          'even': Setfightmode(2);
          else
          begin
            writeln('Incorrect skill to train, check your setup and make sure its spelled correctly');
            Setfightmode(2);
          end;
        end;
        NAF[CurrentPlayer].SkillIs := 'range';
        ArrowStartAmount := GetArrowCount;
        if (ArrowStartAmount <= 100) then
        begin
          LogoutSeq('Low ammo count! (below 100)');
          Exit;
        end;
      end;
      if NAF[CurrentPlayer].Magic then
      begin
        Writeln('Fast Fighter doesn''t support Magic.');
        LogoutSeq('No magic support');
        Exit;
      end;
      Retaliate(True);
      StartXP := GetXP(NAF[CurrentPlayer].SkillIs);
      SetRun(True);
      LogoutTime := Getsystemtime + RandomRange(7*60000, 13*60000);
      MarkTime(RoundTimer);
      MarkTime(FailTimer);
      AttackFailed := 0;
    end;

    procedure LogoutSeq(reason:string);
    begin
      if(not(loggedin))then exit;
      WaitFight;
      Status('Logout sequence...');
      Report;
      AntiBan;
      if (reason = '') then
       nextplayer(true)
      else
      begin
        Writeln(reason+' '+Players[Currentplayer].Name+' is now inactive.');
        nextplayer(false);
      end;
      SetupPlayer;
    end;

    procedure SitAndWait;//Super advance I know :P
    var
      T: integer;
    begin
      MarkTime(T);
      repeat
        Status('Sit & Wait...');
        if not LoggedIn then
         Exit;
        FFWait(2);
        AntiBan;
        HpCheck;
      until (TimeFromMark(T) > 30000) or (MobsOnScreen > 0)
    end;

    function ChangeCamera: boolean;
    var
      i, II, PosNeg:integer;
    begin
      Case random(2) of
        0: PosNeg := 1;
        1: PosNeg := -1;
      end;
      i := Round(rs_GetCompassAngleDegrees/45 - 1);
      if i < 0 then i := 0;
      if i > 7 then i := 7;
      For II := 0 to 7 do
      begin
        if (MobsOnScreen > 0) then
        begin
          result := true;
          exit;
        end;
        i := i+PosNeg;
        if i > 7 then i := 0;
        if i < 0 then i := 7;
        MakeCompass(inttostr(i*45));
      end;
    end;

    function UTWait(UpText: string): Boolean;//Yes idea from munk ;)
    var
      T: integer;
    begin
      T := GetSystemTime + 750;
      Repeat
        wait(25+random(25));
        Result := pos(LowerCase(UpText), LowerCase(rs_GetUpText)) > 0;
      until Result or (GetSystemTime > T);
    end;

    function FFAttack(Name: string; Colors: TintegerArray; tol: integer): boolean;
    var
      L, i, x, y, xx, yy: integer;
    begin
      if not LoggedIn then
       Exit;
      if InFight then
       if FightOnScreen then
        Exit;
      L := High(Colors);
      Status('Searching for NPC...');
      for i := 0 to L do
      begin
        if (MobsOnScreen = 0) or InFight then
         Exit;
        x:=MSCX;
        y:=MSCY;
        if FindColorSpiralTolerance(x, y, Colors[i], MSX1, MSY1, MSX2, MSY2, Tol) then
        begin
          if FindColorSpiral(xx, yy, 65280, x - 15, y - 40, x + 15, y + 40) then
           Continue;
          MMouse(x, y, 3, 3);
          if UTWait(Name) then
          begin
            GetMousePos(x, y);
            case Random(3) of
              0: begin
                   Mouse(x, y, 0, 0, false);
                   if ChooseOption('tack') then
                     result := true;
                 end;
              1,2: begin
                   HoldMouse(x, y, True);
                   Wait(80 + Random(60));
                   GetMousePos(x, y);
                   ReleaseMouse(x, y, True);
                   try
                     Result := FindColor(x, y, 255, x-10, y-10, x+10, y+10);
                   except
                     Result := False;
                   end;
                 end;
            end;
            if Result then
            begin
              Status('Attacked');
              AttackFailed := 0;
              MarkTime(FailTimer);
              FFlag(0);
              if NAF[CurrentPlayer].Range then
                FFWait(20)
              else
                FFWait(4);
              Inc(ReportVars[0]);
              Exit;
            end;
          end else
            Inc(AttackFailed);
        end;
      end;
    end;


    Procedure FFStartUp;
    var
      I,II,n:integer;
      s:string;
    begin
      SetupSRL;
      ClearDebug;
      Disguise('Sig Call');
      ChangeReportWidth(255);
      Status('Signature call; Watch the report box!');
      for I := 0 to 57 do
      begin
        clearreport;
        for II := 0 to 5 do
          Addtoreport(s + '||');
        wait(20);
        if I < 29 then
          s := s + ' '
        else
          delete(s, Length(s), 1);
      end;
      for I := 1 to 29 do
      begin
        ClearReport;
        AddtoReport(Left(' _   _                _      ', I));
        AddtoReport(Left('| \ | |  made by     | |     ', I));
        AddtoReport(Left('|  \| | __ _ _ __ ___| | ___ ', I));
        AddtoReport(Left('| . ` |/ _` | ''__/ __| |/ _ \', I));
        AddtoReport(Left('| |\  | (_| | | | (__| |  __/', I));
        AddtoReport(Left('|_| \_|\__,_|_|  \___|_|\___|', I));
        wait(40);
      end;
      AddtoReport(ScriptName+' v'+Version);
      NarclesINI;
      try
        DeclarePlayers;
      except
        Writeln('You did not Declare Players correctly, check your DeclarePlayers setup.');
        TerminateScript;
      end;
      ScriptID := '424';
      If (HowManyPlayers = 1) then Writeln('Single-Player Mode') else Writeln('Multi-Player mode; '+IntToStr(HowManyPlayers)+' Players');
      if (SRLID = '') or (SRLPassword = '') then
      begin
        Writeln('Please register at SRL-stats in the future');
        Writeln('to remove this message and the time delay.');
        Writeln('  -Regards Narcle');
        n := 15;
        repeat
          n := n-1;
          wait(999);
          Disguise(inttostr(n)+' Seconds to start.');
          Status(inttostr(n)+' Seconds to start.');
        until (n=0)
      end;
      for i := 0 to HowManyPlayers - 1 do
      begin
        NAF[i].Colors := [Players[i].Integers[0], Players[i].Integers[1], Players[i].Integers[2]];
        if trim(Players[i].Strings[0]) = '' then
          NAF[i].MobName := 'tac'
        else
          NAF[i].MobName := LowerCase(Players[CurrentPlayer].Strings[0]);
        If (i > 0) and (Players[i].Integers[0] = 0) then
        begin
          NAF[i].Colors := [Players[0].Integers[0], Players[0].Integers[1], Players[0].Integers[2]];
          NAF[i].MobName := LowerCase(Players[0].Strings[0]);
        end;
      end;
      Status('Start '+ScriptName);
      Disguise(ScriptName+' v'+Version);
      AddtoReport('Start time: '+TheTime);
      if (NAF[CurrentPlayer].Colors[0] = 0) or (NAF[CurrentPlayer].Colors[1] = 0) or (NAF[CurrentPlayer].Colors[2] = 0) then
      begin
        Writeln('Error: Please enter 3 monster colors for player(s).');
        TerminateScript;
      end;
      if not LoggedIn then
        LoginPlayer;
      SetupPlayer;
    end;

    //============================Main Execution==================================\\
    begin
      FFStartUp;
      repeat
        if not LoggedIn then
          LoginPlayer;
        if FFattack(NAF[CurrentPlayer].MobName, NAF[CurrentPlayer].Colors, 3) then
         WaitFight;
        if (MobsOnScreen = 0) then
         if not ChangeCamera then
          SitAndWait;
        if InFight then
         if FightOnScreen then
          WaitFight;
        if (TimeFromMark(FailTimer) > 300000) then
          LogoutSeq('Finding NPC Failed');
        if (Getsystemtime > LogoutTime) then
          LogoutSeq('');
        HpCheck;
        Antiban;
        FindNormalRandoms;
        if (AttackFailed > 19) and not(NAF[CurrentPlayer].MobName = 'tac') then
        begin
          NAF[CurrentPlayer].MobName := 'tac';
          writeln('Changing Monster name to ''tac'' if it continues to not attack then');
          writeln('Re-focus SCAR to the RuneScape window using the cross-hairs.');
        end;
      until(false);
    end.
    ~Will test any script and post feedback at your leisure~

  3. #3
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Check your plugins folder - you might be missing WizzyPlugin.dll for some reason.
    Try reinstalling SRL, then closing and re-starting SCAR.

  4. #4
    Join Date
    Jan 2009
    Posts
    74
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I am missing that. I re-downloaded the latest version of SRL. Didn't show up.
    ~Will test any script and post feedback at your leisure~

  5. #5
    Join Date
    Jan 2009
    Posts
    74
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm guessing I'm going to need that. Anyway I can download that seperate or as a part of a file?
    ~Will test any script and post feedback at your leisure~

  6. #6
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Look in this attachment, SRL/place inside plugins folder:
    http://www.srl-forums.com/forum/atta...6&d=1228950895

  7. #7
    Join Date
    Jan 2009
    Posts
    74
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright I downloaded it and put it all into the plugins folder and still it didn't work. Still came up with the same error. I'll post the Math.scar
    ~Will test any script and post feedback at your leisure~

  8. #8
    Join Date
    Jan 2009
    Posts
    74
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Math.scar

    SCAR Code:
    //-----------------------------------------------------------------//
    //--               Scar Standard Resource Library                --//
    //--               » Math Routines                               --//
    //-----------------------------------------------------------------//
    // * procedure LoadCoSineArrays;                                                                           // * by Mutant Squirrle
    // * function CreateTPAFromText(Txt : String; Chars : Integer) : TPointArray;                              // * by Raymond
    // * function GetSplinePt(Points: TPointArray; Theta: Extended): TPoint;                                   // * by BenLand100
    // * function MakeSplinePath(Points: TPointArray; ThetaInc: Extended): TPointArray;                        // * by BenLand100
    // * function MidPoints(Path: TPointArray; MaxDist: Integer): TPointArray;                                 // * by BenLand100
    // * function InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4: Integer; x, y: Integer): Boolean;              // * by BenLand100
    // * function inAngle(Origin: TPoint; Angle1, Angle2, Radius1, Radius2: Extended; X, Y: Integer): Boolean; // * by BenLand100
    // * function Sine(degrees: Integer): Extended;                                                            // * by ?
    // * function Cose(degrees: Integer): Extended;                                                            // * by ?

    Var
       SineArray, Cosearray: Array[0..360] Of Extended;
       
    {*******************************************************************************
    procedure LoadCoSineArrays;
    By: Mutant Squirrle
    Description: Loads arrays for use with Radial- and LinearWalk.
    *******************************************************************************}


    procedure LoadCoSineArrays;
    var
      i: Integer;
    begin
      for i := 0 to 360 do
      begin
        Sinearray[i] := Sin(i * Pi / 180);
        Cosearray[i] := Cos(i * Pi / 180);
      end;
    end;

    {*******************************************************************************
    Function CreateTPAFromText(Txt : String; Chars : Integer) : TPointArray;
    By: MastaRaymond
    Description: Returns the TPointArray of the inputted Text. Needs Wizzyplugin
    *******************************************************************************}


    Function CreateTPAFromText(Txt : String; Chars : Integer) : TPointArray;
    var
      TempBMP : integer;
    begin;
      TempBMP := CreateBitmapMaskFromText(Txt,Chars);
      Result := CreateTPAFromBMP( GetBitmapDC(TempBMP));
      FreeBitmap(TempBMP);
    end;


    {*******************************************************************************
    function GetSplinePt(Points: TPointArray; Theta: Extended): TPoint;
    By: BenLand100
    Description: Returns the point on a spline, defined by control points Points, at Theta
    *******************************************************************************}


    function GetSplinePt(Points: TPointArray; Theta: Extended): TPoint;
    var
      i, n: Integer;
      XTemp, YTemp: Extended;
    begin
      n := GetArrayLength(Points) - 1;
      for i := 0 to n do
      begin
        XTemp := XTemp + (BinCoe(n, i) * Points[i].x * Pow((1 - Theta), n - i) *
          Pow(Theta, i));
        YTemp := YTemp + (BinCoe(n, i) * Points[i].y * Pow((1 - Theta), n - i) *
          Pow(Theta, i));
      end;
      Result.x := Round(XTemp);
      Result.y := Round(YTemp);
    end;

    {*******************************************************************************
    function MakeSplinePath(Points: TPointArray; ThetaInc: Extended): TPointArray;
    By: BenLand100
    Description: Returns a spline, defined by control points Points, incrementing theta by ThetaInc
    *******************************************************************************}


    function MakeSplinePath(Points: TPointArray; ThetaInc: Extended): TPointArray;
    var
      i: Integer;
      t: Extended;
      temp, last: TPoint;
      done: Boolean;
    begin
      repeat
        if t >= 1 then
        begin
          t := 1;
          done := True;
        end;
        temp := GetSplinePt(Points, t);
        if ((temp.x <> last.x) and (temp.y <> last.y)) then
        begin
          i := i + 1;
          SetArrayLength(Result, i);
          Result[i - 1] := temp;
          last := temp;
        end;
        t := t + ThetaInc;
      until (done)
    end;

    {*******************************************************************************
    function MidPoints(Path: TPointArray; MaxDist: Integer): TPointArray;
    By: BenLand100
    Description: Adds midpoints to Path so no distance on it is greater than MaxDist
    *******************************************************************************}


    function MidPoints(Path: TPointArray; MaxDist: Integer): TPointArray;
    var
      i, c: Integer;
      last: TPoint;
      done: Boolean;
    begin
      if (getarraylength(path) > 0) then
      begin
        repeat
          last := Path[0];
          done := True;
          for i := 1 to GetArrayLength(Path) - 1 do
          begin
            if Sqrt(Pow((Path[i].x - last.x), 2) + Pow((Path[i].y - last.y), 2)) >
              MaxDist then
            begin
              done := False;
              SetArrayLength(Path, GetArrayLength(Path) + 1);
              for c := GetArrayLength(Path) - 1 downto i + 1 do
              begin
                Path[c] := Path[c - 1];
              end;
              Path[i].x := Round((last.x + Path[i + 1].x) / 2);
              Path[i].y := Round((last.y + Path[i + 1].y) / 2);
            end;
            last := Path[i];
          end;
        until (done);
      end;
      Result := Path;
    end;

    {*******************************************************************************
    function InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4: Integer; x, y: Integer): Boolean;
    By: BenLand100
    Description: Returns true if point x, y is in an abstract box defined by x1, y1, x2, y2, x3, y3, x4, y4
    An abstract box example:

    x1, y1     x2, y2
       +--------+
        \         /
         \       /
          +--+
    x4, y4    x3, y3
    *******************************************************************************}


    function InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4: Integer; x, y: Integer):
      Boolean;
    var
      U, D, R, L: Boolean;
      UB, DB, LB, RB, UM, DM, LM, RM: Extended;
    begin
      UM := (-y1 - -y2) div (x1 - x2);
      DM := (-y4 - -y3) div (x4 - x3);
      if x1 - x4 <> 0 then
      begin
        LM := (-y1 - -y4) div (x1 - x4);
      end else
      begin
        LM := Pi;
      end;
      if x2 - x3 <> 0 then
      begin
        RM := (-y2 - -y3) div (x2 - x3);
      end else
      begin
        RM := Pi;
      end;
      UB := -(UM * x1) + -y1
        RB := -(RM * x2) + -y2;
      DB := -(DM * x3) + -y3;
      LB := -(LM * x4) + -y4;
      if (UM * x + UB >= -y) then U := True;
      if (DM * x + DB <= -y) then D := True;
      if (RM <> Pi) and (RM >= 0) and (RM * x + RB <= -y) then R := True;
      if (RM <> Pi) and (RM < 0) and (RM * x + RB >= -y) then R := True;
      if (RM = Pi) and (x < x2) then R := True;
      if (LM <> Pi) and (LM >= 0) and (LM * x + LB >= -y) then L := True;
      if (LM <> Pi) and (LM < 0) and (LM * x + LB <= -y) then L := True;
      if (LM = Pi) and (x > x1) then L := True;
      if U and D and L and R then Result := True;
    end;

    {*******************************************************************************
    function inAngle(Origin: TPoint; Angle1, Angle2, Radius1, Radius2: Extended; X, Y: Integer): Boolean;
    By: BenLand100
    Description: Returns True if X and Y fall within Radius1 to Radius2 and Angle1 to Angle2
    Note1: EVERYTHING IS RELATIVE TO ORIGIN!!!
    Note2: This checks in the smallest segment of the circle formed by Angle1 and Angle 2
    Example: (Assume the origin is 0,0)
     inAngle(0, 90, 5, 10, origin, 5, 5) = true;
     inAngle(0, 90, 0, 5, origin, 5, 5) = false;
     inAngle(90, 0, 5, 10, origin, 5, 5) = false;
    *******************************************************************************}


    function inAngle(Origin: TPoint; Angle1, Angle2, Radius1, Radius2: Extended; x,
      y: Integer): Boolean;
    var
      PTemp: PPoint;
      OTemp: TPoint;
      MinAngle, MaxAngle, MinRadius, MaxRadius: Extended;
    begin
      Angle1 := FixD(Angle1);
      Angle2 := FixD(Angle2);
      MinAngle := Angle1;
      if Angle1 > Angle2 then MinAngle := Angle2;
      MaxAngle := Angle1;
      if Angle1 < Angle2 then MaxAngle := Angle2;
      MinRadius := Radius1;
      if Radius1 > Radius2 then MinRadius := Radius2;
      MaxRadius := Radius1;
      if Radius1 < Radius2 then MaxRadius := Radius2;
      OTemp.x := x;
      OTemp.y := y;
      PTemp := ToPolarOffset(OTemp, Origin);
      if (PTemp.R >= MinRadius) and (PTemp.R <= MaxRadius) then
        if (PTemp.T >= MinAngle) and (PTemp.T <= MaxAngle) then
          Result := True;
    end;

    {*******************************************************************************
    function Sine(degrees: Integer): Extended;
    By:
    Description:
    *******************************************************************************}


    function Sine(Degrees: Integer): Extended;
    begin
      Result := sinearray[Trunc(FixD(Degrees))];
    end;

    {*******************************************************************************
    function Cose(degrees: Integer): Extended;
    By:
    Description:
    *******************************************************************************}


    function Cose(Degrees: Integer): Extended;
    begin
      Result := cosearray[Trunc(FixD(Degrees))];
    end;
    ~Will test any script and post feedback at your leisure~

  9. #9
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This is strange - I would suggest that you checkout the head revision (31, I think) from the SRL SVN. If you're running Windows Vista then you'll need to run it as an Administrator, otherwise the plugins won't move properly.

  10. #10
    Join Date
    Jan 2009
    Posts
    74
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh you know what, I was running Vista on my laptop. I'll give it a shot on my main desktop and post what happens next. Thanks for the tip.
    ~Will test any script and post feedback at your leisure~

  11. #11
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Download and change the constant Install to 1 i.e
    SCAR Code:
    const
      Install = 1;

    Then press run.
    After it says it was complete move all the plugins in the "place inside plugins folder" to the plugins folder and then you should be good to go .

  12. #12
    Join Date
    Jan 2009
    Posts
    74
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I at least got it running now; however, all of my scripts randomly log out and don't solve any randoms as good as my main computer does. I'm certain its because of Vista. It won't log in my other characters from my Army. Anymore advice or tips on the matter? I know it's not the script because I ran the same one with my main computer and it's been going for nearly 3 hours now.
    ~Will test any script and post feedback at your leisure~

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. More errors in script please help
    By xaviar in forum OSR Help
    Replies: 4
    Last Post: 07-03-2008, 03:34 AM
  2. Script Errors....
    By Macho Man67 in forum OSR Help
    Replies: 5
    Last Post: 10-25-2007, 05:19 PM

Posting Permissions

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