Results 1 to 1 of 1

Thread: Banking and Detection Trouble

  1. #1
    Join Date
    Dec 2011
    Posts
    733
    Mentioned
    2 Post(s)
    Quoted
    7 Post(s)

    Default Banking and Detection Trouble

    Im wicked tired which probable has somethign to do with it, but Both banking and detecting which logs have been converted are sketchy

    Fixed it

    my script(a Lunar log planker):
    Simba Code:
    {$DEFINE SMART}
    {$i srl/srl.simba}
    {$i srl/srl/misc/paintsmart.simba}


    var
      PlankDTM,MahoganyLogsDTM,LastLogSlot,I : Integer;
      LogsBankSlot : TPoint;
      LogArr : TBoolArray;
      MageSortSettings,LogTypes : TIntegerArray;
      LogsUptext : array of array of string;

    const
      DebugLevel = 5;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      with Players[0] do
      begin
        Name := '';
        Pass := '';
        Pin := '3240';
        Active := true;
        Member := true
                          //Log Type
        Integers[0] := 3; //0-3 for normal, oak, teak, or mahogany logs respectively
      end;
    end;

    procedure setVars;
    begin
      PlankDTM := DTMFromString('mggAAAHicY2NgYPjEBMGvgPglEP8C4i9AXMDIwFANxKVAnAfEuUCcAcRHpicCdTFiYFYgiQ1jqoRgCAAAGecKRg==');
      SetArrayLength(LogArr,28);

      MahoganyLogsDTM := DTMFromString('mggAAAHicY2NgYLBhZmCwBmIDIDYCYmcgdgViS0YGBj0gNgViRyB2AGIzIJ5QEQDUxYSBOYAkKxbMiANDAACXIwRc');
      LogTypes := [0,0,0,MahoganyLogsDTM];

      SetArrayLength(LogsUptext,4);
      LogsUptext[3] := ['ahog','hogan', 'gany', 'ny log'];
      SetArrayLength(MageSortSettings,3);

      MageSortSettings[0] := BitmapFromString(6, 5, 'meJwTUVARUVCRl5c/evOVeUQBkPSN' +
            'TfeKSmZkYABy05dtA8oCuUBBOBfIAHIDErOADCAXqBJI+sZnAhGQD' +
            'UQQBgAtghmf');

      MageSortSettings[1] := BitmapFromString(6, 6, 'meJzTNzCwsbHJyspiZGDo6uoSFhYG' +
            'MhwdHYFsICMhIREoIi8vP2ny5ITERKCIvoEBUGTJkiVAEaA4FxcXk' +
            'BuRWQzUAmQDFQC5AYlZsQVVQDaEC5SNyi1PKW8CAFv6GSo=');

      MageSortSettings[2] := BitmapFromString(7, 7, 'meJxrnL2gYsKc0u6ZRR1T8psnZDf2' +
            'AFF9MgNQhMG2GY4yKluDTRhB7Pi9DF0PQQjIsG0CagEJArmLroIQk' +
            'AEWZGRggOltAiIgF2hsZk0HkAFHCYXVQGNTypsgCMiNyCwGIgAMgjOd');

    end;

    function replicate(str : String; count : Integer):String;
    var
      I : Integer;
    begin
      Result := '';//make sure result is empty if function was previously called;
      for I := 0 to count-1 do
        Result := Result + str;
    end;

    procedure DebugStr(Level : Integer; Text : String);
    begin
      if (DebugLevel >= Level) then
        writeln(replicate(':: ',Level) + Text);
    end;

    function MenuOpen:Boolean;
    begin
      result := OptionsExist(['ancel'],False);
    end;

    procedure mouseAway;
    var
      TP:TPoint;
    begin
      GetMousePos(TP.x,TP.y);
      mmouse(TP.x-100-random(50),TP.y-150-random(100),5,5);
    end;

    function Open_Bank:Boolean;
    var
      TP : TPoint;
      bankerTPA : TPointArray;
      bankerATPA : T2DPointArray;
      PostBankClick : LongInt;
      I : Integer;
    begin
      Result := False;

      if not (GetColorToleranceSpeed = 0) then
        SetColorToleranceSpeed(0);

      DebugStr(2,'Banking...');
      if not (BankScreen or PinScreen) then
      begin
        Result := OpenBankNPC;
        if not OpenBankNPC then
        begin
          DebugStr(3,'SRL OpenBankNPC failed, finding bankers manually...');
          FindColorsTolerance(bankerTPA,3021342,MSX1,MSY1,MSX2,MSY2,13);
          bankerATPA := TPAtoATPA(bankerTPA,20);

          for I := 0 to length(bankerATPA)-1 do
          begin
            TP := MiddleTPA(bankerATPA[I]);
            MMouse(TP.x,TP.y,4,4);
            if WaitUpTextMulti(['to B','Bank','anke'],725+random(225)) then
            begin
              clickMouse2(mouse_Right);
              if WaitOption('ank',725+random(225)) then
              begin
                DebugStr(4,'Found option to bank');
                wait(100+random(125));
                if ChooseOption('ank') then
                  DebugStr(4,'Clicked open bank succesfully');
                break;
              end;
            end;
          end;
        end;
      end;

      MarkTime(postBankClick);
      while not (BankScreen or PinScreen) and (TimeFromMark(postBankClick) < 5000) do
        wait(100+random(50));
      if PinScreen then
      begin
        DebugStr(2,'Entering pin...');
        inpin(Players[CurrentPlayer].Pin);
      end;

      MarkTime(postBankClick);
      while not BankScreen and (TimeFromMark(postBankClick) < 5000) do
        wait(50+random(50));

      result := BankScreen;

      if result then
      begin
        DebugStr(2,'Bank opened succsesfully');
      end;
    end;

    procedure depositPlanks;
    begin
      Deposit(4,28,True);
    end;

    function FindLogs(var LogsBankSlot:TPoint; withdrawLogs:boolean):Boolean;
    var
      LogsTPA : TPointArray;
      LogsATPA : T2DPointArray;
      I,Tries : Integer;
      TP : TPoint;
    begin
      SetColorToleranceSpeed(2);
      SetColorspeed2Modifiers(0.06,0.50);

      FindColorsTolerance(LogsTPA,5933476,MBX1,MBY1,MBX2,MBY2,2);

      for Tries := 0 to 5 do
      begin
        LogsATPA := TPAtoATPA(LogsTPA,10);
        SortATPAFrom(LogsATPA,Point(0,0));

        SMART_DrawDotsEx(true,LogsTPA,clAqua);

        for I := 0 to length(LogsTPA)-1 do
        begin
          TP := MiddleTPA(LogsATPA[I]);

          mmouse(TP.x,TP.y,4,4);
          wait(400+random(50));

          writeln(rs_GetUpText);
          if WaitUpTextMulti(LogsUptext[Players[CurrentPlayer].Integers[0]],725+random(225)) then
          begin
            LogsBankSlot := MSTPointToBankPoint(TP);

            if withdrawLogs then
            begin
              Result := Withdraw(LogsBankSlot.x,LogsBankSlot.y,0);
              debugStr(2,'Withdrawing Logs Success: '
                + BoolToStr(Result));
            end;
            exit;
          end;
        end;
      end;
      SMART_ClearCanvas;
    end;

    function withdrawLogs:Boolean;
    begin
      MouseBankSlot(BankPointToBankIndex(LogsBankSlot),mouse_move);
      if WaitUpTextMulti(LogsUptext[Players[CurrentPlayer].Integers[0]],725+random(225)) then
      begin
        DebugStr(3,'Remembered logs Bank Slot, withdrawing');
        Result := Withdraw(LogsBankSlot.x,LogsBankSlot.y,1)
      end else
      begin
        DebugStr(3,'Did not remember logs Bank Slot, finding and withdrawing');
        Result := FindLogs(LogsBankSlot,true);
      end;
    end;

    function SortSpells:Boolean;
    var
      I : Integer;
      TP : TPoint;
    begin
      for I := 0 to 2 do
      begin
        if FindBitmapIn(MageSortSettings[I],TP.x,TP.y,MIX1,MIY1,MIX2,MIY2) then
        begin
          mouse(TP.x,TP.y,3,3,mouse_Left);
          DebugStr(4,'Mage Sort Setting ' + IntToStr(I) + ' Switched');
        end;
        wait(150+random(75));
      end;
    end;

    function LogInSlot(LogDTM,InvSlot:Integer):Boolean;
    var
      x,y:Integer;
      box : TBox;
    begin
      box := InvBox(InvSlot);
      Result := FindDTM(LogDTM,x,y,box.X1,box.Y1,box.X2,box.Y2);
    end;

    function GetLogArray(LogDTM : Integer) : TBoolArray;
    var
      I,X,Y : Integer;
      TP : TPoint;
      InvArr : TBoolArray;
      DebugLine : String;
    begin
      SetArrayLength(InvArr,28);

      GameTab(tab_Inv);
      wait(1000+random(100));

      for I := 0 to 27 do
      begin
         InvArr[I] := LogInSlot(LogDTM,I+1);
      end;

      //Print inventory array
      if DebugLevel = 5 then
        for I := 0 to 27 do
        begin
          if I Mod 4 = 0 then
          begin
            Writeln(DebugLine + '|');
            DebugLine := '|';
          end;

          if InvArr[I] then
            DebugLine := DebugLine + 'L'
          else
            DebugLine := DebugLine + ' ';
        end;

        Result := InvArr;
    end;

    procedure ClickLog(LogSlot : Integer);
    var
      T : LongInt;
      TP : TPoint;
    begin
        MouseItem(LogSlot,mouse_Left);

        MarkTime(T);
        if length(Players[CurrentPlayer].Pin) > 0 then
        begin
          while not PinScreen or (TimeFromMark(T) > 5000+random(1000)) do
          begin
            DebugStr(2,'Waiting for Pin Screen');
          end;
          InPin(Players[CurrentPlayer].Pin);
        end;
    end;

    function ReadyPlankSpell:Boolean;
    var
      TP : TPoint;
    begin
      GameTab(tab_Magic);

      if not FindDTM(PlankDTM,TP.x,TP.y,MIX1,MIY1,MIX2,MIY2) then
      begin
        DebugStr(2,'Failed to find plankmake spell, atttempting to resort spell tab...');
        SortSpells;
        if not FindBitmapIn(PlankDTM,TP.x,TP.y,MIx1,MIY1,MIX2,MIY2) then
        begin
          DebugStr(1,'Failed to find the plankmake spell. Ensure you have the lunar spellbook enabled, and that you have the required level to cast Plank Make');
          TerminateScript;
        end;
      end;
      mouse(TP.x,TP.y,3,3,mouse_Left);
    end;

    procedure antiban;
    begin
      FindNormalRandoms;
      if FindMod then
      begin
        logout;
        wait(20000+random(5000)); //Make it seem liike we had to walk away...
        SelectWorld(RandomWorld(true,false));
        LogInPlayer;
      end;

      case random(1000) of
        1..5: HoverSkill(SKILL_MAGIC,false);
        6..30: PickUpMouse;
        31..50: RandomRClick;
        51..75: SetScreenMouse('rand',SRL_ANGLE_HIGH);
      end;
    end;

    function hasLogs:Boolean;
    begin
      LogArr := GetLogArray(LogTypes[Players[CurrentPlayer].Integers[0]]);
      for I := 0 to 27 do
        if LogArr[I] then
          Result := true;
    end;

    begin
      {$ifdef SMART}
        Smart_Members := True;
        Smart_Server := 100;
        Smart_Signed := False;
        Smart_SuperDetail := False;
      {$endif}
      DeclarePlayers;
      SetupSRL;
      setVars;

      if not loggedin then
      begin
        LogInPlayer;
        SortSpells;
      end;


      repeat
        if not loggedin then
        begin
          LogInPlayer;
          SortSpells;
        end;

        while hasLogs do
        begin
          for I := 0 to 27 do
          begin
            if LogArr[I] then
            begin
              ReadyPlankSpell;
              ClickLog(I);
            end;
          end;
          AntiBan;
        end;

        Open_Bank;
        depositPlanks;
        withdrawLogs;
        CloseBank;
      until AllPlayersInactive;
    end.
    Last edited by m34tcode; 03-26-2012 at 08:22 AM.
    My scripts: LunarPlanker
    ---
    My Utilities: Cross Platform, Open Source, SPS Path Generator

    Join the Unoficial SRL Skype Group by clicking here, or visiting this thread.

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
  •