Results 1 to 13 of 13

Thread: AntiRandom PopUP WONT GO AWAY!

  1. #1
    Join Date
    Oct 2009
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default AntiRandom PopUP WONT GO AWAY!

    My script compiles perfecctly. But when I select the screen/window
    and then i push run, it doesnt run. A NEW script pops up in a new tap called AntiRandoms, and I keep deletin it but it will never go away... What do I do??

  2. #2
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    There's probably an error in the debug window at the bottom of SCAR. It would be helpful if you copied and pasted its contents here so we could try and figure out what your problem is.
    :-)

  3. #3
    Join Date
    Oct 2009
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well, heres my script:
    Code:
                        /////////////////\\\\\\\\\\\\\\\\\
                       ////////////////SCAR\\\\\\\\\\\\\\\\
                      ///////////////////\\\\\\\\\\\\\\\\\\\
                     //////////////////SCAR\\\\\\\\\\\\\\\\\\
                    /////////////////////\\\\\\\\\\\\\\\\\\\\\
                   ////////////////////SCAR\\\\\\\\\\\\\\\\\\\\
                  ///////////////////////\\\\\\\\\\\\\\\\\\\\\\\
                 //////////////////////SCAR\\\\\\\\\\\\\\\\\\\\\\
                /////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\
               ////////////////////////SCAR\\\\\\\\\\\\\\\\\\\\\\\\
              ///////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\
             //////////////////////////SCAR\\\\\\\\\\\\\\\\\\\\\\\\\\
            /////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
           ////////////////////////////SCAR\\\\\\\\\\\\\\\\\\\\\\\\\\\\
          ///////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
         //////////////////////////////SCAR\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
        /////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
       //////////////////////Edgville WoodCutter.scar\\\\\\\\\\\\\\\\\\\\\\
      ////////////////////////////Version 0.0.2\\\\\\\\\\\\\\\\\\\\\\\\\\\
     ///////////////////////////By: Zerghunter3000\\\\\\\\\\\\\\\\\\\\\\\\\\\
    //////////////////////////Thanks To: Mario97000\\\\\\\\\\\\\\\\\\\\\\\\\\\
    /////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    Program WoodCutter;
     {.include SRL\SRL.Scar}
    
     Var I: Integer;
    ////////////////////////////////////////////////////////////////////////////
    procedure Declareplayers;
    begin
     HowmanyPlayers := 0;
     NumberOfPlayers(HowManyPlayers);
     CurrentPlayer := 0;
    
     Writeln('Logging in...');
     Players[0].Name := '';
     Players[0].Pass := '';
     Players[0].Nick := '';
     Players[0].Active := True;
    end;
    
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    
    Procedure BoringTalk;
    Begin
      If not LoggedIn then Exit;
    
      FindNormalRandoms;
      Case Random(50) of
        0: Begin
           TypeSend('Dang, WoodCutting is so broing! Lol')
      End;
        1: Begin
           TypeSend('Cant wait till I get 99 WoodCutting.')
      End;
        2: Begin
           TypeSend('I am so SICK! of seeing Willows!')
      End;
     End;
    End;
    
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    
    Procedure DropPocket;
    Begin
      If not LoggedIn then Exit;
    
      FindNormalRandoms;
      Case Random(3) of
        0: Begin
        Writeln('Inventory Full.');
      Wait(1130 + Random(162));
      Writeln('Emptying Inventory...');
      SetupSRL;
      For I := 2 to 28 do
        DropItem(I);
        Writeln('Pocket Empty.')
        End;
    
        1:Begin
            Writeln('Inventory Full.');
      Wait(2420 + Random(349));
      Writeln('Emptying Inventory...');
      SetupSRL;
      For I := 20 to 28 do
        DropItem(I);
      For I := 2 to 19 do
        DropItem(I);
        Writeln('Pocket Empty.')
           End;
        2:Begin
            Writeln('Inventory Full.');
      Wait(1700 + Random(234));
      Writeln('Emptying Inventory...');
      SetupSRL;
      For I := 10 to 28 do
        DropItem(I);
      For I := 2 to 9 do
        DropItem(I);
        Writeln('Pocket Empty.')
           End;
      End;
    End;
    
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    
    Procedure AntiBan;
    Begin
      If not LoggedIn then Exit;
    
      FindNormalRandoms;
      Case Random(40) of
        0: Begin
             Writeln('Commencing AntiBan: WoodCutting Skill Check.');
             HoverSkill('woodcutting',false);
             Wait(2453 + Random(442));
           End;
    
        1: Begin
             Writeln ('Commencing AntiBan: PickUp Mouse.');
             PickUpMouse;
           End;
    
        2: Begin
             Writeln('Commencing AntiBan: Turning N, S ,N')
             MakeCompass('N');
             Wait(941 + Random(124));
             Makecompass('S');
             Wait(724 + Random(131));
             MakeCompass('N');
             FindNormalRandoms;
           End;
    
        3: Begin
             Writeln('Commencing AntiBan:  Turning E, W ,S')
             MakeCompass('E');
             Wait(1030 + Random(123));
             Makecompass('W');
             Wait(1940 + Random(112));
             MakeCompass('S');
             FindNormalRandoms;
           End;
    
        4: Begin
             Writeln('Commencing AntiBan: Turning S, E ,N')
             MakeCompass('S');
             Wait(1154 + Random(248));
             Makecompass('E');
             Wait(774 + Random(347));
             MakeCompass('N');
             FindNormalRandoms;
           End;
      End;
    End;
    
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    
    Procedure ChopTree;
    Var
      X, Y: Integer;
    Begin
      Repeat
        MakeCompass('N');
        FindNormalRandoms;
        If FindObj(X, Y, 'hop', 2575932, 35) Then
        Begin
          Writeln('Found Tree...');
          Mouse(X, Y, 0, 0, False);
          Writeln('Cutting Down Tree.');
          ChooseOption('hop');
        End;
        Repeat
          Wait(2240 + Random(242));
          AntiBan;
        Until not IsUpText('illow') or InvFull;
      Until(InvFull);
    
      If InvFull Then
     DropPocket;
     ChopTree;
    End;
    
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    
    Begin
     SetUpSRL;
     ActivateClient;
     Repeat
       ChopTree;
     Until(AllPlayersInactive);
    End.
    And heres all it says at the bottom:
    Code:
    Successfully compiled (5562 ms)
    SRL Compiled in 110 msec
    [Runtime Error] : Out Of Range in line 882 in script C:\Users\Zerghunter3000\Desktop\Emulators\scarprerelease\includes\SRL\SRL\Core\AntiRandoms\AntiRandoms.scar
    And heres line 882 in AntiRandoms thing:
    Code:
    //-----------------------------------------------------------------//
    //--               Scar Standard Resource Library                --//
    //--               ยป AntiRandom Routines                         --//
    //-----------------------------------------------------------------//
    // * procedure SRLRandomsReport;                      // * by Starblaster100
    // * function FindBoxOption(var Box: TBox): Boolean;  // * by Nava2
    // * function UseRewardBox: Boolean;                  // * by Nava2
    // * function FindMod: Boolean;                       // * by Stupid3ooo
    // * function FindFight: Boolean;                     // * by Stupid3ooo
    // * function FindLamp(skill: String): Boolean;       // * by pups, Starblaster100 and PriSoner fixed by Lee Lok Hin
    // * function FindDead : boolean;                     // * by Stupid3ooo and Cazax
    // * function Rand_GetRandomType: Integer;            // * by ZephyrsFury
    // * procedure LoadTeleRandoms;                       // * by ZephyrsFury
    // * function SolveTeleportRandoms: Boolean;          // * by ZephyrsFury
    // * function FindNonInventoryRandoms: Boolean;       // * by The SRL Developers Team!... all time sexiness by Mutant
    // * function FindNormalRandoms: Boolean;             // * by The SRL Developers Team!... all time sexiness by Mutant
    //-----------------------------------------------------------------//
    
    type
      TTeleRandom = record
        Name, Music: string;
        TypeID, RandIndex: Integer;
        TextColors,TextFonts: TIntegerArray;
        IsInRandom, SolveRandom: function: Boolean;
        Texts: TStringArray;
        TextBoxes: TBoxArray;
      end;
    
    var
      TeleRandoms: array of TTeleRandom;
      SolveSRLRandoms, r_UseRandomTool: Boolean;
      RB_SkipArray: TIntegerArray;
      SoundPath: string;
      CurRandom: Integer;
      
    {*******************************************************************************
    procedure SRLRandomsReport;
    by: Starblaster100
    Description: Displays Randoms Report.
    *******************************************************************************}
    
    procedure SRLRandomsReport;
    var
      i, CurrentInt: Integer;
      CurrentStr, Name: string;
      
    Begin
      ChangeReportWidth(280);
      ClearReport;
      AddToReport('/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\');
      AddToReport('|     SRL ' + IntToStr(SRLVersionNumber) + ' Randoms Report    |');
      AddToReport('|       www.villavu.com        |');
      AddToReport('|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|');
      For i := 0 to 44 do
      Begin
        Case i of
          0: begin CurrentInt := SRL_Logs;                     Name := '| SRL Logs          :'; end;
          1: begin CurrentInt := RandSolved[rand_Trade];       Name := '| Trades Made       :'; end;
          2: begin CurrentInt := RandFailed[rand_Trade];       Name := '| Trades Missed     :'; end;
          3: begin CurrentInt := RandSolved[rand_Fight];       Name := '| Fights            :'; end;
          4: begin CurrentInt := RandSolved[rand_Sandwich];    Name := '| Sandwiches Solved :'; end;
          5: begin CurrentInt := RandFailed[rand_Sandwich];    Name := '| Sandwiches Missed :'; end;
          6: begin CurrentInt := RandSolved[rand_Lamp];        Name := '| Lamps Solved      :'; end;
          7: begin CurrentInt := RandFailed[rand_Lamp];        Name := '| Lamps Missed      :'; end;
          8: begin CurrentInt := RandSolved[rand_Frog];        Name := '| Frog Solved       :'; end;
          9: begin CurrentInt := RandFailed[rand_Frog];        Name := '| Frog Missed       :'; end;
          10: begin CurrentInt := RandSolved[rand_Certer];     Name := '| Certers Solved    :'; end;
          11: begin CurrentInt := RandFailed[rand_Certer];     Name := '| Certers Missed    :'; end;
          12: begin CurrentInt := RandSolved[rand_Demon];      Name := '| Demons Solved     :'; end;
          13: begin CurrentInt := RandFailed[rand_Demon];      Name := '| Demons Missed     :'; end;
          14: begin CurrentInt := RandSolved[rand_Mod];        Name := '| Mods Found        :'; end;
          15: begin CurrentInt := RandSolved[rand_Maze];       Name := '| Mazes Solved      :'; end;
          16: begin CurrentInt := RandFailed[rand_Maze];       Name := '| Mazes Missed      :'; end;
          17: begin CurrentInt := RandSolved[rand_Mime];       Name := '| Mimes Solved      :'; end;
          18: begin CurrentInt := RandFailed[rand_Mime];       Name := '| Mimes Missed      :'; end;
          19: begin CurrentInt := RandSolved[rand_Death];      Name := '| Deaths            :'; end;
          20: begin CurrentInt := RandSolved[rand_Quiz];       Name := '| Quizes Solved     :'; end;
          21: begin CurrentInt := RandFailed[rand_Quiz];       Name := '| Quizes Missed     :'; end;
          22: begin CurrentInt := RandSolved[rand_ScapeRune];  Name := '| ScapeRunes Solved :'; end;
          23: begin CurrentInt := RandFailed[rand_ScapeRune];  Name := '| ScapeRunes Missed :'; end;
          24: begin CurrentInt := RandSolved[rand_BirdNest];   Name := '| Birds Nests       :'; end;
          25: begin CurrentInt := RandSolved[rand_Pinball];    Name := '| Pinballs Solved   :'; end;
          26: begin CurrentInt := RandFailed[rand_Pinball];    Name := '| Pinballs Missed   :'; end;
          27: begin CurrentInt := RandSolved[rand_PrisonPete]; Name := '| Petes Solved      :'; end;
          28: begin CurrentInt := RandFailed[rand_PrisonPete]; Name := '| Petes Missed      :'; end;
          29: begin CurrentInt := RandSolved[rand_Forester];   Name := '| Foresters Solved  :'; end;
          30: begin CurrentInt := RandFailed[rand_Forester];   Name := '| Foresters Missed  :'; end;
          31: begin CurrentInt := RandSolved[rand_Leo];        Name := '| Leo''s Solved      :'; end; //Another space due to the ''
          32: begin CurrentInt := RandFailed[rand_Leo];        Name := '| Leo''s Missed      :'; end;
          33: begin CurrentInt := RandSolved[rand_Molly];      Name := '| Molly''s Solved    :'; end;
          34: begin CurrentInt := RandFailed[rand_Molly];      Name := '| Molly''s Missed    :'; end;
          35: begin CurrentInt := RandSolved[rand_Pillory];    Name := '| Pillory''s Solved  :'; end;
          36: begin CurrentInt := RandFailed[rand_Pillory];    Name := '| Pillory''s Missed  :'; end;
          37: begin CurrentInt := RandSolved[rand_CapnArnav];  Name := '| Capn Arnav Solved :'; end;
          38: begin CurrentInt := RandFailed[rand_CapnArnav];  Name := '| Capn Arnav Missed :'; end;
          39: begin CurrentInt := RandSolved[rand_Beekeeper];  Name := '| Beekeepers Solved :'; end;
          40: begin CurrentInt := RandFailed[rand_Beekeeper];  Name := '| Beekeepers Missed :'; end;
          41: begin CurrentInt := RandSolved[rand_Abyss];      Name := '| Abysses Solved    :'; end;
          42: begin CurrentInt := RandFailed[rand_Abyss];      Name := '| Abysses Missed    :'; end;
          43: begin CurrentInt := RandSolved[rand_Mordaut];    Name := '| Mordauts Solved   :'; end;
          44: begin CurrentInt := RandFailed[rand_Mordaut];    Name := '| Mordauts Missed   :'; end;
        end;
    
        if (CurrentInt < 1) then
          Continue;
        CurrentStr := IntToStr(CurrentInt);
        AddToReport(PadR(Name, 30 - Length(CurrentStr)) + CurrentStr + ' |');
      end;
      AddToReport('\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/');
      SendSRLReport;
    end;
    
    {*******************************************************************************
    procedure FindBoxOption(var Box: TBox): Boolean;
    By: Nava2
    Description: Finds the text of options, based on the text loaded from the
    player array. Will find text in order of occurance in the array.
    *******************************************************************************}
    
    function FindBoxOption(var Box: TBox; var RewardInd: Integer): Boolean;
    var
      x, y, H, L, II, i, LL, Col: Integer;
      Text, TPA, xTPA: TPointArray;
      ATPA: T2DPointArray;
      Scroll: Boolean;
      P: TPoint;
      
    begin
      Result := False;
      RewardInd := -1;
      Box := IntToBox(-1, -1, -1, -1);
      if (not LoggedIn) then exit;
      L := High(Players[CurrentPlayer].BoxRewards);
      Scroll := (GetColor(385, 70) = 657930);
      for II := 0 to L + 1 do
      begin
        if (InIntArray(RB_SkipArray, II)) then Continue;
        if (II < L + 1) then
          Text := LoadTextTPA(Players[CurrentPlayer].BoxRewards[II], UpChars, H)
        else
          Text := LoadTextTPA('box', UpChars, H);
          
        FindColorsTolerance(TPA, 2070783, 35, 69, 362, 311, 3);
        ATPA := SplitTPAEx(TPA, 3, 1);
        LL := High(ATPA);
        for i := 0 to LL do
        begin
          Result := FindTextTPAInTPA(H, Text, ATPA[i], xTPA);
          if (Result) then Break;
        end;
    
        if (not Result) and (Scroll) then
        begin
          X := 377;
          Y := 312 - II mod 2 * 245;
          Col := 657930 + II mod 2 * 658704;
          P := Point(375, 302 - II mod 2 * 224);
    
          MMouse(X, Y, 0, 0);
          Wait(RandomRange(30, 60));
    
          HoldMouse(X, y, True);
          while (GetColor(P.X, P.Y) <> Col) and (GetColor(385, 70) = 657930) and (not(Result)) do
          begin
            if (not LoggedIn) then Break;
            FindColorsTolerance(TPA, 2070783, 35, 69, 362, 311, 3);
            Result := FindTextTPAInTPA(H, Text, TPA, xTPA);
            Wait(RandomRange(40, 50));
          end;
          ReleaseMouse(X, Y, True);
        end;
    
        if (Result) then
        begin
          if (II < L + 1) then
            WriteLn('Found Reward Item: ' + Players[CurrentPlayer].BoxRewards[II])
          else
            WriteLn('Found no prefered reward items, chose default reward: Mystery Box');
          Break;
        end;
      end;
      if (not Result) then exit;
      Box := GetTPABounds(xTPA);
      Rewardind := II;
      //Writeln('Box: ' + IntToStr(Box.x1) + ', ' + IntToStr(Box.y1) + ', ' + IntToStr(Box.x2) + ', ' + IntToStr(Box.y2));
    end;
    
    {*******************************************************************************
    procedure UseRewardBox: Boolean;
    by: Nava2
    Description: Finds the reward box, and opens it getting the reward.
    *******************************************************************************}
    
    function UseRewardBox: Boolean;
    var
      I, Time, Height, fx, fy, Index, bDTM: Integer;
      Text, TPA: TPointArray;
      B: TBox;
      
    begin
      Result := False;
      if (not LoggedIn) then exit;
      GameTab(tab_Inv);
      if (not(FindColorTolerance(fX, fY, 7280034, MIX1, MIY1, MIX2, MIY2, 20))) then Exit;
      bDTM := DTMFromString('78DA634C626660B8C4C8800C568B963070006' +
        '990E87F20608C04AA398EAA06220B23813448CD65026A0A816AAE12A1' +
        'E62401359940351751D5DC889782BB19AC2619A8E6087E7300776A0F22');
      for I := 1 to 28 do
      begin
        B := InvBox(I);
        if FindItemEx(fx, fy, 'dtm', bDTM, B, []) then
        begin
          InvMouse(I, 3);
          Wait(RandomRange(100, 150));
          Result := IsUpText('event gift');
          if (Result) then Break;
        end;
      end;
      FreeDTM(bDTM);
      if (not Result) then exit;
    
      GetMousePos(fx, fy);
      Mouse(fx, fy, 0, 0, True);
    
      Result := False;
      Text := LoadTextTPA('hoose', UpChars, Height);
      Time := GetTimeRunning + 10000;
      FindColorsTolerance(TPA, 2070783, 185, 34, 327, 50, 3);
      while (not Result and (GetTimeRunning < Time)) do
      begin
        Wait(RandomRange(80, 100));
        FindColorsTolerance(TPA, 2070783, 185, 34, 327, 50, 3);
        if (Length(TPA) > 10) then
          Result := FindTextTPAinTPA(Height, Text, TPA, TPA);
      end;
    
      if (not Result) then
      begin
        SRL_Warn('OpenRewardBox', 'Could not open Reward Screen', Warn_AllVersions);
        Exit;
      end;
      Wait(Random(100));
      if (not FindBoxOption(B, Index)) then
      begin
        SRL_Warn('UseRewardBox', 'Could not find a usable option.', Warn_AllVersions);
        Exit;
      end;
    
      Mouse(B.X1, B.Y1, 0, 0, True);
      Time := GetTimeRunning + 2000;
      Result := False;
      while (not Result) and (GetTimeRunning < Time) do
      begin
        FindColorsTolerance(TPA, 1317148, 35, 70, 362, 311, 3);
        Result := Length(TPA) > 50;
        Wait(50 + Random(50));
      end;
      if (not Result) then
      begin
        CloseWindow;
        Exit;
      end;
      MouseBox(413, 171, 469, 200, 1);
      Time := GetSystemTime;
      while (CountColorTolerance(1317148, B.x1 - 10, B.y1 - 10, B.x1 + 10, B.y1 + 10, 3) > 50) and (GetSystemTime - Time < 5000) do
      begin
        if (Pos('thing else', GetChatBoxText(8, clBlack)) > 0) then
        begin
          CloseWindow;
          Wait(500 + Random(500));
          SetLength(RB_SkipArray, Length(RB_SkipArray) + 1);
          RB_SkipArray[High(RB_SkipArray)] := Index;
          Result := UseRewardBox;
          Break;
        end;
        Wait(100 + Random(200));
      end;
      RB_SkipArray := [];
      if (CloseWindow) then
        Result := False;
    end;
    
    {*******************************************************************************
    function FindMod: Boolean;
    by: Stupid3ooo
    Description: Results True if a mod is found, then it waits 10-20 mins and logs back in
    *******************************************************************************}
    
    function FindMod: Boolean;
    var
      tX, tY: Integer;
    begin
      if (not UseFindMod) or (not LoggedIn) then exit;
      if (BmpMod = 0) or (BmpAdmin = 0) then
        LoadSRLBitMaps;
      if (FindColorTolerance(tX, tY, 14737632, MCX1, MCY1, MCX1 + 40, MCY2, 15)) or
           (FindColorTolerance(tX, tY, 589815, MCX1, MCY1, MCX1 + 40, MCY2, 15)) then
        if (FindTransparentBitmapTolerance(bmpMod, tX, tY, clBlack, MCX1, MCY1, MCX1 + 40, MCY2, 15)) or
         (FindTransparentBitmapTolerance(bmpAdmin, tx, ty, clBlack, MCX1, MCY1, MCX1 + 40, MCY2, 15)) then
        begin
          Result := True;
          AddToSRLLog('******** FOUND MOD ********');
          WriteLn('******** FOUND MOD ********');
          TakeScreen('Found mod');
          Inc(RandSolved[rand_Mod]);
          SaveToChatLog;
          if (SRL_Procs[srl_OnFindMod] <> nil) then
            SRL_Procs[srl_OnFindMod]();
          if (LogoutOnMod) then
          begin
            Players[CurrentPlayer].Rand := 'Found Mod';
            repeat
              Logout;
              Wait(1500 + Random(500));
            until not (LoggedIn);
            Wait(60000 + Random(60000));
            LoginPlayer;
            Players[CurrentPlayer].Rand := '';
          end;
        end;
    end;
    
    {*******************************************************************************
    function FindFight: Boolean;
    by: EvilChicken!
    Description: Results true if charachter is in a fight.
    *******************************************************************************}
    
    function FindFight: Boolean;
    begin
      Result := False;
      if (not LoggedIn) then exit;
      if (CountColor(10496, 200, 130, 280, 180) + CountColor(198716, 200, 130, 280, 180) > 50) then
      begin
        if (CheckHpFirst) and (HpPercent = 100) then exit;
    
        Result := True;
        AddToSRLLog('******** FOUND FIGHTING RANDOM ********');
        WriteLn('******** FOUND FIGHTING RANDOM ********');
        TakeScreen('Found Fight');
        Inc(RandSolved[rand_Fight]);
      end;
    end;
    
    {*******************************************************************************
    function FindLamp(skill: String): Boolean;
    by: Pups, Starblaster100 and PriSoner fixed by Lee Lok Hin
    Description: handles Genie. Results True if lamp found and handled.
    skill: Skill to use with lamp eg. 'strength', 'attack', etc.
    *******************************************************************************}
    
    function FindLamp(skill: string): Boolean;
    var
      LampTime, X, Y, I: Integer;
    begin
      GameTab(tab_Inv);
      if FindColorTolerance(x, y, 1084300, MIX1, MIY1, MIX2, MIY2, 40) then
        if (FindTransparentBitmapTolerance(Lamp, x, y, clBlack, MIX1, MIY1, MIX2, MIY2, 40)) then
        begin
          Result := True;
          Inc(RandSolved[rand_Lamp]);
          TakeScreen('Lamp Random Solved');
          AddToSRLLog('******** SOLVED LAMP RANDOM ********');
          WriteLn('******** SOLVED LAMP RANDOM ********');
          Mouse(X, Y, 4, 4, True);
          Wait(1500 + Random(500));
          MarkTime(LampTime);
          for I := 1 to 4 do
          begin
            case (LowerCase(Skill)) of
              'attack': Mouse(81, 109, 12, 12, True);
              'strength': Mouse(139, 110, 12, 12, True);
              'ranged': Mouse(196, 113, 12, 12, True);
              'magic': Mouse(257, 117, 12, 12, True);
              'defence': Mouse(319, 109, 12, 12, True);
              'crafting', 'craft': Mouse(376, 111, 12, 12, True);
              'hitpoints', 'hp': Mouse(436, 112, 12, 12, True);
              'prayer', 'pray': Mouse(79, 166, 12, 12, True);
              'agility': Mouse(141, 166, 12, 12, True);
              'herblore': Mouse(199, 171, 12, 12, True);
              'thieving', 'thief': Mouse(258, 167, 12, 12, True);
              'fishing', 'fish': Mouse(325, 164, 12, 12, True);
              'runecraft', 'runecrafting': Mouse(375, 167, 12, 12, True);
              'slayer', 'slay': Mouse(436, 173, 12, 12, True);
              'farming', 'farm': Mouse(83, 224, 12, 12, True);
              'mining', 'mine': Mouse(137, 222, 12, 12, True);
              'smithing', 'smith': Mouse(197, 220, 12, 12, True);
              'hunting', 'hunt', 'hunter': Mouse(257, 222, 12, 12, True);
              'cooking', 'cook': Mouse(318, 227, 12, 12, True);
              'firemaking', 'fire': Mouse(378, 226, 12, 12, True);
              'woodcutting', 'wc': Mouse(439, 222, 12, 12, True);
              'fletching', 'fletch': Mouse(199, 275, 12, 12, True);
              'construction': Mouse(255, 277, 12, 12, True);
              'summoning': Mouse(323, 276, 12, 12, True);
            else
              Mouse(438, 113, 12, 12, True);
            end;
            Wait(500 + Random(200) + Random(100));
            if FindColorTolerance(X, Y, 5602449, 41, 75, 470, 302, 30) then Break;
            if (TimeFromMark(LampTime) > 10000) then
            begin
              Result := False;
              Logout;
              Players[CurrentPlayer].Rand := 'Lamp';
              Exit;
            end;
            ClickToContinue;
          end;
          Mouse(416, 281, 7, 1, True);
          Wait(500 + Random(150) + Random(150));
        end;
    end;
    
    {*******************************************************************************
    function FindDead: Boolean;
    by: Stupid3ooo and Cazax
    Description: Checks for text "Oh dear you are dead".
    Logs out player if Reincarnate = False.
    *******************************************************************************}
    function FindDead: Boolean;
    begin
      Result := False;
      if FindTextTPA(0, 0, MCX1, MCY1, MCX2, MCY2, 'dear', SmallChars, Nothing) then
        if FindTextTPA(0, 0, MCX1, MCY1, MCX2, MCY2, 'dead', SmallChars, Nothing) then
        begin
          Inc(RandSolved[rand_Death]);
          Result := True;
          SaveToChatLog;
          if (SRL_Procs[srl_OnFindDead] <> nil) then
            SRL_Procs[srl_OnFindDead]();
          if (Reincarnate) then exit;
          TakeScreen('Found Dead');
          LogOut;
          Players[CurrentPlayer].Rand := 'Oh Dear You Are in Lumby';
          Players[CurrentPlayer].Active := False;
        end;
    end;
    
    {*******************************************************************************
    function Rand_GetRandomType: Integer;
    by: ZephyrsFury
    Description: Checks for the existance of various tabs to determine the type of
    random we are in:
      1: 13 or 14-tab randoms
      2: 6-tab randoms.
    *******************************************************************************}
    
    function Rand_GetRandomType: Integer;
    var
      TabConfig: TIntegerArray;
    begin
      TabConfig := [tab_Stats, tab_Friends];
      for Result := 1 to 2 do
        if (TabExists(TabConfig[Result - 1])) then
          Exit;
    end;
    
    {*******************************************************************************
    procedure LoadTeleRandoms;
    by: ZephyrsFury
    Description: Loads the teleport random information for each random.
    *******************************************************************************}
    
    procedure LoadTeleRandoms;
    begin
      SetLength(TeleRandoms, 19);
    
      with TeleRandoms[0] do    //
      begin
        Name := 'leo the gravedigger';
        Music := 'spooky';
        TypeID := 1;
        IsInRandom := @InLeoGraveyard;
        Texts := ['Leo'];
        TextColors := [128];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := nil;
        RandIndex := rand_Leo;
      end;
    
      with TeleRandoms[1] do    //
      begin
        Name := 'freaky forester';
        Music := 'pheasant peasant';
        TypeID := 1;
        IsInRandom := @InForesterRandom;
        Texts := ['orester'];
        TextColors := [128];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolveForester;
        RandIndex := rand_Forester;
      end;
    
      with TeleRandoms[2] do     //
      begin
        Name := 'maze';
        Music := 'time out';
        TypeID := 1;
        IsInRandom := @InMaze;
        Texts := ['mplete'];
        TextColors := [15395562];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(131, 28, 194, 52)];
        SolveRandom := @SolveMaze;
        RandIndex := rand_Maze;
      end;
    
      with TeleRandoms[3] do  //
      begin
        Name := 'prison pete';
        Music := 'in the clink';
        TypeID := 1;
        IsInRandom := @InPrisonPete;
        Texts := [];
        TextColors := [];
        TextFonts := [];
        TextBoxes := [];
        SolveRandom := nil;
        RandIndex := rand_PrisonPete;
      end;
    
      with TeleRandoms[4] do  //
      begin
        Name := 'evil bob''s island';
        Music := 'evil bob''s island';
        TypeID := 1;
        IsInRandom := @InEvilBobsIsland;
        Texts := [];
        TextColors := [0];
        TextFonts := [];
        TextBoxes := [];
        SolveRandom := @SolveEvilBob;
        RandIndex := rand_ScapeRune;
      end;
    
      with TeleRandoms[5] do     //
      begin
        Name := 'drill demon';
        Music := 'corporal punishment';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['amien', 'amien'];
        TextColors := [128, 0];
        TextFonts := [NPCChars, NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2), IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolveDemon;
        RandIndex := rand_Demon;
      end;
    
      with TeleRandoms[6] do        //Quiz with 6 tabs visibile
      begin
        Name := 'quiz';
        Music := 'the quiz master';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['uiz', 'uiz'];
        TextColors := [128, 0];
        TextFonts := [NPCChars, NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2), IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolveQuiz;
        RandIndex := rand_Quiz;
      end;
    
      with TeleRandoms[7] do        //Quiz with 13 tabs visible
      begin
        Name := 'quiz';
        Music := '';
        TypeID := 1;
        IsInRandom := @InQuizRandom;
        Texts := ['uiz', 'uiz'];
        TextColors := [128, 0];
        TextFonts := [NPCChars, NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2), IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolveQuiz;
        RandIndex := rand_Quiz;
      end;
    
      with TeleRandoms[8] do      //
      begin
        Name := 'surprise exam';
        Music := 'school''s out';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['ordaut'];
        TextColors := [128];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolveMordaut;
        RandIndex := rand_Mordaut;
      end;
    
      with TeleRandoms[9] do   //
      begin
        Name := 'molly''s evil twin';
        Music := 'head to head';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['olly'];
        TextColors := [128];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := nil;
        RandIndex := rand_Molly;
      end;
    
      with TeleRandoms[10] do    //
      begin
        Name := 'pinball';
        Music := 'pinball wizard';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['flashing'];
        TextColors := [8323072];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolvePinball;
        RandIndex := rand_Pinball;
      end;
    
      with TeleRandoms[11] do    //
      begin
        Name := 'sandwich lady';
        Music := 'snack attack';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['andwich'];
        TextColors := [128];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolveSandwichLady;
        RandIndex := rand_Sandwich;
      end;
    
      with TeleRandoms[12] do    //
      begin
        Name := 'bee keeper';
        Music := 'horizon';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['keeper'];
        TextColors := [128];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolveBeeKeeper;
        RandIndex := rand_BeeKeeper;
      end;
    
      with TeleRandoms[13] do    //
      begin
        Name := 'pillory';
        Music := 'garden';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['swinging', 'pillory'];
        TextColors := [128, 0];
        TextFonts := [NPCChars, NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2), IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolvePilloryPuzzle;
        RandIndex := rand_Pillory;
      end;
    
      with TeleRandoms[14] do  //
      begin
        Name := 'cap''n arnav';
        Music := 'sea shanty';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['rnav'];
        TextColors := [128];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolveArnav;
        RandIndex := rand_CapnArnav;
      end;
    
      with TeleRandoms[15] do   // Abyss!
      begin
        Name := 'abyssal teleport';
        Music := 'into the abyss';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['appendage'];
        TextColors := [128];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolveAbyss;
        RandIndex := rand_Abyss;
      end;
    
      with TeleRandoms[16] do   //
      begin
        Name := 'certer';
        Music := 'harmony';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['iles'];
        TextColors := [128];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolveCerter;
        RandIndex := rand_Certer;
      end;
    
      with TeleRandoms[17] do    //
      begin
        Name := 'mime';
        Music := 'artistry';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['Mime'];
        TextColors := [0];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolveMime;
        RandIndex := rand_Mime;
      end;
    
      with TeleRandoms[18] do   //
      begin
        Name := 'frog';
        Music := 'frogland';
        TypeID := 2;
        IsInRandom := nil;
        Texts := ['erald'];
        TextColors := [128];
        TextFonts := [NPCChars];
        TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
        SolveRandom := @SolveFrog;
        RandIndex := rand_Frog;
      end;
    end;
    
    procedure r_RunAlert; forward;
    function r_CheckAction: Boolean; forward;
    procedure r_ResetAll; forward;
    
    {*******************************************************************************
    function SolveTeleportRandoms: Boolean;
    by: ZephyrsFury
    Description: Handles the solving of Teleport randoms. Returns True if one is
      detected.
    *******************************************************************************}
    
    function SolveTeleportRandoms: Boolean;
    var
      TypeID, H, HH, I, J: Integer;
      B: TBox;
      RandResult: Boolean;
      Rand_Music: string;
      InitCompAngle: Extended;
      
    begin
      TypeID := Rand_GetRandomType;
      H := High(TeleRandoms);
      for I := 0 to H do
      begin
        if (TypeID = TeleRandoms[I].TypeID) then
        begin
          if (TeleRandoms[I].IsInRandom <> nil) then
            RandResult := TeleRandoms[I].IsInRandom();
          if (TeleRandoms[I].IsInRandom = nil) or (RandResult) then
          begin
            Result := (Length(TeleRandoms[I].Texts) = 0) and (TeleRandoms[I].Music = '');
            if (not Result) and (TeleRandoms[I].Music <> '') then
            begin
              if (Rand_Music = '') then Rand_Music := Lowercase(GetMusic);
              Result := (Rand_Music = TeleRandoms[I].Music);
            end;
            if (not Result) and (Length(TeleRandoms[I].Texts) > 0) then
            begin
              HH := High(TeleRandoms[I].Texts)
              for J := 0 to HH do
              begin
                B := TeleRandoms[I].TextBoxes[J];
                Result := (FindTextTPA(TeleRandoms[I].TextColors[J], 0, B.X1, B.Y1, B.X2, B.Y2, TeleRandoms[I].Texts[J], TeleRandoms[I].TextFonts[J], Nothing));
                if (Result) then Break;
              end;
            end;
          end;
        end;
        if (not Result) then Continue;
        InitCompAngle := rs_GetCompassAngleDegrees;
        WriteLn('***** STR: FOUND RANDOM: ''' + Capitalize(TeleRandoms[I].Name) + ''' *****');
        AddToSRLLog('***** STR: FOUND RANDOM: ''' + Capitalize(TeleRandoms[I].Name) + ''' *****');
        TakeScreen('Found ' + Capitalize(TeleRandoms[I].Name) + ' random');
        Players[CurrentPlayer].Rand := Capitalize(TeleRandoms[I].Name);
        if (r_UseRandomTool) then
        begin
          PlaySound(SoundPath);
          CurRandom := I;
          r_RunAlert;
          if (r_CheckAction) then
          begin
            WriteLn('***** STR: ''' + Capitalize(TeleRandoms[i].Name) + ''' RANDOM SOLVED BY HAND! *****');
            AddToSRLLog('***** STR: ''' + Capitalize(TeleRandoms[i].Name) + ''' RANDOM SOLVED BY HAND! *****');
            Players[CurrentPlayer].Rand := '';
            Wait(5000 + Random(2000));
            r_ResetAll;
            Exit;
          end;
          r_ResetAll;
        end;
        ClickNorth(True);
    
        RandResult := False;
        if (TeleRandoms[I].SolveRandom <> nil) and (SolveSRLRandoms) then
          RandResult := TeleRandoms[I].SolveRandom();
        if (RandResult) then
        begin
          WriteLn('***** STR: ''' + Capitalize(TeleRandoms[I].Name) + ''' RANDOM SOLVED SUCCESSFULLY! *****');
          AddToSRLLog('***** STR: ''' + Capitalize(TeleRandoms[I].Name) + ''' RANDOM SOLVED SUCCESSFULLY! *****');
          Inc(RandSolved[TeleRandoms[I].RandIndex]);
          Players[CurrentPlayer].Rand := '';
          Wait(10000 + Random(2000));
        end else
        begin
          WriteLn('***** STR: ''' + Capitalize(TeleRandoms[I].Name) + ''' RANDOM SOLVING FAILED! *****');
          AddToSRLLog('***** STR: ''' + Capitalize(TeleRandoms[I].Name) + ''' RANDOM SOLVING FAILED! *****');
          Inc(RandFailed[TeleRandoms[I].RandIndex]);
          Players[CurrentPlayer].Active := False;
          LogOut;
          while (LoggedIn) do
            Wait(2000);
        end;
        MakeCompass(InitCompAngle);
        Exit;
      end;
    end;
    
    {*******************************************************************************
    function FindNonInventoryRandoms: Boolean;
    by: The SRL Developers Team!... all time sexiness by Mutant
    Description: Searches for the common NON-Inventory randoms: Won't switch to GameTab(4)!
    *******************************************************************************}
    
    function FindNonInventoryRandoms: Boolean;
    var
      I: Byte;
    begin
      for I := 1 to 5 do
      begin
        case I of
          1: Result := SolveTeleportRandoms;
          2: Respond;
          3: Result := FindDead;
          4: Result := RC;
          5: if (SRL_Procs[srl_OnRandomCall] <> nil) then
               SRL_Procs[srl_OnRandomCall]();
        end;
        if (Result) then
        begin
          if (SRL_Procs[srl_OnFindRandom] <> nil) then
            SRL_Procs[srl_OnFindRandom]();
          Break;
        end;
      end;
    end;
    
    {*******************************************************************************
    function FindNormalRandoms: Boolean;
    by: The SRL Developers Team!... all time sexiness by Mutant
    Description: Calls the 'normal' random checks.
    *******************************************************************************}
    
    function FindNormalRandoms: Boolean;
    var
      I: Byte;
    begin
      for I := 1 to 8 do
      begin
        case I of
          1: Result := SolveTeleportRandoms;
          2: Respond;
          3: Result := FindDead;
          4: Result := FindLamp(LampSkill);
          5: Result :=  RC;
          6: Result := FindMod;
          7: if (SRL_Procs[srl_OnRandomCall] <> nil) then
               SRL_Procs[srl_OnRandomCall]();
          8: if High(Players[CurrentPlayer].BoxRewards) > -1 then [LINE 882!!!!!!!!!]<-----
               Result := UseRewardBox;
        end;
        if (Result) then
        begin
          if (SRL_Procs[srl_OnFindRandom] <> nil) then
            SRL_Procs[srl_OnFindRandom]();
          Break;
        end;
      end;
    end;

  4. #4
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    you need tyo add boxrewards to your declareplayers function


    the boxrewards makes it so taht the script knows what to select from the reward boxes from randoms ill find a tut for you

  5. #5
    Join Date
    Oct 2009
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    boxrewards? where do i put it and excactly what do i put plz
    like
    BoxRewards; (right under declareplayers??)
    i dont like tuts but if i have to read one ill do it

  6. #6
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    just put



    Code:
     BoxRewards  := ['XP'];
    in to declareplayers and it sohuld be fine

  7. #7
    Join Date
    Oct 2009
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I put this:
    Code:
     procedure Declareplayers;
     Begin
      BoxRewards  := ['XP'];
    
     HowmanyPlayers := 1;
     NumberOfPlayers(HowManyPlayers);
     CurrentPlayer := 0;
    
     Players[0].Name :='';
     Players[0].Pass :='';
     Players[0].Nick :='';
     Players[0].Active :=True;
    end;
    And I get this:
    Code:
    Line 30: [Error] (20346:1): Unknown identifier 'BoxRewards' in script C:\Program Files\SCAR 3.21\Scripts\MY SCRIPT! SUCK IT.scar
    Also, putting it between procedure declareplayers; and Begin also dont work.
    And as an fyi, in case u aint understand, im talking bout it not workin cause AntiRandoms pops up and im not talkin bout it not logging in just as an Fyi
    Last edited by Zerghunter3000; 10-24-2009 at 09:40 PM. Reason: I WANTED TO BITCH

  8. #8
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    SCAR Code:
    Players[0].BoxRewards := ['XP'];

    is probably what you're looking for.
    :-)

  9. #9
    Join Date
    Oct 2009
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    still opens up AntiRandoms (the script thing) and dont work
    i get this error:
    Code:
    SRL Compiled in 32 msec
    [Runtime Error] : Out Of Range in line 896 in script C:\Program Files\SCAR 3.21\includes\SRL\SRL\Core\AntiRandoms\AntiRandoms.scar
    and here is line 896 in the antirandom thing:
    Code:
          8: if High(Players[CurrentPlayer].BoxRewards) > -1 then

  10. #10
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    SCAR Code:
    procedure DeclarePlayers;//add more if needed
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name      := '';
      Players[0].Pass       := '';
      Players[0].Nick        := '';
      Players[0].Active     := True;    
      Players[0].BoxRewards := ['XP', 'ostume', 'mote', 'Gem', 'ithril', 'oal'];
    end;


    that should work

  11. #11
    Join Date
    Oct 2009
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    still dont work

  12. #12
    Join Date
    Oct 2009
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    it still openz up antirandoms and says error

  13. #13
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    You need to actually call DeclarePlayers inside of your main loop.
    :-)

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
  •