Results 1 to 5 of 5

Thread: Help Me!

  1. #1
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Help Me!

    I'm getting really tired of this script, really fast. It was all, coming along nicely until I found out TPA's weren't working to find the barriers in this script. I want to have more advanced methods of finding objects. Can somebody PLEASE help me out here, I'm desperate.

    Whoever actually finds out my error, gets a reward. [Mods/Admins: If this isn't allowed just tell me.]

    SCAR Code:
    program New;
    {.include SRL\SRL\Misc\Smart.scar}
    {.include srl/srl.scar}
    var
    x, y, i: integer;

    const
      LoadsToDo = 50;
      SmartWorld= 44;  //Smart World?
      SignedC= False;  //Use signed client?
      Team= 'blue';

    Procedure DeclarePlayers;
    begin
      HowManyPlayers:= 1;
      CurrentPlayer:= 0;
      NumberOfPlayers(HowManyPlayers);

      Players[0].Name:= '';
      Players[0].Pass:= '';
      Players[0].Nick:= '';
      Players[0].Active:= True;
    end;

    procedure FindNormalRandom;
    begin
      LampSkill := 'strength';
      if FindNormalRandoms then UseRewardBox;
      solvesrlrandoms:=true;
    end;

    procedure AntiBan;
    begin
      case random(80) of
      0: MouseBox(MSX1, MSY1, MSX2, MSY2,3);
      1: RandomMovement;
      2: RandomRClick;
      3: BoredHuman;
      4: PickUpMouse;
      5: SleepAndMoveMouse(50);
      6: HoverSkill('random', false);
      7: Exit;
      end;
    end;

    function OpenBankChest: boolean;
    var
    tpa : TPointArray;
    begin
      MakeCompass('S');
      SetAngle(True);
      Findcolorstolerance(TPA, 4676201, msx1, msy2, msx2, msy2, 10);
      if Length(tpa) = 0 then FindColorsTolerance(tpa, 8750479, MSX1, MSY1, MSX2, MSY2, 10);
      for i:= 0 to high(tpa) do
      begin
        MMouse(tpa[i].x, tpa[i].y,0,0);
        if IsUpTextMultiCustom(['ank','hest']) then
        begin
          Result := True;
          GetMousePos(x,y);
          Mouse(x, y, 0, 0, True);
          Exit;
        end;
      end;
    end;

    function EnterWaitingRoom: boolean;
    var
    tpa : TPointArray;
    begin
      case (Team) of
      'blue':
      begin
        Findcolorstolerance(TPA, 4935303, msx1, msy2, msx2, msy2, 50);
        if Length(tpa) = 0 then FindColorsTolerance(tpa, 14647666, MSX1, MSY1, MSX2, MSY2, 10);
        for i:= 0 to high(tpa) do
        begin
          MMouse(tpa[i].x, tpa[i].y,0,0);
          if IsUpTextMultiCustom(['lue','arrier']) then
          begin
            Result := True;
            GetMousePos(x,y);
            Mouse(x, y, 0, 0, True);
            Flag;
            if FindBlackChatMessage('non') then
            begin
              Writeln('You cannot take non-combat items to Soul Wars; Terminating.');
              LogOut;
              TerminateScript;
            end;
            if FindNPCChatText('rogress', nothing) then
            begin
              FindNPCChatText('ontinue', ClickLeft);
              Wait(500+random(500));
              FindNPCChatText('nter', ClickLeft);
            end;
            if FindNPCChatText('lmost', nothing) then
            begin
              FindNPCChatText('ontinue', ClickLeft);
              Wait(500+random(500));
              FindNPCChatText('aiting', ClickLeft);
            end;
            if FindNPCChatText('eft', nothing) then
            begin
              Writeln('We cannot continue because you have left your last game.');
              LogOut;
              TerminateScript;
            end;
            Exit;
          end;
        end;
      end;
      'red':
        begin
          Findcolorstolerance(TPA, 4739780, msx1, msy2, msx2, msy2, 10);
          if Length(tpa) = 0 then FindColorsTolerance(tpa, 14803711, MSX1, MSY1, MSX2, MSY2, 10);
          for i:= 0 to high(tpa) do
          begin
            MMouse(tpa[i].x, tpa[i].y,0,0);
            if IsUpTextMultiCustom(['ed','arrier']) then
            begin
              Result := True;
              GetMousePos(x,y);
              Mouse(x, y, 0, 0, True);
              Flag;
              if FindBlackChatMessage('non') then
              begin
                Writeln('You cannot take non-combat items to Soul Wars; Terminating.');
                LogOut;
                TerminateScript;
              end;
              if FindNPCChatText('rogress', nothing) then
              begin
                FindNPCChatText('ontinue', ClickLeft);
                Wait(500+random(500));
                FindNPCChatText('nter', ClickLeft);
              end;
              if FindNPCChatText('lmost', nothing) then
              begin
                FindNPCChatText('ontinue', ClickLeft);
                Wait(500+random(500));
                FindNPCChatText('aiting', ClickLeft);
              end;
              if FindNPCChatText('eft', nothing) then
              begin
                Writeln('We cannot continue because you have left your last game.');
                LogOut;
                TerminateScript;
              end;
              Exit;
            end;
          end;
        end;
      end;
    end;

    procedure WalkToChest;
    begin
      if FindSymbol(x, y, 'bank') then Mouse(x, y, 5, 5, True) else
      if FindSymbol(x, y, 'minigame') then
      begin
        MakeCompass('W');
        Fflag(random(10));
      end;
    end;

    function DetectedCape: boolean;
    begin
      if WearingItem(2) then
      begin
        TakeOff(2);
        Result := True;
      end;
    end;

    function SWRoadColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      R, G, B: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.53, 0.17);

      FindColorsSpiralTolerance(MMCX, MMCY, arP, 6122868, MMX1, MMY1, MMX2, MMY2, 5);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the road color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToRGB(arC[i], R, G, B);

        if (R >= 102) and (R <= 131) and (G >= 96) and (G <= 123) and (B >= 81) and (B <= 104) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 11.37) and (X <= 18.39) and (Y >= 12.02) and (Y <= 19.41) and (Z >= 9.68) and (Z <= 15.58) then
          begin
            Result := arC[i];
            Writeln('RoadColor = ' + IntToStr(arC[i]));
            Break;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
        Writeln('Failed in finding the color.');
    end;

    function FindLavaColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      R, G, B: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.59, 0.38);

      FindColorsSpiralTolerance(MMCX, MMCY, arP, 1749715, MMX1, MMY1, MMX2, MMY2, 3);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the lava color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToRGB(arC[i], R, G, B);

        if (R >= 199) and (R <= 223) and (G >= 150) and (G <= 205) and (B >= 23) and (B <= 29) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 35.04) and (X <= 50.73) and (Y >= 34.47) and (Y <= 58.19) and (Z >= 5.71) and (Z <= 9.61) then
          begin
            Result := arC[i];
            Writeln('Lava Color = ' + IntToStr(arC[i]));
            Break;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
        Writeln('Failed in finding the lava color.');
    end;

    function FindPortalColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      R, G, B: Integer;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.00, 0.00);
      FindColorsSpiralTolerance(MMCX, MMCY, arP, 224, MMX1, MMY1, MMX2, MMY2, 15);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(1, 2);
        Exit;
      end;
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
      for i := 0 to arL do
      begin
        ColorToRGB(arC[i], R, G, B);
        if (R >= 200) and (R <= 254) and (G >= 0) and (G <= 0) and (B >= 0) and (B <= 0) then
        begin
          Result := arC[i];
          Writeln('Portal Color = ' + IntToStr(arC[i]));
          Break;
        end;
      end;
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
      if (i = arL + 1) then
        Writeln('Portal Color Failed.');
    end;

    function ChestWalk: boolean;
    begin
      case (Team) of
      'red': begin RadialWalk(FindPortalColor, 180, 0, 65, -1, -1); MakeCompass('E'); FFlag(random(20)); Result:= True; end;

      'blue': begin RadialWalk(FindPortalColor, 150, 190, 65, -1, -1); MakeCompass('W'); FFlag(random(20)); Result:= True; end;
      end;
    end;

    procedure BankItems;
    begin
      WalkToChest;
      FFlag(random(10));
      Writeln('We have arrived at the banking chest.');
      if OpenBankChest then
      begin
        Writeln('We found the bank chest!');
        wait(5000+random(5000));
        if BankScreen then
        begin
          Writeln('I think we just found the banking screen.');
          DepositAll;
          CloseWindow;
          wait(1000+random(1000));
          MakeCompass('N');
         if (ChestWalk) then Writeln('We have clicked near the portal region.') else
         begin
            Writeln('We couldn''t walk back to the portal area, so we are terminating.');
            Wait(1000+random(500));
            LogOut;
            TerminateScript;
          end;
        end else
        begin
          Writeln('Something went Wrong! We couldn''t find the bankscreen!');
          TerminateScript;
        end;
      end else
      begin
        Writeln('We couldn''t open the bank chest.');
        TerminateScript;
      end;
    end;

    function InRoom: Boolean;
    var
    TPA: TPointArray;
    begin
      case (Team) of
      'blue':
            if not Findcolorstolerance(TPA, FindLavaColor, mmx1, mmy2, mmx2, mmy2, 10) then Result := True;
      'red':
            if not Findcolorstolerance(TPA, FindWaterColor, mmx1, mmy2, mmx2, mmy2, 10) then Result := True;
      end;
    end;

    procedure WalkInRoom;
    begin
      Writeln('We are walking inside the Waiting room');
      case (Team) of
      'red': RadialWalk(FindLavaColor, 270, 280, 65, -1, -1);
      'blue': RadialWalk(FindWaterColor, 270, 280, 65, -1, -1);
      end;
    end;

    begin
      Smart_Server:= (SmartWorld);
      Smart_Members:= True;
      Smart_Signed:= (SignedC);
      Smart_SuperDetail:= false;
      SetupSRL;
      ActivateClient;
      DeclarePlayers;
      LogInPlayer;
      Wait(10000+random(25000));
      SetRun(True);
      repeat
        if (DetectedCape) then BankItems else
        begin
          SetAngle(False);
          case (Team) of
          'red': MakeCompass('W');
          'blue': MakeCompass('E');
          end;
          if (ChestWalk) then Writeln('We have arrived near the WaitingRoom barrier');
        end;
        if (InRoom) then
        begin
          Writeln('We are entering the '+ (Team) +' team.');
          if (EnterWaitingRoom) then WalkInRoom;
        end;
      until (True);
    end.

    PS: I'll have to fix FindLavaColor and every function which uses it before i can test the barrier function.
    Last edited by DeSnob; 08-13-2009 at 09:59 PM.

  2. #2
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Okay:

    SCAR Code:
    Findcolorstolerance(TPA, 4935303, msx1, msy2, msx2, msy2, 50);

    should be:

    SCAR Code:
    Findcolorstolerance(TPA, 4935303, msx1, msy1, msx2, msy2, 50);

    You accidentally switched it around, you need to replace this for both the red and blue gates. Try it now and tell me if it works.

  3. #3
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Let me fix my autocolor, then I'll see it. To be honest, I don't know where my brain is. I keep making these little mistakes.

    EDIT: That did it! Thanks!

    Expect your reward in 1 - 4 weeks.
    If you need, you can PM me to know the status and what your Reward will be.
    Last edited by DeSnob; 08-14-2009 at 04:49 AM.

  4. #4
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by DeSnob View Post
    Let me fix my autocolor, then I'll see it. To be honest, I don't know where my brain is. I keep making these little mistakes.

    EDIT: That did it! Thanks!

    Expect your reward in 1 - 4 weeks.
    If you need, you can PM me to know the status and what your Reward will be.
    Thanks for the offer . But I don't want a reward, I help for the sheer 'high' I get from helping someone, give it to an admin or someone who works hard, they'll appreciate it

  5. #5
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

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
  •