Results 1 to 4 of 4

Thread: Need help with Targetting

  1. #1
    Join Date
    Jan 2011
    Posts
    335
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default Need help with Targetting

    Alright so i've started too look more into scripting,
    I saw home's rangeguild build your own,
    and i looked at the previous working script by kyle.

    I have got it mostly working accept for the targetting the targets, anyone able to help?

    Code:
    program RangeGuilder;
      {$DEFINE SRL5}
      {$DEFINE SMART}
    
      {$i SRL/srl.simba}
      {$i SRL/SRL/misc/paintsmart.simba}
    
    const
      SRLStatsUserName = '';
      SRLStatsPassword = '';
    
    var
      maxGames, startupTickets, totTickets, totGames : Integer;
    
    procedure DeclarePlayers();
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      with Players[0] do
      begin
        Name        := '';              // Your RuneScape Account Name
        Pass        := '';              // Your RuneScape Account Password
        Active      := True;            // Use in the Script. True / False.
        Integers[0] := 5;               // How many times to compete
        Strings[0]  := 'Rune Arrows';   // What item to get with tickets
      end;
    end;
    
    procedure AntiRandoms;
    begin
      if (not(LoggedIn)) then
        Exit;
      WriteLn('Checking for AntiRandoms');
      FindNormalRandoms;
      srl_InFight;
    end;
    
    function CalculateGameCount(): Integer;
    var
      coinAmt, x, y, i : Integer;
    begin
      if not Gametab(tab_Inv) then
        Gametab(tab_Inv);
    
      if FindCoins(x, y, 'inv') then
      begin
        i := CoordsToItem(x, y);
        WriteLn('Found coins in Inventory Slot #' + IntToStr(i));
    
        coinAmt := GetAmountBox(InvBox(i));
        Result := (coinAmt / 200);
      end else
      begin
        WriteLn('Couldn''t find coins in the inventory!');
        WriteLn('Terminating the script!');
        TerminateScript();
      end;
    end;
    
    function CountTickets(): Integer;
    var
      x, y, i, ticketAmt : Integer;
    begin
      if FindColorTolerance(x, y, 5867118, MIX1, MIY1, MIX2, MIY2, 5) then
      begin
        i := CoordsToItem(x, y);
        WriteLn('Found Archer Tickets in Inventory Slot #' + IntToStr(i));
    
        ticketAmt := GetAmountBox(InvBox(i));
        startupTickets := ticketAmt;
    
        Result := ticketAmt;
      end else
        WriteLn('Did not find Archer Tickets in Inventory.');
    end;
    
    function FindJudge(var rx, ry : Integer) : Boolean;
    var
      TPA    : TPointArray;
      I, CTS : Integer;
      ATPA   : T2DPointArray;
      o      : TPoint;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.00, 0.03);
      FindColorsTolerance(TPA, 7235945, MSX1, MSY1, MSX2, MSY2, 9);
      ColorToleranceSpeed(CTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
      if(Length(TPA) = 0)then
      begin
        WriteLn('FindJudge could not find any points.');
        Exit;
      end;
      SortTPAFrom(TPA, Point(MSCX, MSCY));
      ATPA := TPAToATPA(TPA, 15);
      for I := 0 to High(ATPA) do
      begin
        o := MiddleTPA(ATPA[i]);
        MMouse(o.x, o.y, 3, 3);
        if(WaitUptext('Judge', RandomRange(250, 750)))then
        begin
          Result := True;
          GetMousePos(rx, ry);
          Exit;
        end;
      end;
    end;
    
    procedure SetupScript();
    begin
      MakeCompass('N');
      SetAngle(SRL_ANGLE_HIGH);
      SetRun(True);
      Wait(RandomRange(1000, 1750));
      maxGames := CalculateGameCount();
      WriteLn('You can play a total of ' + IntToStr(maxGames) + ' games!');
      totTickets := CountTickets();
      WriteLn('You have ' + IntToStr(totTickets) + ' tickets');
    end;
    
    function CompeteJudge() : Boolean;
    var
      x, y, BronzeArrowsBmp : Integer;
    begin
      Wait(RandomRange(500, 750));
      WriteLn('Locating Judge...');
    
      if FindJudge(x, y) then
      begin
        AntiRandoms();
        WriteLn('Judge located, attempting to compete...');
        Mouse(x, y, 3, 3, False);
        Wait(RandomRange(500, 750));
        ChooseOption('Compete');
        WriteLn('Talked to Judge.');
        Wait(RandomRange(1000, 1250));
        MouseBox(247, 392, 274, 405, 1);
        Wait(RandomRange(400, 750));
        ClickToContinue();
        Wait(RandomRange(500, 750));
        AntiRandoms();
    
        BronzeArrowsBmp := BitmapFromString(10, 33, 'meJytUssKwjAQDCsigg+qFbFQqF' +
            'poEYWeLCheFC/ePHjx4B/5zy4duuRVwUcIZTKzM7slUerXRT5M9Td' +
            'cbIRkDBCt90xO0iKIM6rKgKEuD1feo2Q1mM2pOgJDzU73pLxM8y1v' +
            'qMBQW8Oom5/JnArL4hkUu6OobCSnGGVNgVBh1IuVYwRpdRcjyrwdG' +
            'bj5/zJa6kdG+SOvUQbzGkG+N/bHD95NRpbandQ1YiTdiBxdDeMnjC' +
            'JJLz0KpEjKjKI6Si7UilLmgxGVx3YfUi+4MemVlHYRX6wXd5Uwgw==');
    
        WriteLn('Looking for arrows...');
    
        if FindBitmapToleranceIn(BronzeArrowsBmp, x, y, MIX1, MIY1, MIX2, MIY2, 10) then
        begin
          Wait(RandomRange(500, 750));
          WriteLn('We have the arrows! Equiping...');
          Mouse(x, (y + 10), 2, 2, True);
          WriteLn('Arrows equipped!');
          Result := True;
        end;
    
        FreeBitmap(BronzeArrowsBmp);
        AntiRandoms();
      end;
    end;
    
    function FindTargets(var rx, ry : Integer) : Boolean;
    var
      TPA    : TPointArray;
      I, CTS : Integer;
      ATPA   : T2DPointArray;
      o      : TPoint;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.05, 0.54);
      FindColorsTolerance(TPA, 11300959, MSX1, MSY1, MSX2, MSY2, 1);
      ColorToleranceSpeed(CTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
      if(Length(TPA) = 0)then
      begin
        WriteLn('FindTargets could not find any points.');
        Exit;
      end;
      SortTPAFrom(TPA, Point(MSCX, MSCY));
      ATPA := TPAToATPA(TPA, 15);
      for I := 0 to High(ATPA) do
      begin
        o := MiddleTPA(ATPA[i]);
        MMouse(o.x, o.y, 3, 3);
        if(WaitUptext('arget', RandomRange(250, 750)))then
        begin
          Result := True;
          GetMousePos(rx, ry);
          Exit;
        end;
      end;
    end;
    
    function RandomRangeEx(rFrom, rTo : Variant) : Variant;
    var
      r  : Variant;
    begin
      r := RandomRange(Floor(rFrom), Ceil(rTo));
      r := r + RandomE;
    
      repeat
        begin
          if r <= rFrom then
            r := r + RandomE
          else if r >= rTo then
            r := r - RandomE;
        end;
      until ((r >= rFrom) and (r <= rTo))
    
      r := (Trunc(r * 100) / 100.00)
    
      Result := r;
    end;
    
    function ShootTargets() : Boolean;
    var
      x, y, i : Integer;
      bClicked : Boolean;
    begin
      AntiRandoms();
      Wait(RandomRange(500, 750));
      WriteLn('Locating Targets...');
    
      SetAngle(SRL_ANGLE_HIGH);
      MakeCompass(36.87 + RandomRangeEx(-1.75, 1.75));
      Wait(RandomRange(1000, 1250));
    
      if FindTargets(x, y) then
      begin
        AntiRandoms();
        WriteLn('Targets found!');
        Wait(RandomRange(500, 1000));
        MMouse(x, y, 3, 3);
        Wait(RandomRange(750, 1250));
        WriteLn('Spam firing at targets');
        repeat
          ClickMouse2(True);
          Inc(I);
          bClicked := ClickToContinue();
          if(bClicked)then
            Break;
        until((i >= 75));
        Inc(totGames);
        Result := bClicked;
        AntiRandoms();
      end;
    end;
    
    procedure GetTickets();
    var
      x, y, i : Integer;
    begin
      Wait(RandomRange(500, 750));
      WriteLn('Locating Judge...');
    
      if FindJudge(x, y) then
      begin
        WriteLn('Judge located, attempting to get tickets...');
        Mouse(x, y, 3, 3, True);
        Wait(RandomRange(500, 750));
        ClickToContinue();
        WriteLn('Got the tickets!');
    
        if FindColor(x, y, 5867118, MIX1, MIY1, MIX2, MIY2) then
        begin
          i := CoordsToItem(x, y);
          totTickets := GetAmountBox(InvBox(i));
          WriteLn('You now have ' + IntToStr(totTickets) + ' tickets!');
        end;
      end;
    end;
    function WalkToTrader() : Boolean;
    begin
      AntiRandoms();
      MakeCompass('N');
      SetAngle(SRL_ANGLE_HIGH); ;
      MouseBox(584, 35, 602, 52, 1);
      Wait(RandomRange(7500, 8500));
      Result := True;
      AntiRandoms();
    end;
    function WalkToJudge() : Boolean;
    begin
      AntiRandoms();
      MakeCompass('N');
      SetAngle(SRL_ANGLE_HIGH);
      MouseBox(671, 134, 680, 139, 1);
      Wait(RandomRange(7500, 8500));
      Result := True;
      AntiRandoms();
    end;
    procedure EndScript(reason : string);
    begin
      WriteLn('Could not ' + reason + '. Please make a post on the thread about the issue.');
      CompeteJudge();
    end;
    
    begin
      VersionCheck();
      SMART_Members := True;
      SMART_Signed  := True;
      SetupSRL();
      SetupSRLStats(222, SRLStatsUserName, SRLStatsPassword);
      SRLRandomsReport;
      ClearDebug();
      ActivateClient();
      DeclarePlayers();
      LoginPlayer();
      SetupScript();
      Wait(RandomRange(750, 1250));
      repeat
        if (CompeteJudge()) then
        begin
          Wait(RandomRange(750, 1250));
          if (ShootTargets()) then
          begin
            Wait(RandomRange(750, 1250));
          end else
            EndScript('fire at targets');
        end else
          EndScript('start competition');
    
      until((totGames >= Players[CurrentPlayer].Integers[0]) or (totGames >= maxGames));
      WriteLn('Thanks for running! Please post your progress reports! :)');
      TerminateScript;
    end.
    If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly.

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

    Default

    Wrong section.
    + why not just post in Home's thread? He said you could ask for help there..

    -Boom

  3. #3
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Lol, that's mostly my script with Home's functions added.
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  4. #4
    Join Date
    Jan 2011
    Posts
    335
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    Quote Originally Posted by Kyle Undefined View Post
    Lol, that's mostly my script with Home's functions added.
    I'll attempt on home's more now then post in his thread lol ^^.
    If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly.

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
  •