Results 1 to 5 of 5

Thread: [EOC] JD Vials

  1. #1
    Join Date
    Mar 2013
    Location
    Shaolin
    Posts
    863
    Mentioned
    24 Post(s)
    Quoted
    519 Post(s)

    Lightbulb [EOC] JD Vials

    JDscripts presents: JD Vials!
    Progress Report:
    +++++++++++++  JD VIALS   ++++++++++++
    + Time Running:3 Hours, 3 Minutes and 31 Seconds
    + Vials Filled: 4340
    ++++++++++++++++++++++++++++++++++++++

    For the moment I'm sticking with Edgeville, but will soon have GE and Varrock East.
    I was going for a 6hr, but accidentally turned it off instead of pausing it for a break.

    Still in early stages of development, but it works, and it works well.

    Features:
    - Failsafes
    - TPA Banker finding functions (Sometimes fails first try, but almost always succeeds the 2nd time)
    - Progress report (not super accurate but hey its a progress report)
    - Quick well recognition (TPA was being dumb so I whipped up a FindObj to find it in 1 second)

    Enjoy, and bot responsibly in these hard times.

    JDvialsee.simba
    You have permission to steal anything I've ever made...

  2. #2
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    Quote Originally Posted by Joseph D View Post
    JDscripts presents: JD Vials!
    Progress Report:
    +++++++++++++  JD VIALS   ++++++++++++
    + Time Running:3 Hours, 3 Minutes and 31 Seconds
    + Vials Filled: 4340
    ++++++++++++++++++++++++++++++++++++++

    For the moment I'm sticking with Edgeville, but will soon have GE and Varrock East.
    I was going for a 6hr, but accidentally turned it off instead of pausing it for a break.

    Still in early stages of development, but it works, and it works well.

    Features:
    - Failsafes
    - TPA Banker finding functions (Sometimes fails first try, but almost always succeeds the 2nd time)
    - Progress report (not super accurate but hey its a progress report)
    - Quick well recognition (TPA was being dumb so I whipped up a FindObj to find it in 1 second)

    Enjoy, and bot responsibly in these hard times.

    JDvialsee.simba
    Gratz on the release i was gonna release once since we didnt have one. But you did it first! :P

    Pots of flour would be something to add. Withdraw 14, use on water source, choose which dough to make (pastry most likely), then bank and repeat. I have 610k flour. thats why i was gonna make one ha

  3. #3
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Not bad, not bad, I like how it's not over complicated

  4. #4
    Join Date
    Mar 2013
    Location
    Shaolin
    Posts
    863
    Mentioned
    24 Post(s)
    Quoted
    519 Post(s)

    Default

    Quote Originally Posted by Officer Barbrady View Post
    Not bad, not bad, I like how it's not over complicated
    Well its in early stage. Right now I'm trying to pump some scripts out, get feedback, and update with that feedback. Right now I've moved onto a crafting guild script.
    You have permission to steal anything I've ever made...

  5. #5
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

    Default

    I tried it, It didnt peform very human like what so ever i must say, things needed to be ironed out before long use:
    - If it misses the Well the first time, it goes back to the bank (but first clicks on the bottom rightish of the well?)
    - Its continulusly seatching for the bank while the player hasnt stopped moving, to over come this, Have a TPA that finds all the colors ect, and after 1 go, re call the search, as it will over come your issues of missing.
    - Have the counter acctually count Water Filled Vials. Use DTM's for this.
    - The Walking to well, seems to be clicking the exact spot continuously.
    - It just looks incredibly botty, If i were to do this manually it would be completely I wouldnt do it like this.

    Also you can save time by:
    - While walking click the vial so by the time you stop you can already click the well.

    I have made Vial filler/clayer script back in the day, It did run very human like, and had features i mentioned above, please refer to the script and improve on yours, cause this is why people get banned.

    Simba Code:
    program New;

    {$DEFINE SMART}
    {$DEFINE USEREFLECTION}
    {$i srl\srl.scar}
    {$i reflection\reflection.simba}


    {
    [==============================================================================]
    [= *IMPORTANT* -           Read before running script!          - *IMPORTANT* =]
    [==============================================================================]
    [= When setting up your characters make sure you set the Strings[0] correctly =]
    [=                                                                            =]
    [=          LIST OF SCRIPT OPTIONS: STRINGS[0]                                =]
    [=                        - 'w bucket' = Water fill buckets ONLY              =]
    [=                        - 'w vial' = Water fill vials ONLY                  =]
    [=                        - 'bucketclay' = Fill buckets then soften the clay  =]
    [=                        - 'claying' = Watering clay ONLY                    =]
    [=                                                                            =]
    [=      The script has an inbuilt function to check whether you set this      =]
    [=              this string correctly, if you havent script will              =]
    [=             terminate, showing you the characters which failed.            =]
    [==============================================================================]
    [= Instructions -                                                             =]
    [=   1. Fill in the declareplayers                                            =]
    [=   2. If using SMART press script and relax if not continue to read on      =]
    [=   3. IF not using SMART, drag the cross hair into the RS Client.           =]
    [=   4. Press play!                                                           =]
    [=                                                                            =]
    [= NOTE* Have supplies in the top of your bank visible when script opens it!  =]
    [=                                                                            =]
    [= Enjoy, BobboHobbo.                                                         =]
    [==============================================================================]
    }

    const
      UseReflection = true;
      Smart_ServerBH = 108;
      //Smart world.
      Smart_SignedBH = true;
      //Smart Signed.

    procedure DeclarePlayers;
    begin
      NumberOfPlayers(1);
      CurrentPlayer := 0;
      with Players[0] do
      begin
        Name := '';
        Pass := '';
        Nick := '';
        Active := True;
        Integers[0] := 723;
        //Loads.
        Strings[0] := 'bucketclay';
        //w bucket - water fill buckets
        //bucketclay - Water fill buckets then wet the clay.
        //claying - watering the clay ONLY.
        //w vial - water fill empty vials.
        Pin := '';
        //Bank Pin.
      end;
     { with Players[1] do
      begin
        Name := '';
        Pass := '';
        Nick := '';
        Active := True;
        Integers[0] := 15;
        Strings[0] := 'bucketclay';//Loads.
        Pin := '0';//Bank Pin.
      end;

      with Players[2] do
      begin
        Name := '';
        Pass := '';
        Nick := '';
        Active := True;
        Integers[0] := 0;//Loads
        Pin := '0'; //Bank Pin.
      end;
      }

    end;

    var
      clay, x, y, banked, gained, BankDTM, bankedd: integer;
      JustClaying, HasWaterBuckets: boolean;
      WalkAngle: Extended;

    type
      TFill = record
        Uptext, Description: TStringArray;
        DTM, WetDTM, Outcome: integer;
      end;

    var
      Equipment: TFill;

    const
      BSx1 = 23;
      //Bankscreen Cords.
      BSy1 = 89;
      BSx2 = 478;
      BSy2 = 291;

    function Banking: boolean; forward;

    function SetRunBH(Run: Boolean): Boolean;
    var
    cx,cy:integer;
    Begin
       Result := not FindColorTolerance(cx,cy,6740459, 720,109, 726, 113,10) and (Run) or FindColorTolerance(cx,cy,6740459, 720,109, 726, 113,10) and not(Run);
       If Result then
         Mouse(715, 95, 10, 10, True);
    End;

    function LoggedInFailsafe: Boolean;
    var
      I: Integer;
    begin
      Result := LoggedIn;
      if not (Result) then
      begin
        for I := 1 to 10 do
        begin
          if (RSReady) then
            exit;
          Wait(500);
          if (LoggedIn) then
          begin
            Result := true;
            exit;
          end;
        end;
      end;
    end;

    procedure DebugMe(Location, TheWriteln: string);
    begin
      writeln(TheTime + ' : ' + TheWriteln);
      Players[CurrentPlayer].Loc := Location;
    end;

    function FindRandoms: boolean;
    var
      rx, ry: integer;
    begin
        {$IFDEF USEREFLECTION}
        If UseReflection then
          R_Findrandoms;
            {$ENDIF}
        FindNormalRandoms;
    end;

    function Antiban:boolean;
    var
    i:integer;
    begin
    If UseReflection then
    begin
      Case (Random(50)) of

       9: begin
           if not LoggedIn then exit;
           for i := 1 to (3 + Random(11)) do
           begin
             case Random(6) of
             0: SendArrowWait(((Random(2) * 2) + 1), 1000 + Random(200));
             1: SendArrowWait(((Random(2) * 2)), 1000 + Random(200));
             2: SendArrowWait(((Random(2) * 2) + 1), 200 + Random(200));
             3: SendArrowWait(((Random(2) * 2)), 200 + Random(200));
             4: SendArrowWait(((Random(2) * 2) + 1), 20 + Random(20));
             5: SendArrowWait(((Random(2) * 2)), 20 + Random(20));
            end;
           end;
           end;
       1: RandomRClick;
      end;
    end;
    end;


    function LoadDTM(TheDTM: string): integer;
    var
      TheDTMTemp: integer;
    begin
      case LowerCase(TheDTM) of
        'bucket': TheDTMTemp :=DTMFromString('78DA637460626078CC8002BCADC419B880342' +'310FF0702462BA09AB70C6880094C3242798C5E40FE7B026A7C30' +'EDC2506309E43FC2AF060015940A8C');
        'wbucket': TheDTMTemp := DTMFromString('78DA63CC66626078C480024A4ADA192481342' +'310FF0702C614A09AB70C6880094C3242798C2540FE7B026ACA80' +'FCBBF8D5000044980AEF');
        'clay': TheDTMTemp := DTMFromString('78DA637460626078C18002BA4A7C192481342' +'310FF0702466BA09A270C6880094C3242798CF640FE1B026A3C80' +'FCE7F8D50000F5780A18');
        'wclay': TheDTMTemp := DTMFromString('78DA633CC8C4C010C4C8800C426CB91924813' +'448F43F10306E01AA094155C3C0C0042661A28C4781FC68026ACE' +'03F97EF8D5000091240924');
        'vial': TheDTMTemp := DTMFromString('78DA63CC61626078C1800262631319B880342' +'310FF0702C664A09A770C6880094C3242798C6544A82900F21F11' +'50930EE43FC1AF0600C01C0BE4');
        'wvial': TheDTMTemp := DTMFromString('78DA637466626078C98002B20B17327001694' +'620FE0F048C964035EF18D00013986484F218BD80FC0F04D4B801' +'F98F09A8B123AC0600A6A30B77');
        'bank': TheDTMTemp := DTMFromString('78DA63CC646260886500036608C5F0E70F139' +'8CD08C4FF8180310FA8260EB71A10602C22424D19116AAA885053' +'87DFCD20000028B714FE');
        else
          exit;
      end;
      Result := TheDTMTemp;
    end;

    function LoadEquipment(which: string): TFill;
    begin
      case lowercase(which) of
        'claying':
          with Result do
          begin
            //  Item := 'Wet Clay';
            UpText := [''];
            DTM := LoadDTM('wbucket');
            WetDTM := LoadDTM('wclay');
            Description := ['Softended', 'Clay[s]', 'Claying'];
          end;
        'w bucket':
          with Result do
          begin
            //    Item := 'Water Filled Bucket';
            UpText := ['ket'];
            DTM := LoadDTM('bucket');
            WetDTM := LoadDTM('wbucket');
            Description := ['Filled', 'bucket[s] with water', 'Filling'];
          end;
        'bucketclay':
          with Result do
          begin
            //  Item := 'Wet Clay';
            UpText := ['ket'];
            DTM := LoadDTM('bucket');
            WetDTM := LoadDTM('wbucket');
            Description := ['Softended', 'Clay[s] with bucket water', 'Claying/Filling'];
          end;
        'w vial':
          with Result do
          begin
            // Item := 'Water Filled Vial';
            UpText := ['Via'];
            DTM := LoadDTM('Vial');
            WetDTM := LoadDTM('wvial');
            Description := ['Filled', 'Vials with water', 'Filing'];
          end;
      end;
    end;

    function MFNFEx(ax, ay, xmod, ymod, ranx, rany, Flag: Integer): Boolean;
    var
      TT, i, xx, yy: Integer;
    begin
      Result := False;
      if (not LoggedInFailsafe) then
        Exit;
      xx := ax - xmod;
      yy := ay - ymod;
      for i := 0 to 4 do
      begin
        xx := xx + xmod;
        yy := yy + ymod;
        if rs_OnMiniMap(xx, yy) then
          Mouse(xx + Random(ranx), yy - Random(rany), 2, 2, True)
        else
          Continue;
        Wait(50);
        MarkTime(TT);
        repeat
          if (FlagPresent) then
          begin
            Result := True;
            FFlag(Flag);
            Exit;
          end;
          Wait(10 + Random(100));
        until TimeFromMark(TT) > 3000;
      end;
    end;

    function MissingEquipment: boolean;
    var
      xx, yy: integer;
    begin
      Gametab(Tab_inv);
      case Players[CurrentPlayer].Strings[0] of
        'bucketclay', 'claying':
          begin
            if not FindDTM(Clay, x, y, MIx1, MIy1, MIx2, MIy2) and not FindDTM(Equipment.DTM, xx, yy, MIx1, MIy1, MIx2, MIy2) then
              Result := true;
          end;
        'w vial', 'w bucket':
          begin
            if not FindDTM(Equipment.DTM, x, y, MIx1, MIy1, MIx2, MIy2) then
              Result := true;
          end;
      end;
    end;

    function CheckAllPlayers: boolean;
    var
      I: integer;
    begin
      for I := 0 to HowManyPlayers - 1 do
      begin
        case Players[I].Strings[0] of
          'w bucket', 'w vial', 'bucketclay', 'claying', 'claying', 'bucketclay': Result := true;
        end;
        if not (Result) then
          Writeln('Player: ' + Players[I].Name + ' has an invalid Strings[0], please check top of script for details. ');
      end;
      if not (Result) then
        terminatescript;
    end;

    function PlayerSetup: boolean;
    var
      Cp:integer;
    begin
      Players[CurrentPlayer].Strings[0] := Lowercase(Players[CurrentPlayer].Strings[0]);
      Equipment := LoadEquipment(Players[CurrentPlayer].Strings[0]);
      BankDTM := LoadDTM('bank');
      case Players[CurrentPlayer].Strings[0] of
        'claying', 'bucketclay': Clay := LoadDTM('clay');
      end;
      CheckAllPlayers;
      if (Players[CurrentPlayer].Strings[0] = 'claying') then
        JustClaying := True;
        CP := Random(2);
       If UseReflection then
         If (CP >= 1) then
           MakeCompass('E')
             else
            MakeCompass('W');
      if not Usereflection then
        ClickNorth(True);
      if (MissingEquipment) then
        banking;
      SetAngle(true);
    end;

    function MouseOption(var qx, qy: integer; amount: string): boolean;
    begin
      Result := true;
      Mouse(qx, qy, 5, 5, false);
      if (WaitOption('-' + amount, 200)) then
        Exit;
      Mouse(qx, qy, 5, 5, false);
      WaitOption('-X', 300);
      if WaitColor(215, 399, 0, 1, 4500) then
        TypeSend(Amount);
      if not WaitInvMinCount(1, 5000) then
        Result := false;
    end;

    function CountDTM(DTM: Integer): Integer;
    var
      i, x, y: Integer;
      TB: Tbox;
    begin
      GameTab(Tab_Inv);
      for i := 1 to 28 do
      begin
        TB := InvBox(i);
        if ExistsItem(i) then
          if FindDTM(DTM, x, y, TB.x1, TB.y1, TB.x2, TB.y2) then
            Inc(Result);
      end;
    end;

    function OpenBankNPCFast: Boolean;
    var
      bx, by, Speed, ColFace, ColGrey, ColBlue, c: Integer;
    begin
      DebugMe('In bank', 'Searching for banker');
      wait(500 + random(200));
      Speed := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      ColFace := 1665463;
      // Face Color
      ColGrey := 2705755;
      // Grey Color [ Clothes ]
      ColBlue := 2889760;
      // Blue Color [ Clothes ]
      FFlag(0);
      if (FindObjThroughMM(bx, by, 'npc', [ColFace, ColBlue, ColGrey], [5, 5, 5], ['anke', 'to B', 'Banker', 'nker'], 2, 2)) then
      begin
        Mouse(bx, by, 0, 0, False);
        if WaitOption('ank B', 300) then
        begin
          FFLag(0);
          MarkTime(c);
          repeat
            Wait(100);
          until (BankScreen) or (PinScreen) or (TimeFromMark(c) > 3000);
          Wait(Random(300));
          if (Players[CurrentPlayer].Pin <> '') then
            InPin(Players[CurrentPlayer].Pin);
          Result := (BankScreen) or (PinScreen);
        end;
      end;
      ColorToleranceSpeed(Speed);
    end;

    function Banking: boolean;
    var
      xx, yy, tempclay, BankTries, Timer: integer;
    begin
      if not (LoggedInFailsafe) then
        exit;
      Result := false;
      DebugMe('At Bank', 'Searching for bank...');
      repeat
      If BankTries > 1 then
        setangle(true);
        Inc(BankTries);
        if (R_OpenBankBooth('veb')) then
        begin
          DebugMe('At Bank', 'Depositing the outcome, and retrieving the materials');
          if (Players[CurrentPlayer].Strings[0] = 'bucketclay') or (Players[CurrentPlayer].Strings[0] = 'claying') then
          begin
            TempClay := LoadDTM('wclay');
            IncEx(Gained, CountDTM(TempClay));
            IncEx(Players[CurrentPlayer].Integers[2], CountDTM(TempClay));
            FreeDTM(TempClay);
          end
          else
          begin
            IncEx(Gained, CountDTM(Equipment.WetDTM));
            IncEx(Players[CurrentPlayer].Integers[2], CountDTM(TempClay));
          end;
          Fixbank;
          DepositAll;
          case Players[CurrentPlayer].Strings[0] of
            'claying', 'bucketclay':
              begin
                TimeFromMark(Timer);
                repeat
                if FindDTM(Clay, x, y, BSx1, BSy1, BSx2, BSy2)and FindDTM(Equipment.WetDTM, xx, yy, BSx1, BSy1, BSx2, BSy2) then
                  begin
                    MouseOption(x, y, '14');
                    wait(300 + random(300));
                    if MouseOption(xx, yy, '14') then
                      Result := true;
                    HasWaterBuckets := true;
                  end;
                until((Result) or (TimeFromMark(Timer) > 5000));
                If not result then
                begin
                 TimeFromMark(Timer);
                repeat
               if FindDTM(Clay, x, y, BSx1, BSy1, BSx2, BSy2)and FindDTM(Equipment.DTM, xx, yy, BSx1, BSy1, BSx2, BSy2) then
                  begin
                    MouseOption(x, y, '14');
                    wait(300 + random(300));
                    if MouseOption(xx, yy, '14') then
                      Result := true;
                  end;
                until((Result) or (TimeFromMark(Timer) > 5000));
                end;
              end;
            'w vial', 'w bucket':
              begin
                TimeFromMark(Timer);
                repeat
                  if FindDTM(Equipment.DTM, x, y, BSx1, BSy1, BSx2, BSy2) then
                  begin
                    MouseOption(x, y, '28');
                    wait(1000 + random(500));
                    Result := true;
                  end;
                until((Result) or (TimeFromMark(Timer) > 5000));
              end;
          end;
        end;
      until (BankScreen or PinScreen or (BankTries > 4));
      if (BankTries > 4) then
      begin
        Debugme('Bank, cant open the bank', 'Cant open bank');
        Logout;
      end;
      wait(700 + random(500));
      if (Random(5) = 2) or (JustClaying) then
        CloseBank;
      Inc(banked);
      Inc(bankedd);
      if not (Result) then
      begin
        if not missingEquipment then
          Result := true;
        if Result then
          exit;
        Debugme('Bank, no supplies', 'Cant find supplies!');
        closebank;
        logout;
        exit;
      end;
    end;

    function IsItemActivated: Boolean;
    var
      X, Y: Integer;
    begin
      GameTab(tab_Inv);
      Result := FindColor(X, Y, 16777215, MIx1, MIy1, MIx2, MIy2);
    end;

    function MouseActivateItem(x, y: integer): boolean;
    var
      Tries: integer;
    begin
      if not (LoggedInFailsafe) then
        exit;
      repeat
        Inc(Tries);
        Mouse(x, y, 3, 3, true);
        Result := WaitFunc(@ IsItemActivated, 500, 1500);
        if (Result) then
          exit;
        wait(500 + random(200));
      until ((Tries > 2) or not (LoggedIn));
    end;

    function FindFountainEx(var fx, fy: Integer): Boolean;
    var
      arP, arAP: TPointArray;
      arC, arUC: TIntegerArray;
      ararP: T2DPointArray;
      tmpCTS, i, j, arL, arL2, amount: Integer;
      P: TPoint;
      H, S, L: Extended;
      X, Y, Z: Extended;
      ThaResult: boolean;
    begin
      Result := false;
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
      if not (FindColorsTolerance(arP, 14063481, MSX1, MSY1, MSX2, MSY2, 50)) then
      begin
        Debugme('At Fountain', 'Failed to find Fountain.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;
      arC := GetColors(arP);
      arUC := arC;
      ClearSameIntegers(arUC);
      arL := High(arUC);
      arL2 := High(arC);
      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);
        if (H >= 61.09) and (H <= 61.36) and (S >= 33.03) and (S <= 91.62) and (L >= 54.29) and (L <= 76.69) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);
          if (X >= 20.50) and (X <= 43.98) and (Y >= 20.53) and (Y <= 44.03) and (Z >= 44.45) and (Z <= 96.61) then
          begin
            for j := 0 to arL2 do
            begin
              if (arUC[i] = arC[j]) then
              begin
                SetLength(arAP, Length(arAP) + 1);
                arAP[High(arAP)] := arP[j];
              end;
            end;
          end;
        end;
      end;
      SortTPAFrom(arAP, Point(MSCX, MSCY));
      ararP := SplitTPAEx(arAP, 15, 15);
      arL := High(ararP);
      for i := 0 to arL do
      begin
        if (Length(ararP[i]) < 10) then
          Continue;
        P := MiddleTPA(ararP[i]);
        MMouse(P.x, P.y, 5, 5);
        Wait(50 + Random(100));
        if not IsUpText('ain') then
          if IsUpText('4 mor') then
          begin
            Mouse(P.x, P.y, 0, 0, false);
            IF WaitOptionMulti(['ain','uck'], 200)then
              result := True;
          end;
          If not result then
          if IsUpText('ain') then
          begin
            Mouse(P.x, P.y, 0, 0, true);
          if DidRedClick then
            Result := true
          else
            Result := false;
        end;
      end;
      ColorToleranceSpeed(tmpCTS);
      if (i = arL + 1) then
      begin
        Writeln('FindObject could not find object.');
        Exit;
      end;
    end;

    function FindFountain: boolean;
    var
      tries: integer;
    begin
      Result := FindFountainEx(x, y);
      if not Result then
        repeat
          if not IsItemActivated then
            if FindDTM(Equipment.DTM, x, y, MIx1, MIy1, MIx2, MIy2) then
              if MouseActivateItem(x, y) then
                null;
          inc(tries);
          FindRandoms;
          DebugMe('Fountain', 'Searching for fountain - tries: ' + IntToStr(Tries));
        until (FindFountainEx(x, y) or (tries > 5));
      if (Tries < 5) then
        result := true;
    end;

    function FindFountainColour: boolean;
    var
      TmpCTS, times: integer;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
      Result := FindColorTolerance(x, y, 14063481, MSX1, MSY1, MSX2, MSY2, 50);
      if not (Result) then
      begin
        repeat
          wait(750);
          Inc(Times);
        until (FindColorTolerance(x, y, 14063481, MSX1, MSY1, MSX2, MSY2, 50) or (times > 8));
      end;
      ColorToleranceSpeed(tmpCTS);
    end;

    function LoadPath(Towhere:string):TpointArray;
    begin
      Case LowerCase(ToWhere) of
      'fountain': Result :=  [Point(3247, 3429), Point(3241, 3433)];
      'bank': Result := [Point(3250, 3428), Point(3254, 3420)];
      'repos': Result := [Point(3238, 3434)];
      end;
    end;
    {$IFDEF USEREFLECTION}
    function WalkPathBH(Tiles: TTileArray): boolean;
    var
      i, t, attempts: integer;
      P: TPoint;
      next: boolean;
    label
      ProcStart;
    begin
      Inc(attempts);
      ProcStart:
      i := -1;
      Result := false;
      if(DistanceFrom(Tiles[High(Tiles)]) < 6)then
      begin
        Result := true;
        Exit;
      end;

      //Getting the starting index.
      for i := High(Tiles) downto 0 do
        if(TileOnMM(Tiles[i]))then
        begin
          i := i;
          Break;
        end;
      if(i = -1)then
        Exit;

      //Walk remainder of the path.
      for i := i to High(Tiles) do
      begin
        next := false;
        if not(TileOnMM(Tiles[i]))then
        begin
          Writeln('Tile not on MM.');
          break;
        end;
        P := TileToMM(Tiles[i]);
        Mouse(P.x, P.y, 1, 1, true);
        while(DistanceFromFlag <> 0)do
        begin
          if not WaitToMove(3000)then
          begin
            MarkTime(t);
            while(TimeFromMark(t) < 7000)do
              if(WaitToMove(1000))then break;
            if(TimeFromMark(t) >= 7000)then
            begin
              Writeln('***Didn''t move for 10 seconds. Exiting***');
              next := false;
              break;
            end;
          end;
          if(i < High(Tiles))then
          begin
            if(TileOnMM(Tiles[i+1]))then
            begin
              next := true;
              break;
            end;
          end;
        end;
        if(i < High(Tiles))then
          if(TileOnMM(Tiles[i+1]))then
            next := true;
        if not next then
          break;
      end;
      Result := DistanceFrom(Tiles[High(Tiles)]) <= 5;
      If Result then
      if not IsItemActivated then
           if FindDTM(Equipment.DTM, x, y, MIx1, MIy1, MIx2, MIy2) then
             MouseActivateItem(x, y);
      if not Result then
      begin
        if(attempts > 7)then
        begin
          Writeln('Failed more than ten attempts.');
          Exit;
        end;
        While(GetSpeed > 0)do wait(100+Random(100));
        goto ProcStart;
      end;
      While(GetSpeed > 0)do wait(100+Random(100));
    end;
    {$ENDIF}

    function WalkTo(TheLocation: string): boolean;
    var
      tries, I: integer;
      TheTiles:TPointArray;
    begin
      if (JustClaying) or not (LoggedInFailsafe) then
        exit;
          SetRunBH(true);
      case LowerCase(TheLocation) of
        'fountain':
          begin
           FindRandoms;
           {$IFDEF USEREFLECTION}

           If (UseReflection) then
           begin
             Repeat
               DebugMe('Walking to Fountain (Reflection)', 'Walking to the fountain (Reflection)');
               Result := WalkPathBH(LoadPath('fountain'));
               Inc(tries);
                If (Result) then
                  break;
                Wait(1000); //Maybe theres lag?
              until (Result) or (Tries > 5);
           end else
            {$ENDIF}
           begin
            DebugMe('Walking to Fountain', 'Walking to the fountain');
            SetRunBH(True);
            if FindDtmRotated(BankDTM, x, y, MMX1, MMY1, MMX2, MMY2, Radians( - 30), Radians(30), 0.05, WalkAngle) then
              if MFNFEx(x - 43, y - 48, 4, 4, 5, 5, 13) then
                repeat
                  if not IsItemActivated then
                    if FindDTM(Equipment.DTM, x, y, MIx1, MIy1, MIx2, MIy2) then
                      if MouseActivateItem(x, y) then
                        FFlag(1);
                  if FindSymbol(x, y, 'water') then
                    if (Distance(x, y, MMCx, MMCy) < 25) or FindFountainColour then
                      Result := true;
                  if not (Result) and (Tries > 1) then
                      if FindSymbol(x, y, 'water') then
                        if MFNFEx(x, y, 5, 5, 5, 5, 3) then
                          Result := true;
                    Inc(Tries);
                until ((Result) or (Tries > 3));
           end;
           If not (result) then
     {$IFDEF USEREFLECTION}
             If UseReflection then
             begin
               repeat
                 TheTiles :=  [Point(3247, 3429), Point(3241, 3433)];
                 for I := 1 to 2 do
                   If TileOnMM(TheTiles[I]) then
                     if WalkPathBH(LoadPath('bank')) then
                       if WalkPathBH(LoadPath('fountain')) then
                         Result := true;
               Until((Tries > 5) or (Result));
               If not (Result) then
                 DebugMe('Unknown, was walking to Fountain', 'Unknown, was walking to Fountain');
               end;
               {$ENDIF}
          end;


        'bank':
          begin
            FindRandoms;
             {$IFDEF USEREFLECTION}
            If UseReflection then
            begin
              repeat
                DebugMe('Walking to bank (Reflection)', 'Walking to the bank (Reflection)');
                Result := WalkPath(LoadPath('bank'));
                Inc(tries);
                If (Result) then
                  break;
                If not (result) then
                  Wait(1000); //Maybe theres lag?
              until (Result) or (Tries > 5);
            end else
             {$ENDIF}
            begin
              DebugMe('Walking to bank', 'Walking to the bank');
             repeat
               if FindSymbol(x, y, 'water') then
                 if MFNFEx(x + 50, y + 23, 5, 5, 5, 3, 2) then
                   if FindDtmRotated(BankDTM, x, y, 597, 83, 701, 160, Radians( - 30), Radians(30), 0.05, WalkAngle) then
                     if MFNFEx(x, y - 6, 4, 4, 4, 1, 0) then
                       Result := true;
               if not LoggedInFailsafe then
                 exit;
               if not Result then
                 if MFNFEx(679, 107, 4, 4, 4, 1, 0) then
                   if FindDtmRotated(BankDTM, x, y, 597, 83, 701, 160, Radians( - 30), Radians(30), 0.05, WalkAngle) then
                     if MFNFEx(x, y - 6, 4, 4, 4, 1, 0) then
                       Result := true;
               inc(Tries);
            until (Result) or (Tries > 4);
          end;
          if (Result) then
            Banking;
          end;
      end;
      if not (Result) then
      begin
        if (Lowercase(TheLocation) = 'fountain') then
        {$IFDEF USEREFLECTION}
          if Usereflection then
             if WalkToTile(Point(3238, 3434), 1,1) then
               result := true;
          If (result) then
            exit;
            {$ENDIF}
          if FindSymbol(x, y, 'water') then
            if MFNFEx(x, y, 5, 5, 5, 5, 3) then
              Result := true;
        if not Result and (Lowercase(TheLocation) = 'fountain') then
          if FindFountainColour then
            Result := true;
        if not result then
        begin
          DebugMe('Failed to walk to the ' + Uppercase(TheLocation), 'Failed to walk to the ' + Uppercase(TheLocation));
          logout;
        end;
      end;
    end;

    function WetClayMouse(var qx, qy, xw, yw: integer): boolean;
    begin
      if not (LoggedInFailsafe) then
        exit;
      MouseActivateItem(qx, qy);
      wait(200 + random(200));
      Mouse(xw, yw, 5, 5, true);
      wait(200 + random(200));
      if WaitColor(257, 413, 802389, 15, 5000) then
        Mouse(258, 412, 5, 5, false);
      wait(200 + random(200));
      if WaitOption('Make All', 500) then
        Result := true;
    end;

    function WaitBH(MaxTime: integer): boolean;
    var
      Timer, Halfwait: integer;
    begin
      if not (LoggedInFailsafe) then
        exit;
      Timer := GetSystemTime + MaxTime;
      Halfwait := MaxTime / 2;
      while (GetSystemTime < Timer) do
      begin
        wait(halfwait);
        Result := FindRandoms;
        Antiban;
        if (Result) then
          exit;
      end;
    end;

    function TheBrains: boolean;
    var
      xx, yy, WorkingTime: integer;
      AreWeDone:boolean;
    begin
      if not (LoggedInFailsafe) then
        exit;
      case Lowercase(Players[CurrentPlayer].Strings[0]) of
        'w vial', 'w bucket', 'bucketclay':
          begin
            GameTab(Tab_Inv);
            if not IsItemActivated then
              if FindDTM(Equipment.DTM, x, y, MIx1, MIy1, MIx2, MIy2) then
                if MouseActivateItem(x, y) then
                  null;
            if IsItemActivated then
              if FindFountain then
              begin
                MarkTime(WorkingTime);
                while FindDTM(Equipment.DTM, x, y, MIx1, MIy1, MIx2, MIy2) and not (TimeFromMark(WorkingTime) > 25000) do
                  if waitBH(1000) then
                    TheBrains;
              end
            else if FindSymbol(x, y, 'water') then
              if MFNFEx(x, y, 5, 5, 5, 5, 3) then
                TheBrains;
            if (Lowercase(Players[CurrentPlayer].Strings[0]) = 'bucketclay') then
            begin
              if FindDTM(Clay, x, y, MIx1, MIy1, MIx2, MIy2) and FindDTM(Equipment.WetDTM, xx, yy, MIx1, MIy1, MIx2, MIy2) then
              begin
                if WetClayMouse(x, y, xx, yy) then
                  while FindDTM(Clay, x, y, MIx1, MIy1, MIx2, MIy2) and FindDTM(Equipment.WetDTM, xx, yy, MIx1, MIy1, MIx2, MIy2) do
                  begin
                    if waitBH(1000) then
                       TheBrains;
                  end;
                    GameTab(Tab_Inv);
                    if not IsItemActivated then
                      if FindDTM(Equipment.DTM, x, y, MIx1, MIy1, MIx2, MIy2) then
                        if MouseActivateItem(x, y) then
                          null;
                        if IsItemActivated then
                            if FindFountain then
                            begin
                               MarkTime(WorkingTime);
                            while FindDTM(Equipment.DTM, x, y, MIx1, MIy1, MIx2, MIy2) and not (TimeFromMark(WorkingTime) > 25000) do
                            if waitBH(1000) then
                               exit;
                            end;
              end else
                DebugMe('Fountain', 'We couldnt find the DTM');
            end;
          end;
        'claying':
          begin
            GameTab(Tab_Inv);
            if not FindDTM(Clay, x, y, MIx1, MIy1, MIx2, MIy2) or not FindDTM(Equipment.DTM, xx, yy, MIx1, MIy1, MIx2, MIy2) then
              banking
            else if FindDTM(Clay, x, y, MIx1, MIy1, MIx2, MIy2) or FindDTM(Equipment.DTM, xx, yy, MIx1, MIy1, MIx2, MIy2) then
              if WetClayMouse(x, y, xx, yy) then
                while FindDTM(Clay, x, y, MIx1, MIy1, MIx2, MIy2) and FindDTM(Equipment.DTM, x, y, MIx1, MIy1, MIx2, MIy2) do
                  if waitBH(1000) then
                    TheBrains;
          end;
      end;
    end;

    procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour, Shadow: integer);
    var
     mx, my, Pic, I, B, H, TPH, Numb: Integer;
     TTP: TPointArray;
     Canvas: TCanvas;
    begin
      SmartSetDebug(True);
      GetClientDimensions(mx,my);
      Pic := BitmapFromString(mx,my,'');
      TPH := High(TP);
      for I := 0 to TPH do
      begin
        TTP := LoadTextTPA(TP[i], SmallChars, H);
        for B := 0 to High(TTP) do
        begin
          Numb := ((I + 1) * 13);
          FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1, Shadow);
          FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
        end;
      end;
      Canvas := TCANVAS.Create;
      Canvas.Handle := SmartGetDebugDC;
      DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
      FreeBitmap(Pic);
    end;

    procedure PlayerStats;
    var
      Active: string;
      i: Integer;
    begin
      if Players[CurrentPlayer].Active = True then
        Active := 'True'
      else
        Active := 'False';
      Writeln('     Name          : ' + Players[CurrentPlayer].Name);
      Writeln('     Player        : ' + inttostr(CurrentPlayer));
      Writeln('     Active        : ' + Active);
      Writeln('     Location      : ' + Players[CurrentPlayer].loc);
      Writeln('     Worked        : ' + IntToStr(Players[CurrentPlayer].Worked));
      WriteLn('[==========================================================================================]');
      for I := 0 to HowManyPlayers - 1 do
      begin
        if Players[i].Active then
          Active := 'T '
        else
          Active := 'F ';
        Writeln('  Player ' + (IntToStr(I)) + ': ' + Players[I].Nick + ', Active = ' + Active + ' Supplies Gained = ' + IntToStr(Players[CurrentPlayer].Integers[2]) + ', Worked = ' + IntToStr(Players[i].Worked) + ' min, ' + 'Location = ' + Players[i].loc + ', ' + 'Random = ' + Players[i].Rand + '.');
      end;
      WriteLn('[==========================================================================================]');
    end;

    procedure ProgressReport;
    begin
      SRLRandomsReport;
      try
        WriteLn('[=====================================================]');
        WriteLn('[=     BH - Tha Ultimate Filler N Clayer  V 1.02      ]');
        WriteLn('[=====================================================]');
        Writeln('[=  Script Worked for ' + TimeRunning);
        Writeln('[=  Banked ' + IntToStr(Banked) + ' time[s].');
        Writeln('[=  ' + Equipment.Description[0] + ' ' + IntToStr(Gained) + ' ' + Equipment.Description[1]);
        Writeln('[=  ' + Equipment.Description[2] + ' Rate: ' + IntToStr(Round((Gained * 3600) / (GetTimeRunning / 1000))) + ' Per Hour');
        writeln('[=====================================================]');
         PrintOnSmart(['  Basic Progress Report'],Point(15, 30), 62207, 131072);
                 PrintOnSmart([
                   'Time Running: ' + TimeRunning,
                   'Players active: ' + ToStr(PlayersActive) + '/' + ToStr(HowManyPlayers),
                   'Banked: ' + IntToStr(Banked),
                   'Amount: '+ IntToStr(Gained),
                   'Rate: ' + IntToStr(Round((Gained * 3600) / (GetTimeRunning / 1000))) + ' Per Hour',
                   '',
                   ''], Point(20, 60), 1959605, 131072);

      except
      end;
      PlayerStats;
    end;

    procedure FreeAllDTMs;
    var
      Z:integer;
    begin
      try
      for z := 0 to 100 do
        FreeDTM(Equipment.DTM);
        FreeDTM(Equipment.WetDTM);
        FreeDTM(Clay);
        FreeDTM(BankDTM);
      except
      end;
    end;

    procedure ScriptTerminate;
    begin
      FreeAllDTMs;
    end;
    var
     Maintry : integer;
    begin
      {$IFDEF SRL_SMART}
      Smart_Server := Smart_ServerBH;
      Smart_Signed := Smart_SignedBH;
      {$ENDIF}
      setupSRL;
        {$IFDEF USEREFLECTION}
        If UseReflection then
      SetupReflectionEx(false);
      {$ENDIF}
      ActivateClient;
      declareplayers;
      wait(1000);
      FindRandoms;
      if not LoggedIn then
        LoginPlayer;
      repeat
        PlayerSetup;
        repeat
          GameTab(Tab_inv);
           If WalkTo('fountain') then
           begin
            TheBrains;
            If WalkTo('bank') then
             ProgressReport;
           end else
           begin
             Inc(MainTry);
           If (MainTry > 5) then
             Logout;
           end;
        until (Bankedd >= (Players[CurrentPlayer].Integers[0])) or (not (LoggedInFailsafe));
        MainTry := 0;
        if (AllPlayersInactive) then
          break;
        if not (LoggedIn) then
        begin
          Debugme('Unknown', 'We logged out of player - ' + Players[CurrentPlayer].Name + '. Setting false.');
          NextPlayer(false);
          Bankedd := 0;
        end;
        if (Banked >= (Players[CurrentPlayer].Integers[0])) then
        begin
          CloseBank;
          Debugme('In Bank, Loads done.', ' Loads done, In bank');
          Logout;
          NextPlayer(true);
          Bankedd := 0;
        end;
        FreeAllDTMs;
      until (AllPlayersInactive);
    end.

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
  •