Results 1 to 8 of 8

Thread: AntiRandoms.scar

  1. #1
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default AntiRandoms.scar

    Hey I think this should be the new
    UseRewardBox
    Because the old one didnt work.
    quote by cause ^^

    so here what I came up with.
    Prob wrong but hey, it needed fixing so I tried

    SCAR Code:
    //-----------------------------------------------------------------//
    //--               Scar Standard Resource Library                --//
    //--               ยป AntiRandom Routines                         --//
    //-----------------------------------------------------------------//
    // * procedure SRLRandomsReport;                      // * by Starblaster100
    // * function FindBoxOption(var Box: TBox): Boolean;  // * by Nava2
    // * function UseRewardBox: Boolean;                  // * by Nava2 Edited by The Man
    // * 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: Integer;
        IsInRandom, SolveRandom: function: Boolean;
        Texts: TStringArray;
        TextColors: TIntegerArray;
        TextFonts: TIntegerArray;
        TextBoxes: array of TBox;
        RandIndex: Integer;
      end;

    var
      TeleRandoms: array of TTeleRandom;
      SolveSRLRandoms: Boolean;

    {*******************************************************************************
    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('|       [url]www.villavu.com[/url]        |');
      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): Boolean;
    var
      x, y, H, L, II, i, LL, Col: Integer;
      Text, TPA, xTPA: TPointArray;
      ATPA: T2DPointArray;
      Scroll: Boolean;
      P: TPoint;
    begin
      Result := False;
      Box := IntToBox(-1, -1, -1, -1);
      L := High(Players[CurrentPlayer].BoxRewards);
      Scroll := (GetColor(385, 70) = 657930);
      for II := 0 to L + 1 do
      begin
        if not LoggedIn then Exit;

        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);
    end;

    {*******************************************************************************
    procedure UseRewardBox: Boolean;
    by: Nava2 Edited by The Man
    Description: Finds the reward box, and opens it getting the reward.
    *******************************************************************************}


    function UseRewardBox: Boolean;
    var
      I, Time, Height: Integer;
      Text, TPA: TPointArray;
      B: TBox;
      fx, fy: Integer;
      bDTM: Integer;
      X, Y, RandomBox: Integer;
    begin
      Result := False;
      if not LoggedIn then Exit;
      GameTab(4);
      Wait(500 + Random(500));
      if (not(FindColorTolerance(fX, fY, 7280034, MIX1, MIY1, MIX2, MIY2, 20))) then Exit;
      bDTM := DTMFromString('78DA634C626660B8C4C8800C568B963070006' +
                            '990E87F20608C04AA398EAA06220B23813448CD65026A0A816AAE' +
                            '12A1E62401359940351751D5DC889782BB19AC2619A8E6087E730' +
                            '0776A0F22');
      for I := 1 to 28 do
      begin
        B := InvBox(I);
        if FindItemEx(fx, fy, 'dtm', bDTM, B, []) then
        begin
          MMouseItem(I);
          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) then
      begin
        SRL_Warn('UseRewardBox', 'Could not find a usable option.', Warn_AllVersions);
        Exit;
      end;
      MouseBox(B.x1, B.y1, B.x2, B.y2, 1);
      Time := GetTimeRunning + 1000;
      Result := False;
      while (not Result) and (GetTimeRunning < Time) do
      begin
        FindColorsTolerance(TPA, 1317148, B.x1,  B.y1, B.x2, B.y2, 3);
        Result := Length(TPA) > 50;
      end;
     if Result then
      begin
        RandomBox := BitmapFromString(7, 10, 'beNpjYPB0MIGg/zPkgQjO' +
           'hYgASQYGBrg4XATChTCAgnARZL1UF4Q7AJmB5ngGAM1POqg=');
        if(FindBitmapToleranceIn(RandomBox, X, Y, 0, 0, 100, 100 , 20)) then
          MouseBox(X, Y, X + 7, Y + 10, 1);
    end;
      if not Result then
      begin
        CloseWindow;
        Exit;
      end;
      Mouse(393, 166, 77, 39, True);
    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;
    var
      CurTab: Byte;
    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 then
        begin
          CurTab := GetCurrentTab;
          Result := (HpPercent < 100);
          GameTab(CurTab);
          if not Result then exit;
        end;

        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(4);
      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, 1, 1, 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;
          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 := [2, 8];
      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 := @SolveLeo;
        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 := 'null and void';//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 := @InAbyss;
        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;

    {*******************************************************************************
    function SolveTeleportRandoms: Boolean;
    by: ZephyrsFury
    Description: Handles the solving of Teleport randoms. Returns True if one is
      detected.
    *******************************************************************************}


    function SolveTeleportRandoms: Boolean;
    var
      TypeID, H, 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
              for J := 0 to High(TeleRandoms[I].Texts) 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);
        SetAngle(True);
        MakeCompass('N');

        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);
        SetAngle(True);
        Exit;
      end;
    end;

    {*******************************************************************************
    function FindNonInventoryRandoms: Boolean;
    by: The SRL Developers Team!... all time sexiness by Mutant
    Description: Searches for the common NON-Inventory randoms: Wont switch to GameTab(4)!
    *******************************************************************************}


    function FindNonInventoryRandoms: Boolean;
    var
      Int: Integer;
    begin
      for Int := 1 to 5 do
      begin
        case Int 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
      Int: Integer;
    begin
      for Int := 1 to 8 do
      begin
        case Int 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
               Result := UseRewardBox;
        end;
        if Result then
        begin
          if (SRL_Procs[srl_OnFindRandom] <> nil) then
            SRL_Procs[srl_OnFindRandom]();
          Break;
        end;
      end;
    end;

    T~M
    Last edited by Dynamite; 06-23-2009 at 02:00 AM.

  2. #2
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

  3. #3
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Really?
    hmm, well it didnt work for other people. Also I done completely wrong I will repost

    T~M

  4. #4
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Fixed

    T~M

  5. #5
    Join Date
    Mar 2007
    Location
    <3
    Posts
    2,683
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What caused the problem in the first place?

  6. #6
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    There was a compiling issue which I just fixed..

    Was there anything else wrong?

    Not to mention, all you did was post an old version..
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  7. #7
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    In UseRewardBox I added
    SCAR Code:
    if Result then
      begin
        RandomBox := BitmapFromString(7, 10, 'beNpjYPB0MIGg/zPkgQjO' +
           'hYgASQYGBrg4XATChTCAgnARZL1UF4Q7AJmB5ngGAM1POqg=');
        if(FindBitmapToleranceIn(RandomBox, X, Y, 0, 0, 100, 100 , 20)) then
          MouseBox(X, Y, X + 7, Y + 10, 1);
    end;
    Because apparently before it just chose the reward then closed the window, so I made it click confirm choice.

    T~M

  8. #8
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Its been fixed, see the other thread in this forum.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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