Page 6 of 8 FirstFirst ... 45678 LastLast
Results 126 to 150 of 185

Thread: [S]uper [S]avvy [S]mither [Simba/SCAR][SRL]

  1. #126
    Join Date
    Feb 2012
    Posts
    38
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by qingqinghd View Post
    use this fix ones
    Code:
    program SuperSavvySmither;
    {$i SRL/SRL/Misc/Smart.simba}
    {$i SRL/SRL.simba}
    {$i SRL/SRL/Misc/Paintsmart.simba}
    
    {==============================================================================]
    [                 Daazndagger's [S]uper [S]avvy [S]mither                      ]
    [==============================================================================]
    [                            [Simba/SCAR 3.23]                                 ]
    [                                  [SRL]                                       ]
    [                                 [SMART]                                      ]
    [------------------------------------------------------------------------------]
    [   Description:    |                                                          ]
    [-------------------.                                                          ]
    [   - I made this script in two days, so don't expect much from it :P          ]
    [     BUT, what you can expect is that it will do its job to the best          ]
    [     potential. It is the best (but only working) smither at villavu.com      ]
    [------------------------------------------------------------------------------]
    [   Features:       |                                                          ]
    [-------------------.                                                          ]
    [  ## Version 1.00 (17/7/10):                                                  ]
    [    - Initial release                                                         ]
    [    - Smiths any bars into anything                                           ]
    [    - Takes rests based on the time running                                   ]
    [    - Supports multi-player                                                   ]
    [  ## Version 1.01 (9/10/11):                                                  ]
    [    - Hammer DTM Update                                                       ]
    [  ## Version 1.02 (17/12/11):                                                 ]
    [    - Toolbelt update; assumes you have a hammer in there!                    ]
    [    - Removed DTMs, replaced with Auto-TPA Items                              ]
    [  ## Version 1.03 (25/12/11):                                                 ]
    [    - Colour update                                                           ]
    [  ## Version 1.04 (05/01/12):                                                 ]
    [    - Checks online for latest colours/tolerance                              ]
    [    - Fixed location finding bug                                              ]
    [    - Improved walking procedures                                             ]
    [  ## Version 1.05 (16/01/12):                                                 ]
    [    - Walking was re-worked                                                   ]
    [    - Minor fixes                                                             ]
    [  ## Version 1.06 (29/01/12):                                                 ]
    [    - Changed location check functions                                        ]
    [    - Bug fixes elsewhere                                                     ]
    [------------------------------------------------------------------------------]
    [   Instructions:   |                                                          ]
    [-------------------.                                                          ]
    [   1. Fill in the lines below until it says STOP!                             ]
    [   2. Make sure you have a hammer TOOLBELT!                                   ]
    [   3. Make sure you have bars VISIBLE in your bank.                           ]
    [   4. Press PLAY!                                                             ]
    [------------------------------------------------------------------------------}
    
    var
      WhenBreak, WithdrawBars: Integer;
      SmithingItem: String;
      x, y: Integer;
    
    {------------------------------------------------------------------------------]
    [  VARIBLE SETUP:                                                              ]
    [     See the thread for details.                                              ]
    [------------------------------------------------------------------------------}
    procedure LoadGlobals;
    begin
      WhenBreak    := 300000;             // Minutes until break
      SmithingItem := 'Platebody';    // What to make
      WithdrawBars := 25;             // How many bars to withdraw
    end;
    
    {------------------------------------------------------------------------------]
    [  DECLARE PLAYERS:                                                            ]
    [     Change accordingly.                                                      ]
    [------------------------------------------------------------------------------}
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      with Players[0] do
      begin
        Name     :='';        // Username
        Pass     :='';        // Password
        Pin      :='';        // Your bank PIN
        Member   := true;
        Active   := true;
      end;
    end;
    
    {------------------------------------------------------------------------------}
    {                STOP STOP   STOP STOP   STOP-STOP    STOP STOP                }
    {                STOP           STOP     STOP STOP    STOP    |                }
    {      =====     STOP STOP      STOP     STOP STOP    STOP STOP     =====      }
    {                     STOP      STOP     STOP STOP    STOP                     }
    {                STOP STOP      STOP     STOP-STOP    STOP                     }
    {------------------------------------------------------------------------------}
    
    const
      ScriptVersion = '1.06';
      ScriptName    = '[S]uper [S]avvy [S]mither';
    
    { *** For HSL Colours}
      C_HUE = 0;
      C_SAT = 1;
      C_LUM = 2;
    
    type
      TObjectProperties = record
        Colour, Tol: Integer;
        HSL: Array[0..2] of Extended;
        HSMod: Array[0..1] of Extended;
        TPA: TPointArray;
        ATPA: array of TPointArray;
      end;
    
    type
      TTPAItem = Record
        Outline, Width, Height, Colour: Integer;
        Box: TBox;
        Slot: TPoint;
      end;
    
    var
      DTM_MMBank, DTM_MMBank2: Integer; //DTM_Bar, DTM_Hammer: Integer;
      BankBar, InvBar: TTPAItem;
      TotalTimeInactive, RoundTime, lTimer: Integer;
      Anvil, BankBooth: TObjectProperties;
      Total_LevelUps, Total_Bars, Total_Loads: Integer;
    
    procedure LoadDTMs;
    begin
      DTM_MMBank := DTMFromString('mbQAAAHicY2VgYFBhQWBZIJYD4tVA8eVAvAGI1wPxIiB+ycDE8PLLNzD++YcRjJmB4uiYEQsGAwCVng6l');
      DTM_MMBank2 := DTMFromString('mbQAAAHicY2VgYNjDxMAwE4g5mBkYDgPpI0D8GCj+E4i/A/EjIOZiZGB4ycDE0NXeAsbtpT4MGTGuDP9BcmiYEQsGAwDgtw5H');
    end;
    
    // Only works for integers > 0
    function LoadIntegerOnline(var int: Integer; site: String): Boolean;
    var
      IntAsString: String;
    begin
      int:= -1;
      IntAsString:= GetPage(site);
      if Length(IntAsString) > 10 then
        Exit;
      int:= StrToInt(IntAsString);
      if int <> -1 then
        Result:= True;
    end;
    
    procedure LoadColourTol;
    begin
    
      if not LoadIntegerOnline(Anvil.Colour, 'http://pastehtml.com/view/bjl2gebfi.txt') then
        Anvil.Colour:= 5066064; //4473927; //4671307; //4013376; //3947839;
      if not LoadIntegerOnline(Anvil.Tol, 'http://pastehtml.com/view/bjl2mrvbi.txt') then
        Anvil.Tol:= 5;
    
      ColorToHSL(Anvil.Colour, Anvil.HSL[C_HUE], Anvil.HSL[C_SAT], Anvil.HSL[C_LUM]);
      Anvil.HSMod[C_HUE]:= (Anvil.HSL[C_HUE] / Anvil.HSL[C_LUM]);    // 2.78
      Anvil.HSMod[C_SAT]:= (Anvil.HSL[C_SAT] / Anvil.HSL[C_LUM]);    // 0.28
      Writeln('Anvil Mods: Hue=' +FloatToStr(Anvil.HSMod[C_HUE])+ '  Sat=' +FloatToStr(Anvil.HSMod[C_SAT]));
    
      if not LoadIntegerOnline(BankBooth.Colour, 'http://pastehtml.com/view/bjl2tds4u.txt') then
        BankBooth.Colour:= 2575450; //2707293; //2245198;
      if not LoadIntegerOnline(BankBooth.Tol, 'http://pastehtml.com/view/bjl2wevlq.txt') then
        BankBooth.Tol:= 3;
    
      ColorToHSL(BankBooth.Colour, BankBooth.HSL[C_HUE], BankBooth.HSL[C_SAT], BankBooth.HSL[C_LUM]);
      BankBooth.HSMod[C_HUE]:= (BankBooth.HSL[C_HUE] / BankBooth.HSL[C_LUM]);
      BankBooth.HSMod[C_SAT]:= (BankBooth.HSL[C_SAT] / BankBooth.HSL[C_LUM]);
      Writeln('BankBooth Mods: Hue=' +FloatToStr(BankBooth.HSMod[C_HUE])+ '  Sat=' +FloatToStr(BankBooth.HSMod[C_SAT]));
    end;
    
    function FindColorBox(var x, y: Integer; color: Integer; b: TBox): Boolean;
    begin
      Result:= FindColor(x, y, color, b.X1, b.Y1, b.X2, b.Y2);
    end;
    
    // Credits to Narcle; I reworked his idea :)
    function SetBarTPA(bOutline, bWidth, bHeight, bColour: Integer; bBox: TBox; bPoint: TPoint): TTPAItem;
    begin
      with Result do
      begin
        Outline := bOutline;
        Width := bWidth;
        Height := bHeight;
        Colour := bColour;
        Box := bBox;
        Slot := MSTPointToBankPoint(bPoint);
      end;
    end;
    
    // Credits to Narcle; I reworked his idea :)
    function UpdateBarTPA(var Item: TTPAItem; InvS: TBox): Boolean;
    var
      BarTPA: TPointArray;  // TPA stored in this
      T: TPoint;            // For the middle point of Item
      B: TBox;              // Item bounds
    begin
      B := InvS;
      FindColorsTolerance(BarTPA, srl_outline_black, B.x1, B.y1, B.x2, B.y2, 0);
      if Length(BarTPA) < 1 then
        Exit;
      B := GetTPABounds(BarTPA);
      T := MiddleTPA(BarTPA);
      Item := SetBarTPA(Length(BarTPA), iAbs(B.x2-B.x1), iAbs(B.y2-B.y1), GetColor(T.x, T.y), B, T);
      Result := true;
    end;
    
    // Credits to Narcle; I reworked his idea :)
    function FindBar(var Item: TTPAItem; InvS: TBox; UpdateTrue: Boolean): Boolean;
    var
      TPA: TPointArray;
      B: TBox;
      T: TPoint;
    begin
      if UpdateTrue then
        UpdateBarTPA(Item, InvS);
    
      B := InvS;
      FindColorsTolerance(TPA, srl_outline_black, B.x1, B.y1, B.x2, B.y2, 0);
      if Length(TPA) < 1 then
        Exit;
      B := GetTPABounds(TPA);
      T := MiddleTPA(TPA);
    
      SMART_DrawDotsEx(true, TPA, 255);
    
      if (Length(TPA) = Item.Outline) and (iAbs(B.x2-B.x1) = Item.Width) and (iAbs(B.y2-B.y1) = Item.Height) then
        if Item.Colour > -1 then
          Result := GetColor(T.x, T.y) = Item.Colour
        else
          Result := True;
    end;
    
    function CountBar(Item: TTPAItem): Integer;
    var
      i, count: Integer;
    begin
      count:= 0;
      for i:=1 to 28 do
        if FindBar(Item, InvBox(i), False) then
        begin
          Inc(count);
          Status('Counting Bars, you have: ' +IntToStr(count));
        end;
    
      Result:= count;
    end;
    
    function SmithingScreen: Boolean;
    var
      a, b: Integer;
    begin
      Result:= FindColor(a, b, 2071039, 250-3, 44-3, 250+3, 44+3)
    end;
    
    procedure FixSmith(Down: Boolean);
    var
       TPA: TPointarray;
       ColScroll: Integer;
       X, Y, S: Integer;
    begin
      if not SmithingScreen then Exit;
    
      if Down then
      begin
          TPA := [Point(500, 306), Point(499, 315)];
          ColScroll := 592137;
      end else
      begin
        TPA := [Point(500, 75), Point(499, 66)];
        ColScroll := 1250841;
      end;
    
      if GetColor(TPA[0].x, TPA[0].y) <> ColScroll then
      begin
        X := TPA[1].x - 4 + Random(8);
        Y := TPA[1].y - 4 + Random(8);
        HoldMouse(X, Y, mouse_left);
        S := GetSystemTime;
        while GetColor(TPA[0].x, TPA[0].y) <> 657930 do
          if GetSystemTime - S > 3500 then
            Break
          else
            Wait(10);
        ReleaseMouse(X, Y, mouse_left);
      end else
        Writeln('Already in correct area');
    end;
    
    function SmithItem(Item, Amount: string): Boolean;
    var
       Items: array [0..1] of TStringarray;
       Scroll: Boolean;
    begin
      if not SmithingScreen then Exit;
    
      Items[0] := ['Dagger', 'Hatchet', 'Mace', 'Medium helm', 'Crossbow bolts',   //5
                   'Sword', 'Nails', 'Studs', 'Arrow tips', 'Scimitar',            //10
                   'Crossbowlimbs', 'Longsword', 'Throwing knife', 'Full helm',    //14
                   'Square shield', 'Bullseye lantern', 'Warhammer',               //17
                   'Battleaxe'];    //18
    
      Items[1] := ['Chainbody', 'Kite shield', '2-handed sword', 'Plateskirt',
                   'Platelegs', 'Platebody'];    //6
    
      if StrInArr(Item, Items[0]) then
      begin
        Writeln('Item is in first array');
      end else
      begin
        if StrInArr(Item, Items[1]) then
        begin
          Writeln('Item is in second array');
          Scroll := True
        end;
      end;
    
      if Scroll then       // or FixSmith(Scroll);
        FixSmith(True);
    
      case Capitalize(Item) of
        Items[0][0] : MouseBox(25, 70, 78, 90, mouse_right);
        Items[0][1] : MouseBox(148, 71, 193, 89, mouse_right);
        Items[0][2] : MouseBox(264, 73, 306, 90, mouse_right);
        Items[0][3] : MouseBox(388, 71, 439, 91 , mouse_right);
        Items[0][4] : MouseBox(23, 118, 74, 144, mouse_right);
        Items[0][5] : MouseBox(145, 124, 186, 142, mouse_right);
        Items[0][6] : MouseBox(393, 124, 431, 141, mouse_right);
        Items[0][7] : MouseBox(27, 174, 67, 192, mouse_right);
        Items[0][8] : MouseBox(144, 177, 192, 195, mouse_right);
        Items[0][9] : MouseBox(267, 181, 313, 196, mouse_right);
        Items[0][10] : MouseBox(394, 176, 432, 193, mouse_right);
        Items[0][11], Items[1][0] : MouseBox(34, 232, 80, 246, mouse_right);
        Items[0][12], Items[1][1] : MouseBox(147, 231, 188, 146, mouse_right);
        Items[0][13] : MouseBox(266, 232, 315, 245, mouse_right);
        Items[0][14], Items[1][2] : MouseBox(391, 229, 446, 245, mouse_right);
        Items[0][15], Items[1][3] : MouseBox(26, 281, 71, 297, mouse_right);
        Items[0][16], Items[1][5] : MouseBox(249, 270, 326, 292, mouse_right); //266, 279, 313, 297
        Items[0][17] : MouseBox(396, 282, 446, 299, mouse_right);
       // Items[1][5] : MouseBox(249, 270, 326, 292, 2);
        Items[1][4] : MouseBox(140, 275, 192, 293, mouse_right);
      end;
      Writeln('MouseBoxed');
    
      if StrInArr(Amount, ['1', '5', 'All']) then
      begin
        Result := ChooseOption('ake '+Capitalize(Amount));
      end else
      begin
        if ChooseOption('ake X') then
        begin
          Wait(2000 + Random(2000));
          TypeSend(Amount);
          Result := True;
        end;
      end;
    end;
    
    procedure DoAntiBan;
    begin;
      if not(LoggedIn) then Exit;
      case Random(150) of
        10: begin
              HoverSkill('smithing', false);
              GameTab(Tab_Inv);
            end;
        15: begin
              HoverSkill('smithing', false);
              GameTab(Tab_Inv);
            end;
        20: RandomMovement;
        25: RandomMovement;
        30: RandomAngle(1);
        40: PickupMouse;
        50: RandomAngle(1);
        60: RandomRClick;
        70: ExamineInv;
      end;
    end;
    
    function FindMyBank(var x, y: Integer): Boolean;
    var
      CTS, i, h: Integer;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(BankBooth.HSMod[C_HUE], BankBooth.HSMod[C_SAT]);
    
      FindColorsSpiralTolerance(MSCX, MSCY, BankBooth.TPA, BankBooth.Colour, MSX1, MSY1, MSX2, MSY2, BankBooth.Tol);
      ColorToleranceSpeed(CTS);
    
      BankBooth.ATPA := TPAToATPAEx(BankBooth.TPA, 40, 40);
      SortATPAFrom(BankBooth.ATPA, Point(MSCX, MSCY));
    
      if ( Length(BankBooth.ATPA)=0 ) then
      begin
        Writeln('No Bank booths found.');
        Result:= false;
      end else
        Writeln('Found possible Bank booths');
    
      h:= High(BankBooth.ATPA);
      For i := 0 to h do
      begin
        SMART_DrawDotsEx(true, BankBooth.ATPA[i], 255);
        MiddleTPAEx(BankBooth.ATPA[i], x, y);
        MMouse(x, y, 5, 2);
        SMART_ClearCanvas;
        if ( WaitUpTextMulti(['Bank', 'ooth', 'nk boo'], 200) ) then
        begin
          Result:= True;
          GetMousePos(x, y);
          Break;
        end else
          Result:= false
      end;
    end;
    
    function OpenMyBank: Boolean;
    var
      x, y, i, t: Integer;
    begin
      MakeCompass(90);
      if not LoggedIn then
        Exit;
    
      if BankScreen or Pinscreen then
      begin
        Result:= true;
        Exit;
      end;
    
      if FindMyBank(x, y) then
      begin
        Mouse(x, y, 0, 0, mouse_right);
        MarkTime(t)
        repeat
          Wait(RandomRange(200,400))
          if ChooseOptionMulti(['ank', 'ank bo']) then
          begin
            FFlag(1);
            Wait(RandomRange(200,400));
            Result:= true;
            Exit;
          end;
          if TimeFromMark(t) > 3000 then
            Exit;
        until(false)
      end;
    end;
    
    function CheckLoc_OLD: String;
    var
      D_Dungeon, D_Anvil: Integer;
    begin
      if not LoggedIn then
        Exit;
    
      SymbolAccuracy := 0.7;
      repeat
        if FindSymbol(x, y, 'anvil') then
        begin
          D_Anvil:= Distance(x, y, MMCX, MMCY);
          Break;
        end else
          Writeln('Can''t find Anvil Symbol.');
    
        SymbolAccuracy := SymbolAccuracy - 0.1;
      until(SymbolAccuracy < 0.2)
    
      SymbolAccuracy := 0.7;
      repeat
        if FindSymbol(x, y, 'dungeon') then
        begin
          D_Dungeon:= Distance(x, y, MMCX, MMCY);
          Break;
        end else
          Writeln('Can''t find Dungeon Symbol.');
    
        SymbolAccuracy := SymbolAccuracy - 0.1;
      until(SymbolAccuracy < 0.2)
    
      if D_Anvil<D_Dungeon then
      begin
        Result:= 'anvil';
        Writeln('You''re at the anvil.');
      end else
      begin
        Result:= 'bank';
        Writeln('You''re at the bank.');
      end;
    end;
    
    function CheckLoc: String;
    var
      roadCol, t: Integer;
      divTPA: TPointArray;
      locBox: TBox;
    begin
      MarkTime(t);
      MakeCompass('N');
      roadCol := 9080459; // AutoColor(srl_VarrockRoadColor);
      if roadCol = -1 then
        Writeln('AutoColor Failed.');
      FindColorsTolerance(divTPA, roadCol, MMCX, MMY1, MMX2, MMY2, 10);  //FindColors(divTPA, roadCol, MMCX, MMY1, MMX2, MMY2);
      if Length(divTPA) < 1 then
        Writeln('No road colour found.');
      SMART_DrawDotsEx(True, divTPA, clBlue);
      locBox := GetTPABounds(divTPA);
      locBox := IntToBox(locBox.x1, locBox.y1, locBox.x2, locBox.y2 - ((locBox.y2 - locBox.y1) / 2));
      SMART_DrawBoxEx(False, locBox, clGreen);
      //Wait(5000);
    
      if MMCY > locBox.y2 then
        Result := 'anvil'
      else
        Result := 'bank';
    
      Writeln('You are at: ' +Result);
      Writeln('Function took ' +IntToStr(TimeFromMark(t))+ ' ms');
    end;
    
    function ToAnvil: Boolean;
    begin
      if not LoggedIn then
        Exit;
    
      MakeCompass('N');
      MouseBox(641, 123, 652, 132, 1);
      FFlag(0);
      Wait(RandomRange(600, 800));
    
      if (CheckLoc <> 'anvil') then
      begin
        if FindSymbol(x, y, 'anvil') then
        begin
          Mouse(x, y, 3, 3, mouse_left);
          FFlag(0);
          Wait(RandomRange(600, 800));
        end else
          Exit;
      end else
        Result:= True;
    
    end;
    
    function ToBank: Boolean;
    var
      t: Integer;
      angle: Extended;
      foundDTM: Boolean;
    begin
      if not LoggedIn then
        Exit;
    
      MakeCompass('N');
      SetAngle(SRL_ANGLE_HIGH);
      foundDTM := false;
      MarkTime(t)
      repeat
        if FindDTMRotated(DTM_MMBank, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/8, Pi/8, Pi/32, angle)
        or FindDTMRotated(DTM_MMBank2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/8, Pi/8, Pi/32, angle) then
        begin
          Writeln('DTM found at angle: ' +FloatToStr(angle));
          Mouse(x + RandomRange(3, 6), y - RandomRange(2, 5), 3, 3, true);
          foundDTM := true;
          Break;
        end else
          Writeln('Could not find MM DTM!');
      until(TimeFromMark(t)>3000)
    
      if not foundDTM then
        Mouse(605, 50 - RandomRange(2, 5), 5, 5, mouse_left);
    
      FFlag(2);
      Wait(RandomRange(500,750));
    
      Result:= (CheckLoc='bank');
    end;
    
    function FindAnvil(var x, y: Integer): Boolean;
    var
      CTS, i, h: Integer;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(Anvil.HSMod[C_HUE], Anvil.HSMod[C_SAT]);
    
      FindColorsSpiralTolerance(MSCX, MSCY, Anvil.TPA, Anvil.Colour, MSX1, MSY1, MSX2, MSY2, Anvil.Tol);
      ColorToleranceSpeed(CTS);
    
      Anvil.ATPA := TPAToATPAEx(Anvil.TPA, 40, 30);
      SortATPAFrom(Anvil.ATPA, Point(MSCX, MSCY));
    
      if ( Length(Anvil.ATPA)=0 ) then
      begin
        Writeln('No anvils found.');
        Result:= false;
      end else
        Writeln('Found ' +IntToStr(Length(Anvil.ATPA))+ ' possible anvils?');
    
      h:= High(Anvil.ATPA);
      For i := 0 to h do
      begin
        MiddleTPAEx(Anvil.ATPA[i], x, y);
        MMouse(x, y, 2, 2);
        SMART_DrawDotsEx(true, Anvil.ATPA[i], 255);
        if ( WaitUpTextMulti(['Anvi', 'nvil'], 200) ) then
        begin
          Result:= True;
          GetMousePos(x, y);
          Break;
        end else
          Result:= false
      end;
    end;
    
    function SmithBars: Boolean;
    var
      x, y, i, ii, iii, e, t: Integer;
    begin
      if not LoggedIn then
        Exit;
    
      FFlag(0);
      Wait(RandomRange(300,500));
    
      repeat
        if FindAnvil(x, y) then
        begin
          if SmithingScreen then Break;
          SMART_DrawDotsEx(true, Anvil.ATPA[i], 255);
          iii:= 0;
          Wait(RandomRange(200,400));
          Mouse(x, y, 0, 0, false);
          for ii:=0 to 250 do
          begin
            //Writeln('Waiting for ''Choose'' Option.');
            if ChooseOption('mith') then
            begin
              FFlag(0);
              SMART_ClearCanvas;
              Wait(RandomRange(200,400));
              MarkTime(t)
              repeat
                if SmithingScreen then
                  Break;
                if TimeFromMark(t) > 10000 then
                begin
                  Writeln('Click was somehow missed!');
                  Result:= false
                  Exit;
                end;
              until(false)
              Break;
            end;
          end;
        end else
        begin
          inc(iii);
          Writeln('Anvil: Times missed is ' +IntToStr(iii));
          Wait(500 + Random(1000));
          if iii>9 then
          begin
            Result:= false
            Exit;
          end;
        end;
      until(SmithingScreen)
      FFlag(0);
    
      FindBar(InvBar, InvBox(1), true)
    
      MarkTime(lTimer);
      repeat
        if SmithItem(SmithingItem, 'All') then
        begin
          Writeln('Smithing ' + Capitalize(SmithingItem));
          Result:= true;
          Break;
        end;
        if TimeFromMark(lTimer) > 5000 then
          Exit;
      until(false)
    
      Total_Bars:= Total_Bars + WithdrawBars;
      inc(Total_Loads);
    
      MarkTime(e);
      repeat
        wait(500+random(100));
        FindNormalRandoms;
        DoAntiBan;
        if LevelUp then
        begin
          Inc(Total_LevelUps);
          ClickToContinue;
          Result := True;
          Exit;
        end;
        if TimeFromMark(e)>(1000*60*3) then
        begin
          Players[CurrentPlayer].Loc:= 'Bar counting error';
          Result:= false;
          Break;
        end;
      Writeln('Bars left to smith: '+IntToStr(CountBar(InvBar)));
      until (CountBar(InvBar)<=0)
      RunEnergy(35);
    end;
    
    function DepositSmithed: Boolean;
    var
      i, ii: Integer;
    begin
      if not LoggedIn then
        Exit;
    
      repeat
        if OpenMyBank then
        begin
          ii:= 0;
          for i:=0 to 1000 do
          begin
            if BankScreen or PinScreen then
            begin
              Wait(100+random(50));
    
              if PinScreen then
                InPin(Players[CurrentPlayer].Pin);
    
              DepositAll;
              Result:= true;
              Exit;
            end;
          end;
        end else
        begin
          inc(ii);
          Writeln('Bank: Times missed is ' +IntToStr(ii));
          if ii>9 then
          begin
            Result:= false;
            Exit;
          end;
        end;
      until(BankScreen or Pinscreen)
    end;
    
    function WithdrawAllBars: Boolean;
    var
      x, y, i, ii: Integer;
      MSPoint, BankPoint: Tpoint;
    begin
      if not LoggedIn then
        Exit;
    
      if InvCount>0 then
        DepositSmithed;
    
      repeat
        if OpenMyBank then
        begin
          ii:=0;
          for i:=0 to 1000 do
            if BankScreen or PinScreen then
              Break;
        end else
        begin
        inc(ii);
        Writeln('Bank: Times missed is ' +IntToStr(ii));
        if ii>9 then
        begin
          Result:= false;
          Players[CurrentPlayer].Loc:= 'Could not withdraw';
          Exit;
        end;
      end;
      until(BankScreen or PinScreen)
    
      Wait(100+random(50));
    
      if PinScreen then
        InPin(Players[CurrentPlayer].Pin);
    
      if not BankScreen then Writeln('WARNING: Could not find Bankscreen; continuing anyway');
    
      FixBank;
      BankTab(1);
      while not FindColorBox(x, y, srl_outline_black, BankIndexToMSBox(1)) do
      begin
        Wait(200+Random(150));
      end;
      if FindBar(BankBar, BankIndexToMSBox(1), true) then // Currently ALWAYS updates TPA//if FindDTM(DTM_Bar, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
      Writeln('Amount of bars left: '+IntToStr(GetAmountBox(BankIndexToMSBox(1))));
        if GetAmountBox(BankIndexToMSBox(1)) <= (WithdrawBars) then
        begin
          Writeln('Out of bars!');
          Players[CurrentPlayer].Loc:= 'No bars in the bank';
          Result:= false;
          Exit;
        end;
    
        BankPoint:= BankBar.Slot;
        if Withdraw(BankPoint.x , BankPoint.y, WithdrawBars) then
          Result:= true;
    
      end else
      begin
        Writeln('Bars not found in bank');
        Players[CurrentPlayer].Loc:= 'No bars in the bank';
      end;
    
      SMART_ClearCanvas;
      //CloseBank;
    end;
    
    procedure SetupScript;
    var
      tLoad: Integer;
    begin
      MarkTime(tLoad);
    
      ClearDebug;
      ClearReport;
    
      Writeln('Setting up script...');
    
      Smart_Server := 10;
      Smart_Members := True;
      Smart_Signed := True;
      Smart_SuperDetail := False;
    
      SetupSRL;
    
      DeclarePlayers;
      LoadDTMs;
      LoadColourTol;
      LoadGlobals;
    
      SMART_SetupDebug;
      SMART_ClearCanvas;
    
      WhenBreak:= ((1000*60)*Whenbreak);
      Writeln('Script loaded in ' +IntToStr(Round(TimeFromMark(tLoad) / 1000))+ ' seconds.');
      AddOnTerminate('ProgressReport');
    end;
    
    procedure SetupPlayer;
    begin
      LoginPlayer;
      wait(100+random(50));
    
      MarkTime(RoundTime);
    
      SetRun(true);
      MakeCompass('N');
      {$IFDEF SRL5}
        SetAngle(SRL_ANGLE_HIGH);
      {$ELSE}
        SetAngle(true);
      {$ENDIF}
    
      if CheckLoc='anvil' then
        ToBank;
    
      {if not FindHammer then
      begin
        Players[CurrentPlayer].Loc:= 'You have no hammer';
        Exit;
      end;        }
    
      if not WithdrawAllBars then
        Writeln('Could not withdraw bars');
    end;
    
    procedure ProgressReport;
    var
      i: Integer;
    begin
      Players[CurrentPlayer].Worked:= PlayerWorked(CurrentPlayer);
    
      Writeln('|-------------------------------------------------------------|');
      Writeln(PadR('|                       -daazndagger-''s', 62) + '|');
      Writeln(PadR('|                 ' +ScriptName, 62) + '|');
      Writeln(PadR('|                        Version ' + ScriptVersion, 62) + '|');
      Writeln('|-------------------------------------------------------------|');
      Writeln(PadR('|     Time Running  : ' +MsToTime(GetTimeRunning, Time_Abbrev), 62) + '|');
      Writeln(PadR('|     Bars Smithed  : ' +IntToStr(Total_Bars), 62) + '|');
      Writeln(PadR('|     Loads         : ' +IntToStr(Total_Loads), 62) + '|');
      Writeln(PadR('|     Level Up''s    : ' +IntToStr(Total_LevelUps), 62) + '|');
      Writeln(PadR('|     ', 62) + '|');
      Writeln(PadR('|     False Reasons : ', 62) + '|');
      for i:=0 to HowManyPlayers-1  do
        Writeln(PadR('|       Player ' +IntToStr(i)+': ' +Players[i].Loc, 62) + '|');
      Writeln(PadR('|     ', 62) + '|');
      Writeln(PadR('|     ', 62) + '|');
      Writeln('|-------------------------------------------------------------|');
    
    end;
    
    procedure TakeBreak;
    var
      Breaktime, Timeleft, i, e: Integer;
    begin
    end;
    
    procedure LogoutProcess;
    begin
      Writeln('Loging out...');
    
      if BankScreen then CloseBank;
    
      ProgressReport;
    
      if not( lowercase(Players[CurrentPlayer].Loc) = '') then
        Players[CurrentPlayer].Active:= false;
    
      if not AllPlayersInactive then
      begin
        TakeBreak;
      end else
        Exit;
    
      NextPlayer(Players[CurrentPlayer].Active);
    end;
    
    begin
      SetupScript;
    
      SetupPlayer;
    
        repeat
          if not( lowercase(Players[CurrentPlayer].Loc) = '') then
            Break;
    
          ToAnvil;
    
          SmithBars;
    
          ToBank;
    
          DepositSmithed;
    
          WithdrawAllBars;
    
          ProgressReport;
        until false;
    
      if LoggedIn then
    end.
    a small pro

    that works thank you!!

  2. #127
    Join Date
    Feb 2012
    Location
    1,000,000,000,000 Light-years Away From Earth
    Posts
    184
    Mentioned
    1 Post(s)
    Quoted
    6 Post(s)

    Default

    It works perfectly!
    Luvin it.
    Bot like a BOSS! Loading... ????????????? 99%

  3. #128
    Join Date
    Jul 2010
    Posts
    62
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    ty thanks love my work

  4. #129
    Join Date
    Mar 2012
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It keeps missing the bank lol.

  5. #130
    Join Date
    Nov 2011
    Location
    Canada
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Does this still work?

  6. #131
    Join Date
    Mar 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Wow, it keeps missing the bank.

  7. #132
    Join Date
    Mar 2012
    Posts
    19
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Found possible Bank booths
    Bank: Times missed is 1
    Found possible Bank booths
    Bank: Times missed is 2
    Found possible Bank booths
    Bank: Times missed is 3

    all it does
    itll hover over bank.. then do that

  8. #133
    Join Date
    Oct 2011
    Posts
    422
    Mentioned
    15 Post(s)
    Quoted
    116 Post(s)

    Default

    For those having bank problems


    line 438(i think)

    if ChooseOptionMulti(['Bank','uick', 'ickly']) then

    ^^ add 'Bank' to the option

  9. #134
    Join Date
    Apr 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    can someone plz fix or make a smithing script for varrock west ty and pm me if you deside to make one

  10. #135
    Join Date
    Dec 2011
    Posts
    237
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Error: Exception: "" is an invalid integer at line 143 not sure what to do with that
    "The holy grail is to spend less time making the picture then it takes poeple to look at it"- Banksy

  11. #136
    Join Date
    Apr 2012
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by slushpuppy View Post
    For those having bank problems


    line 438(i think)

    if ChooseOptionMulti(['Bank','uick', 'ickly']) then

    ^^ add 'Bank' to the option
    fixed it perfectly thnak you

  12. #137
    Join Date
    Apr 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yup, as long as you add in that bank and just make plate bodies while having the bars in the FIRST slot this script is working flawlessly.

  13. #138
    Join Date
    Jan 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Script unreliable even with fixes. Making addy pbodies I have to restart script every 5 mins. Fix if possible plx.

  14. #139
    Join Date
    Feb 2012
    Location
    Denver, CO
    Posts
    863
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I was able to get the script to work. Even when it is running well it looks very bot like.

  15. #140
    Join Date
    Apr 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    U can get it working but it will go out of position every bank trip it moves further away from the anvil so after about 5 mins it breaks so this script needs a update whisper me if anyone can help me out here im willing to talk details in pm

  16. #141
    Join Date
    Apr 2012
    Posts
    41
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    just tried this, it started with bank interface open did 1 invi then fails to open bank, just sits there right clicking booth then clicks somewhere else

  17. #142
    Join Date
    Apr 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Error: Exception: "" is an invalid integer at line 143
    The following DTMs were not freed: [SRL - Lamp bitmap, 1, 2, 3]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]

    i got this erroe after i copied the script in the top of this page:

    [Hint] C:\Simba\Includes\SRL/SRL/core/mapwalk.simba(1353:3): Variable 'BOX' never used at line 1352
    [Error] (255:2): String error at line 254
    [Error] (255:2): Syntax error at line 254
    Compiling failed.
    Last edited by angelwithoutwings; 04-29-2012 at 07:15 PM.

  18. #143
    Join Date
    May 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    is this working?

    i keep getting errors

  19. #144
    Join Date
    Jan 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by angelwithoutwings View Post
    Error: Exception: "" is an invalid integer at line 143
    The following DTMs were not freed: [SRL - Lamp bitmap, 1, 2, 3]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]

    i got this erroe after i copied the script in the top of this page:

    [Hint] C:\Simba\Includes\SRL/SRL/core/mapwalk.simba(1353:3): Variable 'BOX' never used at line 1352
    [Error] (255:2): String error at line 254
    [Error] (255:2): Syntax error at line 254
    Compiling failed.
    I get the same thing.

  20. #145
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Out of request, here's a version that should compile right up for you. Let me know if it works.

    Simba Code:
    program SuperSavvySmither;
    {$i SRL/SRL/Misc/Smart.simba}
    {$i SRL/SRL.simba}
    {$i SRL/SRL/Misc/Paintsmart.simba}

    {==============================================================================]
    [                 Daazndagger's [S]uper [S]avvy [S]mither                      ]
    [==============================================================================]
    [                            [Simba/SCAR 3.23]                                 ]
    [                                  [SRL]                                       ]
    [                                 [SMART]                                      ]
    [------------------------------------------------------------------------------]
    [   Description:    |                                                          ]
    [-------------------.                                                          ]
    [   - I made this script in two days, so don't expect much from it :P          ]
    [     BUT, what you can expect is that it will do its job to the best          ]
    [     potential. It is the best (but only working) smither at villavu.com      ]
    [------------------------------------------------------------------------------]
    [   Features:       |                                                          ]
    [-------------------.                                                          ]
    [  ## Version 1.00 (17/7/10):                                                  ]
    [    - Initial release                                                         ]
    [    - Smiths any bars into anything                                           ]
    [    - Takes rests based on the time running                                   ]
    [    - Supports multi-player                                                   ]
    [  ## Version 1.01 (9/10/11):                                                  ]
    [    - Hammer DTM Update                                                       ]
    [  ## Version 1.02 (17/12/11):                                                 ]
    [    - Toolbelt update; assumes you have a hammer in there!                    ]
    [    - Removed DTMs, replaced with Auto-TPA Items                              ]
    [  ## Version 1.03 (25/12/11):                                                 ]
    [    - Colour update                                                           ]
    [  ## Version 1.04 (05/01/12):                                                 ]
    [    - Checks online for latest colours/tolerance                              ]
    [    - Fixed location finding bug                                              ]
    [    - Improved walking procedures                                             ]
    [  ## Version 1.05 (16/01/12):                                                 ]
    [    - Walking was re-worked                                                   ]
    [    - Minor fixes                                                             ]
    [  ## Version 1.06 (29/01/12):                                                 ]
    [    - Changed location check functions                                        ]
    [    - Bug fixes elsewhere                                                     ]
    [------------------------------------------------------------------------------]
    [   Instructions:   |                                                          ]
    [-------------------.                                                          ]
    [   1. Fill in the lines below until it says STOP!                             ]
    [   2. Make sure you have a hammer TOOLBELT!                                   ]
    [   3. Make sure you have bars VISIBLE in your bank.                           ]
    [   4. Press PLAY!                                                             ]
    [------------------------------------------------------------------------------}


    var
      WhenBreak, WithdrawBars: Integer;
      SmithingItem: String;
      x, y: Integer;

    {------------------------------------------------------------------------------]
    [  VARIBLE SETUP:                                                              ]
    [     See the thread for details.                                              ]
    [------------------------------------------------------------------------------}

    procedure LoadGlobals;
    begin
      WhenBreak    := 300000;             // Minutes until break
      SmithingItem := 'Platebody';    // What to make
      WithdrawBars := 25;             // How many bars to withdraw
    end;

    {------------------------------------------------------------------------------]
    [  DECLARE PLAYERS:                                                            ]
    [     Change accordingly.                                                      ]
    [------------------------------------------------------------------------------}

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

      with Players[0] do
      begin
        Name     :='';        // Username
        Pass     :='';        // Password
        Pin      :='';        // Your bank PIN
        Member   := true;
        Active   := true;
      end;
    end;

    {------------------------------------------------------------------------------}
    {                STOP STOP   STOP STOP   STOP-STOP    STOP STOP                }
    {                STOP           STOP     STOP STOP    STOP    |                }
    {      =====     STOP STOP      STOP     STOP STOP    STOP STOP     =====      }
    {                     STOP      STOP     STOP STOP    STOP                     }
    {                STOP STOP      STOP     STOP-STOP    STOP                     }
    {------------------------------------------------------------------------------}

    const
      ScriptVersion = '1.06';
      ScriptName    = '[S]uper [S]avvy [S]mither';

    { *** For HSL Colours}
      C_HUE = 0;
      C_SAT = 1;
      C_LUM = 2;

    type
      TObjectProperties = record
        Colour, Tol: Integer;
        HSL: Array[0..2] of Extended;
        HSMod: Array[0..1] of Extended;
        TPA: TPointArray;
        ATPA: array of TPointArray;
      end;

    type
      TTPAItem = Record
        Outline, Width, Height, Colour: Integer;
        Box: TBox;
        Slot: TPoint;
      end;

    var
      DTM_MMBank, DTM_MMBank2: Integer; //DTM_Bar, DTM_Hammer: Integer;
      BankBar, InvBar: TTPAItem;
      RoundTime, lTimer: Integer;
      Anvil, BankBooth: TObjectProperties;
      Total_LevelUps, Total_Bars, Total_Loads: Integer;

    procedure LoadDTMs;
    begin
      DTM_MMBank := DTMFromString('mbQAAAHicY2VgYFBhQWBZIJYD4tVA8eVAvAGI1wPxIiB+ycDE8PLLNzD++YcRjJmB4uiYEQsGAwCVng6l');
      DTM_MMBank2 := DTMFromString('mbQAAAHicY2VgYNjDxMAwE4g5mBkYDgPpI0D8GCj+E4i/A/EjIOZiZGB4ycDE0NXeAsbtpT4MGTGuDP9BcmiYEQsGAwDgtw5H');
    end;

    // Only works for integers > 0
    function LoadIntegerOnline(var int: Integer; site: String): Boolean;
    var
      IntAsString: String;
    begin
      int:= -1;
      IntAsString:= GetPage(site);
      if Length(IntAsString) > 10 then
        Exit;
      int:= StrToInt(IntAsString);
      if int <> -1 then
        Result:= True;
    end;

    procedure LoadColourTol;
    begin

      if not LoadIntegerOnline(Anvil.Colour, 'http://pastehtml.com/view/bjl2gebfi.txt') then
        Anvil.Colour:= 5066064; //4473927; //4671307; //4013376; //3947839;
      if not LoadIntegerOnline(Anvil.Tol, 'http://pastehtml.com/view/bjl2mrvbi.txt') then
        Anvil.Tol:= 5;

      ColorToHSL(Anvil.Colour, Anvil.HSL[C_HUE], Anvil.HSL[C_SAT], Anvil.HSL[C_LUM]);
      Anvil.HSMod[C_HUE]:= (Anvil.HSL[C_HUE] / Anvil.HSL[C_LUM]);    // 2.78
      Anvil.HSMod[C_SAT]:= (Anvil.HSL[C_SAT] / Anvil.HSL[C_LUM]);    // 0.28
      Writeln('Anvil Mods: Hue=' +FloatToStr(Anvil.HSMod[C_HUE])+ '  Sat=' +FloatToStr(Anvil.HSMod[C_SAT]));

      if not LoadIntegerOnline(BankBooth.Colour, 'http://pastehtml.com/view/bjl2tds4u.txt') then
        BankBooth.Colour:= 2575450; //2707293; //2245198;
      if not LoadIntegerOnline(BankBooth.Tol, 'http://pastehtml.com/view/bjl2wevlq.txt') then
        BankBooth.Tol:= 3;

      ColorToHSL(BankBooth.Colour, BankBooth.HSL[C_HUE], BankBooth.HSL[C_SAT], BankBooth.HSL[C_LUM]);
      BankBooth.HSMod[C_HUE]:= (BankBooth.HSL[C_HUE] / BankBooth.HSL[C_LUM]);
      BankBooth.HSMod[C_SAT]:= (BankBooth.HSL[C_SAT] / BankBooth.HSL[C_LUM]);
      Writeln('BankBooth Mods: Hue=' +FloatToStr(BankBooth.HSMod[C_HUE])+ '  Sat=' +FloatToStr(BankBooth.HSMod[C_SAT]));
    end;

    function FindColorBox(var x, y: Integer; color: Integer; b: TBox): Boolean;
    begin
      Result:= FindColor(x, y, color, b.X1, b.Y1, b.X2, b.Y2);
    end;

    // Credits to Narcle; I reworked his idea :)
    function SetBarTPA(bOutline, bWidth, bHeight, bColour: Integer; bBox: TBox; bPoint: TPoint): TTPAItem;
    begin
      with Result do
      begin
        Outline := bOutline;
        Width := bWidth;
        Height := bHeight;
        Colour := bColour;
        Box := bBox;
        Slot := MSTPointToBankPoint(bPoint);
      end;
    end;

    // Credits to Narcle; I reworked his idea :)
    function UpdateBarTPA(var Item: TTPAItem; InvS: TBox): Boolean;
    var
      BarTPA: TPointArray;  // TPA stored in this
      T: TPoint;            // For the middle point of Item
      B: TBox;              // Item bounds
    begin
      B := InvS;
      FindColorsTolerance(BarTPA, srl_outline_black, B.x1, B.y1, B.x2, B.y2, 0);
      if Length(BarTPA) < 1 then
        Exit;
      B := GetTPABounds(BarTPA);
      T := MiddleTPA(BarTPA);
      Item := SetBarTPA(Length(BarTPA), iAbs(B.x2-B.x1), iAbs(B.y2-B.y1), GetColor(T.x, T.y), B, T);
      Result := true;
    end;

    // Credits to Narcle; I reworked his idea :)
    function FindBar(var Item: TTPAItem; InvS: TBox; UpdateTrue: Boolean): Boolean;
    var
      TPA: TPointArray;
      B: TBox;
      T: TPoint;
    begin
      if UpdateTrue then
        UpdateBarTPA(Item, InvS);

      B := InvS;
      FindColorsTolerance(TPA, srl_outline_black, B.x1, B.y1, B.x2, B.y2, 0);
      if Length(TPA) < 1 then
        Exit;
      B := GetTPABounds(TPA);
      T := MiddleTPA(TPA);

      SMART_DrawDotsEx(true, TPA, 255);

      if (Length(TPA) = Item.Outline) and (iAbs(B.x2-B.x1) = Item.Width) and (iAbs(B.y2-B.y1) = Item.Height) then
        if Item.Colour > -1 then
          Result := GetColor(T.x, T.y) = Item.Colour
        else
          Result := True;
    end;

    function CountBar(Item: TTPAItem): Integer;
    var
      i, count: Integer;
    begin
      count:= 0;
      for i:=1 to 28 do
        if FindBar(Item, InvBox(i), False) then
        begin
          Inc(count);
          Status('Counting Bars, you have: ' +IntToStr(count));
        end;

      Result:= count;
    end;

    function SmithingScreen: Boolean;
    var
      a, b: Integer;
    begin
      Result:= FindColor(a, b, 2071039, 250-3, 44-3, 250+3, 44+3)
    end;

    procedure FixSmith(Down: Boolean);
    var
       TPA: TPointarray;
       ColScroll: Integer;
       X, Y, S: Integer;
    begin
      if not SmithingScreen then Exit;

      if Down then
      begin
          TPA := [Point(500, 306), Point(499, 315)];
          ColScroll := 592137;
      end else
      begin
        TPA := [Point(500, 75), Point(499, 66)];
        ColScroll := 1250841;
      end;

      if GetColor(TPA[0].x, TPA[0].y) <> ColScroll then
      begin
        X := TPA[1].x - 4 + Random(8);
        Y := TPA[1].y - 4 + Random(8);
        HoldMouse(X, Y, mouse_left);
        S := GetSystemTime;
        while GetColor(TPA[0].x, TPA[0].y) <> 657930 do
          if GetSystemTime - S > 3500 then
            Break
          else
            Wait(10);
        ReleaseMouse(X, Y, mouse_left);
      end else
        Writeln('Already in correct area');
    end;

    function SmithItem(Item, Amount: string): Boolean;
    var
       Items: array [0..1] of TStringarray;
       Scroll: Boolean;
    begin
      if not SmithingScreen then Exit;

      Items[0] := ['Dagger', 'Hatchet', 'Mace', 'Medium helm', 'Crossbow bolts',   //5
                   'Sword', 'Nails', 'Studs', 'Arrow tips', 'Scimitar',            //10
                   'Crossbowlimbs', 'Longsword', 'Throwing knife', 'Full helm',    //14
                   'Square shield', 'Bullseye lantern', 'Warhammer',               //17
                   'Battleaxe'];    //18

      Items[1] := ['Chainbody', 'Kite shield', '2-handed sword', 'Plateskirt',
                   'Platelegs', 'Platebody'];    //6

      if StrInArr(Item, Items[0]) then
      begin
        Writeln('Item is in first array');
      end else
      begin
        if StrInArr(Item, Items[1]) then
        begin
          Writeln('Item is in second array');
          Scroll := True
        end;
      end;

      if Scroll then       // or FixSmith(Scroll);
        FixSmith(True);

      case Capitalize(Item) of
        Items[0][0] : MouseBox(25, 70, 78, 90, mouse_right);
        Items[0][1] : MouseBox(148, 71, 193, 89, mouse_right);
        Items[0][2] : MouseBox(264, 73, 306, 90, mouse_right);
        Items[0][3] : MouseBox(388, 71, 439, 91 , mouse_right);
        Items[0][4] : MouseBox(23, 118, 74, 144, mouse_right);
        Items[0][5] : MouseBox(145, 124, 186, 142, mouse_right);
        Items[0][6] : MouseBox(393, 124, 431, 141, mouse_right);
        Items[0][7] : MouseBox(27, 174, 67, 192, mouse_right);
        Items[0][8] : MouseBox(144, 177, 192, 195, mouse_right);
        Items[0][9] : MouseBox(267, 181, 313, 196, mouse_right);
        Items[0][10] : MouseBox(394, 176, 432, 193, mouse_right);
        Items[0][11], Items[1][0] : MouseBox(34, 232, 80, 246, mouse_right);
        Items[0][12], Items[1][1] : MouseBox(147, 231, 188, 146, mouse_right);
        Items[0][13] : MouseBox(266, 232, 315, 245, mouse_right);
        Items[0][14], Items[1][2] : MouseBox(391, 229, 446, 245, mouse_right);
        Items[0][15], Items[1][3] : MouseBox(26, 281, 71, 297, mouse_right);
        Items[0][16], Items[1][5] : MouseBox(249, 270, 326, 292, mouse_right); //266, 279, 313, 297
        Items[0][17] : MouseBox(396, 282, 446, 299, mouse_right);
       // Items[1][5] : MouseBox(249, 270, 326, 292, 2);
        Items[1][4] : MouseBox(140, 275, 192, 293, mouse_right);
      end;
      Writeln('MouseBoxed');

      if StrInArr(Amount, ['1', '5', 'All']) then
      begin
        Result := ChooseOption('ake '+Capitalize(Amount));
      end else
      begin
        if ChooseOption('ake X') then
        begin
          Wait(2000 + Random(2000));
          TypeSend(Amount);
          Result := True;
        end;
      end;
    end;

    procedure DoAntiBan;
    begin;
      if not(LoggedIn) then Exit;
      case Random(150) of
        10: begin
              HoverSkill('smithing', false);
              GameTab(Tab_Inv);
            end;
        15: begin
              HoverSkill('smithing', false);
              GameTab(Tab_Inv);
            end;
        20: RandomMovement;
        25: RandomMovement;
        30: RandomAngle(1);
        40: PickupMouse;
        50: RandomAngle(1);
        60: RandomRClick;
        70: ExamineInv;
      end;
    end;

    function FindMyBank(var x, y: Integer): Boolean;
    var
      CTS, i, h: Integer;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(BankBooth.HSMod[C_HUE], BankBooth.HSMod[C_SAT]);

      FindColorsSpiralTolerance(MSCX, MSCY, BankBooth.TPA, BankBooth.Colour, MSX1, MSY1, MSX2, MSY2, BankBooth.Tol);
      ColorToleranceSpeed(CTS);

      BankBooth.ATPA := TPAToATPAEx(BankBooth.TPA, 40, 40);
      SortATPAFrom(BankBooth.ATPA, Point(MSCX, MSCY));

      if ( Length(BankBooth.ATPA)=0 ) then
      begin
        Writeln('No Bank booths found.');
        Result:= false;
      end else
        Writeln('Found possible Bank booths');

      h:= High(BankBooth.ATPA);
      For i := 0 to h do
      begin
        SMART_DrawDotsEx(true, BankBooth.ATPA[i], 255);
        MiddleTPAEx(BankBooth.ATPA[i], x, y);
        MMouse(x, y, 5, 2);
        SMART_ClearCanvas;
        if ( WaitUpTextMulti(['Bank', 'ooth', 'nk boo'], 200) ) then
        begin
          Result:= True;
          GetMousePos(x, y);
          Break;
        end else
          Result:= false
      end;
    end;

    function OpenMyBank: Boolean;
    var
      x, y, t: Integer;
    begin
      MakeCompass(90);
      if not LoggedIn then
        Exit;

      if BankScreen or Pinscreen then
      begin
        Result:= true;
        Exit;
      end;

      if FindMyBank(x, y) then
      begin
        Mouse(x, y, 0, 0, mouse_right);
        MarkTime(t)
        repeat
          if WaitOptionMulti(['Bank','uick', 'ickly'], 800) then
          begin
            FFlag(1);
            Wait(RandomRange(200,400));
            Result:= true;
            Exit;
          end;
          if TimeFromMark(t) > 3000 then
            Exit;
        until(false)
      end;
    end;

    function CheckLoc_OLD: String;
    var
      D_Dungeon, D_Anvil: Integer;
    begin
      if not LoggedIn then
        Exit;

      SymbolAccuracy := 0.7;
      repeat
        if FindSymbol(x, y, 'anvil') then
        begin
          D_Anvil:= Distance(x, y, MMCX, MMCY);
          Break;
        end else
          Writeln('Can''t find Anvil Symbol.');

        SymbolAccuracy := SymbolAccuracy - 0.1;
      until(SymbolAccuracy < 0.2)

      SymbolAccuracy := 0.7;
      repeat
        if FindSymbol(x, y, 'dungeon') then
        begin
          D_Dungeon:= Distance(x, y, MMCX, MMCY);
          Break;
        end else
          Writeln('Can''t find Dungeon Symbol.');

        SymbolAccuracy := SymbolAccuracy - 0.1;
      until(SymbolAccuracy < 0.2)

      if D_Anvil<D_Dungeon then
      begin
        Result:= 'anvil';
        Writeln('You''re at the anvil.');
      end else
      begin
        Result:= 'bank';
        Writeln('You''re at the bank.');
      end;
    end;

    function CheckLoc: String;
    var
      roadCol, t: Integer;
      divTPA: TPointArray;
      locBox: TBox;
    begin
      MarkTime(t);
      MakeCompass('N');
      roadCol := 9080459; // AutoColor(srl_VarrockRoadColor);
      if roadCol = -1 then
        Writeln('AutoColor Failed.');
      FindColorsTolerance(divTPA, roadCol, MMCX, MMY1, MMX2, MMY2, 10);  //FindColors(divTPA, roadCol, MMCX, MMY1, MMX2, MMY2);
      if Length(divTPA) < 1 then
        Writeln('No road colour found.');
      SMART_DrawDotsEx(True, divTPA, clBlue);
      locBox := GetTPABounds(divTPA);
      locBox := IntToBox(locBox.x1, locBox.y1, locBox.x2, locBox.y2 - ((locBox.y2 - locBox.y1) / 2));
      SMART_DrawBoxEx(False, locBox, clGreen);
      //Wait(5000);

      if MMCY > locBox.y2 then
        Result := 'anvil'
      else
        Result := 'bank';

      Writeln('You are at: ' +Result);
      Writeln('Function took ' +IntToStr(TimeFromMark(t))+ ' ms');
    end;

    function ToAnvil: Boolean;
    begin
      if not LoggedIn then
        Exit;

      MakeCompass('N');
      MouseBox(641, 123, 652, 132, 1);
      FFlag(0);
      Wait(RandomRange(600, 800));

      if (CheckLoc <> 'anvil') then
      begin
        if FindSymbol(x, y, 'anvil') then
        begin
          Mouse(x, y, 3, 3, mouse_left);
          FFlag(0);
          Wait(RandomRange(600, 800));
        end else
          Exit;
      end else
        Result:= True;

    end;

    function ToBank: Boolean;
    var
      t: Integer;
      angle: Extended;
      foundDTM: Boolean;
    begin
      if not LoggedIn then
        Exit;

      MakeCompass('N');
      SetAngle(SRL_ANGLE_HIGH);
      foundDTM := false;
      MarkTime(t)
      repeat
        if FindDTMRotated(DTM_MMBank, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/8, Pi/8, Pi/32, angle)
        or FindDTMRotated(DTM_MMBank2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/8, Pi/8, Pi/32, angle) then
        begin
          Writeln('DTM found at angle: ' +FloatToStr(angle));
          Mouse(x + RandomRange(3, 6), y - RandomRange(2, 5), 3, 3, true);
          foundDTM := true;
          Break;
        end else
          Writeln('Could not find MM DTM!');
      until(TimeFromMark(t)>3000)

      if not foundDTM then
        Mouse(605, 50 - RandomRange(2, 5), 5, 5, mouse_left);

      FFlag(2);
      Wait(RandomRange(500,750));

      Result:= (CheckLoc='bank');
    end;

    function FindAnvil(var x, y: Integer): Boolean;
    var
      CTS, i, h: Integer;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(Anvil.HSMod[C_HUE], Anvil.HSMod[C_SAT]);

      FindColorsSpiralTolerance(MSCX, MSCY, Anvil.TPA, Anvil.Colour, MSX1, MSY1, MSX2, MSY2, Anvil.Tol);
      ColorToleranceSpeed(CTS);

      Anvil.ATPA := TPAToATPAEx(Anvil.TPA, 40, 30);
      SortATPAFrom(Anvil.ATPA, Point(MSCX, MSCY));

      if ( Length(Anvil.ATPA)=0 ) then
      begin
        Writeln('No anvils found.');
        Result:= false;
      end else
        Writeln('Found ' +IntToStr(Length(Anvil.ATPA))+ ' possible anvils?');

      h:= High(Anvil.ATPA);
      For i := 0 to h do
      begin
        MiddleTPAEx(Anvil.ATPA[i], x, y);
        MMouse(x, y, 2, 2);
        SMART_DrawDotsEx(true, Anvil.ATPA[i], 255);
        if ( WaitUpTextMulti(['Anvi', 'nvil'], 200) ) then
        begin
          Result:= True;
          GetMousePos(x, y);
          Break;
        end else
          Result:= false
      end;
    end;

    function SmithBars: Boolean;
    var
      x, y, i, ii, iii, e, t: Integer;
    begin
      if not LoggedIn then
        Exit;

      FFlag(0);
      Wait(RandomRange(300,500));

      repeat
        if FindAnvil(x, y) then
        begin
          if SmithingScreen then Break;
          SMART_DrawDotsEx(true, Anvil.ATPA[i], 255);
          iii:= 0;
          Wait(RandomRange(200,400));
          Mouse(x, y, 0, 0, false);
          for ii:=0 to 250 do
          begin
            //Writeln('Waiting for ''Choose'' Option.');
            if ChooseOption('mith') then
            begin
              FFlag(0);
              SMART_ClearCanvas;
              Wait(RandomRange(200,400));
              MarkTime(t)
              repeat
                if SmithingScreen then
                  Break;
                if TimeFromMark(t) > 10000 then
                begin
                  Writeln('Click was somehow missed!');
                  Result:= false
                  Exit;
                end;
              until(false)
              Break;
            end;
          end;
        end else
        begin
          inc(iii);
          Writeln('Anvil: Times missed is ' +IntToStr(iii));
          Wait(500 + Random(1000));
          if iii>9 then
          begin
            Result:= false
            Exit;
          end;
        end;
      until(SmithingScreen)
      FFlag(0);

      FindBar(InvBar, InvBox(1), true)

      MarkTime(lTimer);
      repeat
        if SmithItem(SmithingItem, 'All') then
        begin
          Writeln('Smithing ' + Capitalize(SmithingItem));
          Result:= true;
          Break;
        end;
        if TimeFromMark(lTimer) > 5000 then
          Exit;
      until(false)

      Total_Bars:= Total_Bars + WithdrawBars;
      inc(Total_Loads);

      MarkTime(e);
      repeat
        wait(500+random(100));
        FindNormalRandoms;
        DoAntiBan;
        if LevelUp then
        begin
          Inc(Total_LevelUps);
          ClickToContinue;
          Result := True;
          Exit;
        end;
        if TimeFromMark(e)>(1000*60*3) then
        begin
          Players[CurrentPlayer].Loc:= 'Bar counting error';
          Result:= false;
          Break;
        end;
      Writeln('Bars left to smith: '+IntToStr(CountBar(InvBar)));
      until (CountBar(InvBar)<=0)
      RunEnergy(35);
    end;

    function DepositSmithed: Boolean;
    var
      i, ii: Integer;
    begin
      if not LoggedIn then
        Exit;

      repeat
        if OpenMyBank then
        begin
          ii:= 0;
          for i:=0 to 1000 do
          begin
            if BankScreen or PinScreen then
            begin
              Wait(100+random(50));

              if PinScreen then
                InPin(Players[CurrentPlayer].Pin);

              DepositAll;
              Result:= true;
              Exit;
            end;
          end;
        end else
        begin
          inc(ii);
          Writeln('Bank: Times missed is ' +IntToStr(ii));
          if ii>9 then
          begin
            Result:= false;
            Exit;
          end;
        end;
      until(BankScreen or Pinscreen)
    end;

    function WithdrawAllBars: Boolean;
    var
      x, y, i, ii: Integer;
      BankPoint: Tpoint;
    begin
      if not LoggedIn then
        Exit;

      if InvCount>0 then
        DepositSmithed;

      repeat
        if OpenMyBank then
        begin
          ii:=0;
          for i:=0 to 1000 do
            if BankScreen or PinScreen then
              Break;
        end else
        begin
        inc(ii);
        Writeln('Bank: Times missed is ' +IntToStr(ii));
        if ii>9 then
        begin
          Result:= false;
          Players[CurrentPlayer].Loc:= 'Could not withdraw';
          Exit;
        end;
      end;
      until(BankScreen or PinScreen)

      Wait(100+random(50));

      if PinScreen then
        InPin(Players[CurrentPlayer].Pin);

      if not BankScreen then Writeln('WARNING: Could not find Bankscreen; continuing anyway');

      FixBank;
      BankTab(1);
      while not FindColorBox(x, y, srl_outline_black, BankIndexToMSBox(1)) do
      begin
        Wait(200+Random(150));
      end;
      if FindBar(BankBar, BankIndexToMSBox(1), true) then // Currently ALWAYS updates TPA//if FindDTM(DTM_Bar, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
      Writeln('Amount of bars left: '+IntToStr(GetAmountBox(BankIndexToMSBox(1))));
        if GetAmountBox(BankIndexToMSBox(1)) <= (WithdrawBars) then
        begin
          Writeln('Out of bars!');
          Players[CurrentPlayer].Loc:= 'No bars in the bank';
          Result:= false;
          Exit;
        end;

        BankPoint:= BankBar.Slot;
        if Withdraw(BankPoint.x , BankPoint.y, WithdrawBars) then
          Result:= true;

      end else
      begin
        Writeln('Bars not found in bank');
        Players[CurrentPlayer].Loc:= 'No bars in the bank';
      end;

      SMART_ClearCanvas;
      //CloseBank;
    end;

    procedure SetupScript;
    var
      tLoad: Integer;
    begin
      MarkTime(tLoad);

      ClearDebug;
      ClearReport;

      Writeln('Setting up script...');

      Smart_Server := 10;
      Smart_Members := True;
      Smart_Signed := True;
      Smart_SuperDetail := False;

      SetupSRL;

      DeclarePlayers;
      LoadDTMs;
      LoadColourTol;
      LoadGlobals;

      SMART_SetupDebug;
      SMART_ClearCanvas;

      WhenBreak:= ((1000*60)*Whenbreak);
      Writeln('Script loaded in ' +IntToStr(Round(TimeFromMark(tLoad) / 1000))+ ' seconds.');
      AddOnTerminate('ProgressReport');
    end;

    procedure SetupPlayer;
    begin
      LoginPlayer;
      wait(100+random(50));

      MarkTime(RoundTime);

      SetRun(true);
      MakeCompass('N');
      {$IFDEF SRL5}
        SetAngle(SRL_ANGLE_HIGH);
      {$ELSE}
        SetAngle(true);
      {$ENDIF}

      if CheckLoc='anvil' then
        ToBank;

      {if not FindHammer then
      begin
        Players[CurrentPlayer].Loc:= 'You have no hammer';
        Exit;
      end;        }


      if not WithdrawAllBars then
        Writeln('Could not withdraw bars');
    end;

    procedure ProgressReport;
    var
      i: Integer;
    begin
      Players[CurrentPlayer].Worked:= PlayerWorked(CurrentPlayer);

      Writeln('|-------------------------------------------------------------|');
      Writeln(PadR('|                       -daazndagger-''s', 62) + '|');
      Writeln(PadR('|                 ' +ScriptName, 62) + '|');
      Writeln(PadR('|                        Version ' + ScriptVersion, 62) + '|');
      Writeln('|-------------------------------------------------------------|');
      Writeln(PadR('|     Time Running  : ' +MsToTime(GetTimeRunning, Time_Abbrev), 62) + '|');
      Writeln(PadR('|     Bars Smithed  : ' +IntToStr(Total_Bars), 62) + '|');
      Writeln(PadR('|     Loads         : ' +IntToStr(Total_Loads), 62) + '|');
      Writeln(PadR('|     Level Up''s    : ' +IntToStr(Total_LevelUps), 62) + '|');
      Writeln(PadR('|     ', 62) + '|');
      Writeln(PadR('|     False Reasons : ', 62) + '|');
      for i:=0 to HowManyPlayers-1  do
        Writeln(PadR('|       Player ' +IntToStr(i)+': ' +Players[i].Loc, 62) + '|');
      Writeln(PadR('|     ', 62) + '|');
      Writeln(PadR('|     ', 62) + '|');
      Writeln('|-------------------------------------------------------------|');

    end;

    procedure LogoutProcess;
    begin
      Writeln('Loging out...');

      if BankScreen then CloseBank;

      ProgressReport;

      if not( lowercase(Players[CurrentPlayer].Loc) = '') then
        Players[CurrentPlayer].Active:= false;

      if AllPlayersInactive then
        Exit;

      NextPlayer(Players[CurrentPlayer].Active);
    end;

    begin
      SetupScript;

      SetupPlayer;

        repeat
          if not( lowercase(Players[CurrentPlayer].Loc) = '') then
            Break;

          ToAnvil;

          SmithBars;

          ToBank;

          DepositSmithed;

          WithdrawAllBars;

          ProgressReport;
        until false;

      if LoggedIn then
    end.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  21. #146
    Join Date
    Jan 2012
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Setting up script...
    SRL Compiled in 0 msec
    SMART Initialized.
    Loaded: Server 10, Members: True, Signed: True, Super Detail: False.
    Error: Exception: "" is an invalid integer at line 143
    The following DTMs were not freed: [SRL - Lamp bitmap, 1, 2, 3]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]


    It compiles but then that comes up :s

  22. #147
    Join Date
    Apr 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Dark_Yaz View Post
    Setting up script...
    SRL Compiled in 0 msec
    SMART Initialized.
    Loaded: Server 10, Members: True, Signed: True, Super Detail: False.
    Error: Exception: "" is an invalid integer at line 143
    The following DTMs were not freed: [SRL - Lamp bitmap, 1, 2, 3]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]


    It compiles but then that comes up :s
    I'm getting the same thing :/

  23. #148
    Join Date
    May 2012
    Posts
    30
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Out of request, here's a version that should compile right up for you. Let me know if it works.

    Simba Code:
    program SuperSavvySmither;
    {$i SRL/SRL/Misc/Smart.simba}
    {$i SRL/SRL.simba}
    {$i SRL/SRL/Misc/Paintsmart.simba}

    {==============================================================================]
    [                 Daazndagger's [S]uper [S]avvy [S]mither                      ]
    [==============================================================================]
    [                            [Simba/SCAR 3.23]                                 ]
    [                                  [SRL]                                       ]
    [                                 [SMART]                                      ]
    [------------------------------------------------------------------------------]
    [   Description:    |                                                          ]
    [-------------------.                                                          ]
    [   - I made this script in two days, so don't expect much from it :P          ]
    [     BUT, what you can expect is that it will do its job to the best          ]
    [     potential. It is the best (but only working) smither at villavu.com      ]
    [------------------------------------------------------------------------------]
    [   Features:       |                                                          ]
    [-------------------.                                                          ]
    [  ## Version 1.00 (17/7/10):                                                  ]
    [    - Initial release                                                         ]
    [    - Smiths any bars into anything                                           ]
    [    - Takes rests based on the time running                                   ]
    [    - Supports multi-player                                                   ]
    [  ## Version 1.01 (9/10/11):                                                  ]
    [    - Hammer DTM Update                                                       ]
    [  ## Version 1.02 (17/12/11):                                                 ]
    [    - Toolbelt update; assumes you have a hammer in there!                    ]
    [    - Removed DTMs, replaced with Auto-TPA Items                              ]
    [  ## Version 1.03 (25/12/11):                                                 ]
    [    - Colour update                                                           ]
    [  ## Version 1.04 (05/01/12):                                                 ]
    [    - Checks online for latest colours/tolerance                              ]
    [    - Fixed location finding bug                                              ]
    [    - Improved walking procedures                                             ]
    [  ## Version 1.05 (16/01/12):                                                 ]
    [    - Walking was re-worked                                                   ]
    [    - Minor fixes                                                             ]
    [  ## Version 1.06 (29/01/12):                                                 ]
    [    - Changed location check functions                                        ]
    [    - Bug fixes elsewhere                                                     ]
    [------------------------------------------------------------------------------]
    [   Instructions:   |                                                          ]
    [-------------------.                                                          ]
    [   1. Fill in the lines below until it says STOP!                             ]
    [   2. Make sure you have a hammer TOOLBELT!                                   ]
    [   3. Make sure you have bars VISIBLE in your bank.                           ]
    [   4. Press PLAY!                                                             ]
    [------------------------------------------------------------------------------}


    var
      WhenBreak, WithdrawBars: Integer;
      SmithingItem: String;
      x, y: Integer;

    {------------------------------------------------------------------------------]
    [  VARIBLE SETUP:                                                              ]
    [     See the thread for details.                                              ]
    [------------------------------------------------------------------------------}

    procedure LoadGlobals;
    begin
      WhenBreak    := 300000;             // Minutes until break
      SmithingItem := 'Platebody';    // What to make
      WithdrawBars := 25;             // How many bars to withdraw
    end;

    {------------------------------------------------------------------------------]
    [  DECLARE PLAYERS:                                                            ]
    [     Change accordingly.                                                      ]
    [------------------------------------------------------------------------------}

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

      with Players[0] do
      begin
        Name     :='';        // Username
        Pass     :='';        // Password
        Pin      :='';        // Your bank PIN
        Member   := true;
        Active   := true;
      end;
    end;

    {------------------------------------------------------------------------------}
    {                STOP STOP   STOP STOP   STOP-STOP    STOP STOP                }
    {                STOP           STOP     STOP STOP    STOP    |                }
    {      =====     STOP STOP      STOP     STOP STOP    STOP STOP     =====      }
    {                     STOP      STOP     STOP STOP    STOP                     }
    {                STOP STOP      STOP     STOP-STOP    STOP                     }
    {------------------------------------------------------------------------------}

    const
      ScriptVersion = '1.06';
      ScriptName    = '[S]uper [S]avvy [S]mither';

    { *** For HSL Colours}
      C_HUE = 0;
      C_SAT = 1;
      C_LUM = 2;

    type
      TObjectProperties = record
        Colour, Tol: Integer;
        HSL: Array[0..2] of Extended;
        HSMod: Array[0..1] of Extended;
        TPA: TPointArray;
        ATPA: array of TPointArray;
      end;

    type
      TTPAItem = Record
        Outline, Width, Height, Colour: Integer;
        Box: TBox;
        Slot: TPoint;
      end;

    var
      DTM_MMBank, DTM_MMBank2: Integer; //DTM_Bar, DTM_Hammer: Integer;
      BankBar, InvBar: TTPAItem;
      RoundTime, lTimer: Integer;
      Anvil, BankBooth: TObjectProperties;
      Total_LevelUps, Total_Bars, Total_Loads: Integer;

    procedure LoadDTMs;
    begin
      DTM_MMBank := DTMFromString('mbQAAAHicY2VgYFBhQWBZIJYD4tVA8eVAvAGI1wPxIiB+ycDE8PLLNzD++YcRjJmB4uiYEQsGAwCVng6l');
      DTM_MMBank2 := DTMFromString('mbQAAAHicY2VgYNjDxMAwE4g5mBkYDgPpI0D8GCj+E4i/A/EjIOZiZGB4ycDE0NXeAsbtpT4MGTGuDP9BcmiYEQsGAwDgtw5H');
    end;

    // Only works for integers > 0
    function LoadIntegerOnline(var int: Integer; site: String): Boolean;
    var
      IntAsString: String;
    begin
      int:= -1;
      IntAsString:= GetPage(site);
      if Length(IntAsString) > 10 then
        Exit;
      int:= StrToInt(IntAsString);
      if int <> -1 then
        Result:= True;
    end;

    procedure LoadColourTol;
    begin

      if not LoadIntegerOnline(Anvil.Colour, 'http://pastehtml.com/view/bjl2gebfi.txt') then
        Anvil.Colour:= 5066064; //4473927; //4671307; //4013376; //3947839;
      if not LoadIntegerOnline(Anvil.Tol, 'http://pastehtml.com/view/bjl2mrvbi.txt') then
        Anvil.Tol:= 5;

      ColorToHSL(Anvil.Colour, Anvil.HSL[C_HUE], Anvil.HSL[C_SAT], Anvil.HSL[C_LUM]);
      Anvil.HSMod[C_HUE]:= (Anvil.HSL[C_HUE] / Anvil.HSL[C_LUM]);    // 2.78
      Anvil.HSMod[C_SAT]:= (Anvil.HSL[C_SAT] / Anvil.HSL[C_LUM]);    // 0.28
      Writeln('Anvil Mods: Hue=' +FloatToStr(Anvil.HSMod[C_HUE])+ '  Sat=' +FloatToStr(Anvil.HSMod[C_SAT]));

      if not LoadIntegerOnline(BankBooth.Colour, 'http://pastehtml.com/view/bjl2tds4u.txt') then
        BankBooth.Colour:= 2575450; //2707293; //2245198;
      if not LoadIntegerOnline(BankBooth.Tol, 'http://pastehtml.com/view/bjl2wevlq.txt') then
        BankBooth.Tol:= 3;

      ColorToHSL(BankBooth.Colour, BankBooth.HSL[C_HUE], BankBooth.HSL[C_SAT], BankBooth.HSL[C_LUM]);
      BankBooth.HSMod[C_HUE]:= (BankBooth.HSL[C_HUE] / BankBooth.HSL[C_LUM]);
      BankBooth.HSMod[C_SAT]:= (BankBooth.HSL[C_SAT] / BankBooth.HSL[C_LUM]);
      Writeln('BankBooth Mods: Hue=' +FloatToStr(BankBooth.HSMod[C_HUE])+ '  Sat=' +FloatToStr(BankBooth.HSMod[C_SAT]));
    end;

    function FindColorBox(var x, y: Integer; color: Integer; b: TBox): Boolean;
    begin
      Result:= FindColor(x, y, color, b.X1, b.Y1, b.X2, b.Y2);
    end;

    // Credits to Narcle; I reworked his idea :)
    function SetBarTPA(bOutline, bWidth, bHeight, bColour: Integer; bBox: TBox; bPoint: TPoint): TTPAItem;
    begin
      with Result do
      begin
        Outline := bOutline;
        Width := bWidth;
        Height := bHeight;
        Colour := bColour;
        Box := bBox;
        Slot := MSTPointToBankPoint(bPoint);
      end;
    end;

    // Credits to Narcle; I reworked his idea :)
    function UpdateBarTPA(var Item: TTPAItem; InvS: TBox): Boolean;
    var
      BarTPA: TPointArray;  // TPA stored in this
      T: TPoint;            // For the middle point of Item
      B: TBox;              // Item bounds
    begin
      B := InvS;
      FindColorsTolerance(BarTPA, srl_outline_black, B.x1, B.y1, B.x2, B.y2, 0);
      if Length(BarTPA) < 1 then
        Exit;
      B := GetTPABounds(BarTPA);
      T := MiddleTPA(BarTPA);
      Item := SetBarTPA(Length(BarTPA), iAbs(B.x2-B.x1), iAbs(B.y2-B.y1), GetColor(T.x, T.y), B, T);
      Result := true;
    end;

    // Credits to Narcle; I reworked his idea :)
    function FindBar(var Item: TTPAItem; InvS: TBox; UpdateTrue: Boolean): Boolean;
    var
      TPA: TPointArray;
      B: TBox;
      T: TPoint;
    begin
      if UpdateTrue then
        UpdateBarTPA(Item, InvS);

      B := InvS;
      FindColorsTolerance(TPA, srl_outline_black, B.x1, B.y1, B.x2, B.y2, 0);
      if Length(TPA) < 1 then
        Exit;
      B := GetTPABounds(TPA);
      T := MiddleTPA(TPA);

      SMART_DrawDotsEx(true, TPA, 255);

      if (Length(TPA) = Item.Outline) and (iAbs(B.x2-B.x1) = Item.Width) and (iAbs(B.y2-B.y1) = Item.Height) then
        if Item.Colour > -1 then
          Result := GetColor(T.x, T.y) = Item.Colour
        else
          Result := True;
    end;

    function CountBar(Item: TTPAItem): Integer;
    var
      i, count: Integer;
    begin
      count:= 0;
      for i:=1 to 28 do
        if FindBar(Item, InvBox(i), False) then
        begin
          Inc(count);
          Status('Counting Bars, you have: ' +IntToStr(count));
        end;

      Result:= count;
    end;

    function SmithingScreen: Boolean;
    var
      a, b: Integer;
    begin
      Result:= FindColor(a, b, 2071039, 250-3, 44-3, 250+3, 44+3)
    end;

    procedure FixSmith(Down: Boolean);
    var
       TPA: TPointarray;
       ColScroll: Integer;
       X, Y, S: Integer;
    begin
      if not SmithingScreen then Exit;

      if Down then
      begin
          TPA := [Point(500, 306), Point(499, 315)];
          ColScroll := 592137;
      end else
      begin
        TPA := [Point(500, 75), Point(499, 66)];
        ColScroll := 1250841;
      end;

      if GetColor(TPA[0].x, TPA[0].y) <> ColScroll then
      begin
        X := TPA[1].x - 4 + Random(8);
        Y := TPA[1].y - 4 + Random(8);
        HoldMouse(X, Y, mouse_left);
        S := GetSystemTime;
        while GetColor(TPA[0].x, TPA[0].y) <> 657930 do
          if GetSystemTime - S > 3500 then
            Break
          else
            Wait(10);
        ReleaseMouse(X, Y, mouse_left);
      end else
        Writeln('Already in correct area');
    end;

    function SmithItem(Item, Amount: string): Boolean;
    var
       Items: array [0..1] of TStringarray;
       Scroll: Boolean;
    begin
      if not SmithingScreen then Exit;

      Items[0] := ['Dagger', 'Hatchet', 'Mace', 'Medium helm', 'Crossbow bolts',   //5
                   'Sword', 'Nails', 'Studs', 'Arrow tips', 'Scimitar',            //10
                   'Crossbowlimbs', 'Longsword', 'Throwing knife', 'Full helm',    //14
                   'Square shield', 'Bullseye lantern', 'Warhammer',               //17
                   'Battleaxe'];    //18

      Items[1] := ['Chainbody', 'Kite shield', '2-handed sword', 'Plateskirt',
                   'Platelegs', 'Platebody'];    //6

      if StrInArr(Item, Items[0]) then
      begin
        Writeln('Item is in first array');
      end else
      begin
        if StrInArr(Item, Items[1]) then
        begin
          Writeln('Item is in second array');
          Scroll := True
        end;
      end;

      if Scroll then       // or FixSmith(Scroll);
        FixSmith(True);

      case Capitalize(Item) of
        Items[0][0] : MouseBox(25, 70, 78, 90, mouse_right);
        Items[0][1] : MouseBox(148, 71, 193, 89, mouse_right);
        Items[0][2] : MouseBox(264, 73, 306, 90, mouse_right);
        Items[0][3] : MouseBox(388, 71, 439, 91 , mouse_right);
        Items[0][4] : MouseBox(23, 118, 74, 144, mouse_right);
        Items[0][5] : MouseBox(145, 124, 186, 142, mouse_right);
        Items[0][6] : MouseBox(393, 124, 431, 141, mouse_right);
        Items[0][7] : MouseBox(27, 174, 67, 192, mouse_right);
        Items[0][8] : MouseBox(144, 177, 192, 195, mouse_right);
        Items[0][9] : MouseBox(267, 181, 313, 196, mouse_right);
        Items[0][10] : MouseBox(394, 176, 432, 193, mouse_right);
        Items[0][11], Items[1][0] : MouseBox(34, 232, 80, 246, mouse_right);
        Items[0][12], Items[1][1] : MouseBox(147, 231, 188, 146, mouse_right);
        Items[0][13] : MouseBox(266, 232, 315, 245, mouse_right);
        Items[0][14], Items[1][2] : MouseBox(391, 229, 446, 245, mouse_right);
        Items[0][15], Items[1][3] : MouseBox(26, 281, 71, 297, mouse_right);
        Items[0][16], Items[1][5] : MouseBox(249, 270, 326, 292, mouse_right); //266, 279, 313, 297
        Items[0][17] : MouseBox(396, 282, 446, 299, mouse_right);
       // Items[1][5] : MouseBox(249, 270, 326, 292, 2);
        Items[1][4] : MouseBox(140, 275, 192, 293, mouse_right);
      end;
      Writeln('MouseBoxed');

      if StrInArr(Amount, ['1', '5', 'All']) then
      begin
        Result := ChooseOption('ake '+Capitalize(Amount));
      end else
      begin
        if ChooseOption('ake X') then
        begin
          Wait(2000 + Random(2000));
          TypeSend(Amount);
          Result := True;
        end;
      end;
    end;

    procedure DoAntiBan;
    begin;
      if not(LoggedIn) then Exit;
      case Random(150) of
        10: begin
              HoverSkill('smithing', false);
              GameTab(Tab_Inv);
            end;
        15: begin
              HoverSkill('smithing', false);
              GameTab(Tab_Inv);
            end;
        20: RandomMovement;
        25: RandomMovement;
        30: RandomAngle(1);
        40: PickupMouse;
        50: RandomAngle(1);
        60: RandomRClick;
        70: ExamineInv;
      end;
    end;

    function FindMyBank(var x, y: Integer): Boolean;
    var
      CTS, i, h: Integer;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(BankBooth.HSMod[C_HUE], BankBooth.HSMod[C_SAT]);

      FindColorsSpiralTolerance(MSCX, MSCY, BankBooth.TPA, BankBooth.Colour, MSX1, MSY1, MSX2, MSY2, BankBooth.Tol);
      ColorToleranceSpeed(CTS);

      BankBooth.ATPA := TPAToATPAEx(BankBooth.TPA, 40, 40);
      SortATPAFrom(BankBooth.ATPA, Point(MSCX, MSCY));

      if ( Length(BankBooth.ATPA)=0 ) then
      begin
        Writeln('No Bank booths found.');
        Result:= false;
      end else
        Writeln('Found possible Bank booths');

      h:= High(BankBooth.ATPA);
      For i := 0 to h do
      begin
        SMART_DrawDotsEx(true, BankBooth.ATPA[i], 255);
        MiddleTPAEx(BankBooth.ATPA[i], x, y);
        MMouse(x, y, 5, 2);
        SMART_ClearCanvas;
        if ( WaitUpTextMulti(['Bank', 'ooth', 'nk boo'], 200) ) then
        begin
          Result:= True;
          GetMousePos(x, y);
          Break;
        end else
          Result:= false
      end;
    end;

    function OpenMyBank: Boolean;
    var
      x, y, t: Integer;
    begin
      MakeCompass(90);
      if not LoggedIn then
        Exit;

      if BankScreen or Pinscreen then
      begin
        Result:= true;
        Exit;
      end;

      if FindMyBank(x, y) then
      begin
        Mouse(x, y, 0, 0, mouse_right);
        MarkTime(t)
        repeat
          if WaitOptionMulti(['Bank','uick', 'ickly'], 800) then
          begin
            FFlag(1);
            Wait(RandomRange(200,400));
            Result:= true;
            Exit;
          end;
          if TimeFromMark(t) > 3000 then
            Exit;
        until(false)
      end;
    end;

    function CheckLoc_OLD: String;
    var
      D_Dungeon, D_Anvil: Integer;
    begin
      if not LoggedIn then
        Exit;

      SymbolAccuracy := 0.7;
      repeat
        if FindSymbol(x, y, 'anvil') then
        begin
          D_Anvil:= Distance(x, y, MMCX, MMCY);
          Break;
        end else
          Writeln('Can''t find Anvil Symbol.');

        SymbolAccuracy := SymbolAccuracy - 0.1;
      until(SymbolAccuracy < 0.2)

      SymbolAccuracy := 0.7;
      repeat
        if FindSymbol(x, y, 'dungeon') then
        begin
          D_Dungeon:= Distance(x, y, MMCX, MMCY);
          Break;
        end else
          Writeln('Can''t find Dungeon Symbol.');

        SymbolAccuracy := SymbolAccuracy - 0.1;
      until(SymbolAccuracy < 0.2)

      if D_Anvil<D_Dungeon then
      begin
        Result:= 'anvil';
        Writeln('You''re at the anvil.');
      end else
      begin
        Result:= 'bank';
        Writeln('You''re at the bank.');
      end;
    end;

    function CheckLoc: String;
    var
      roadCol, t: Integer;
      divTPA: TPointArray;
      locBox: TBox;
    begin
      MarkTime(t);
      MakeCompass('N');
      roadCol := 9080459; // AutoColor(srl_VarrockRoadColor);
      if roadCol = -1 then
        Writeln('AutoColor Failed.');
      FindColorsTolerance(divTPA, roadCol, MMCX, MMY1, MMX2, MMY2, 10);  //FindColors(divTPA, roadCol, MMCX, MMY1, MMX2, MMY2);
      if Length(divTPA) < 1 then
        Writeln('No road colour found.');
      SMART_DrawDotsEx(True, divTPA, clBlue);
      locBox := GetTPABounds(divTPA);
      locBox := IntToBox(locBox.x1, locBox.y1, locBox.x2, locBox.y2 - ((locBox.y2 - locBox.y1) / 2));
      SMART_DrawBoxEx(False, locBox, clGreen);
      //Wait(5000);

      if MMCY > locBox.y2 then
        Result := 'anvil'
      else
        Result := 'bank';

      Writeln('You are at: ' +Result);
      Writeln('Function took ' +IntToStr(TimeFromMark(t))+ ' ms');
    end;

    function ToAnvil: Boolean;
    begin
      if not LoggedIn then
        Exit;

      MakeCompass('N');
      MouseBox(641, 123, 652, 132, 1);
      FFlag(0);
      Wait(RandomRange(600, 800));

      if (CheckLoc <> 'anvil') then
      begin
        if FindSymbol(x, y, 'anvil') then
        begin
          Mouse(x, y, 3, 3, mouse_left);
          FFlag(0);
          Wait(RandomRange(600, 800));
        end else
          Exit;
      end else
        Result:= True;

    end;

    function ToBank: Boolean;
    var
      t: Integer;
      angle: Extended;
      foundDTM: Boolean;
    begin
      if not LoggedIn then
        Exit;

      MakeCompass('N');
      SetAngle(SRL_ANGLE_HIGH);
      foundDTM := false;
      MarkTime(t)
      repeat
        if FindDTMRotated(DTM_MMBank, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/8, Pi/8, Pi/32, angle)
        or FindDTMRotated(DTM_MMBank2, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/8, Pi/8, Pi/32, angle) then
        begin
          Writeln('DTM found at angle: ' +FloatToStr(angle));
          Mouse(x + RandomRange(3, 6), y - RandomRange(2, 5), 3, 3, true);
          foundDTM := true;
          Break;
        end else
          Writeln('Could not find MM DTM!');
      until(TimeFromMark(t)>3000)

      if not foundDTM then
        Mouse(605, 50 - RandomRange(2, 5), 5, 5, mouse_left);

      FFlag(2);
      Wait(RandomRange(500,750));

      Result:= (CheckLoc='bank');
    end;

    function FindAnvil(var x, y: Integer): Boolean;
    var
      CTS, i, h: Integer;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(Anvil.HSMod[C_HUE], Anvil.HSMod[C_SAT]);

      FindColorsSpiralTolerance(MSCX, MSCY, Anvil.TPA, Anvil.Colour, MSX1, MSY1, MSX2, MSY2, Anvil.Tol);
      ColorToleranceSpeed(CTS);

      Anvil.ATPA := TPAToATPAEx(Anvil.TPA, 40, 30);
      SortATPAFrom(Anvil.ATPA, Point(MSCX, MSCY));

      if ( Length(Anvil.ATPA)=0 ) then
      begin
        Writeln('No anvils found.');
        Result:= false;
      end else
        Writeln('Found ' +IntToStr(Length(Anvil.ATPA))+ ' possible anvils?');

      h:= High(Anvil.ATPA);
      For i := 0 to h do
      begin
        MiddleTPAEx(Anvil.ATPA[i], x, y);
        MMouse(x, y, 2, 2);
        SMART_DrawDotsEx(true, Anvil.ATPA[i], 255);
        if ( WaitUpTextMulti(['Anvi', 'nvil'], 200) ) then
        begin
          Result:= True;
          GetMousePos(x, y);
          Break;
        end else
          Result:= false
      end;
    end;

    function SmithBars: Boolean;
    var
      x, y, i, ii, iii, e, t: Integer;
    begin
      if not LoggedIn then
        Exit;

      FFlag(0);
      Wait(RandomRange(300,500));

      repeat
        if FindAnvil(x, y) then
        begin
          if SmithingScreen then Break;
          SMART_DrawDotsEx(true, Anvil.ATPA[i], 255);
          iii:= 0;
          Wait(RandomRange(200,400));
          Mouse(x, y, 0, 0, false);
          for ii:=0 to 250 do
          begin
            //Writeln('Waiting for ''Choose'' Option.');
            if ChooseOption('mith') then
            begin
              FFlag(0);
              SMART_ClearCanvas;
              Wait(RandomRange(200,400));
              MarkTime(t)
              repeat
                if SmithingScreen then
                  Break;
                if TimeFromMark(t) > 10000 then
                begin
                  Writeln('Click was somehow missed!');
                  Result:= false
                  Exit;
                end;
              until(false)
              Break;
            end;
          end;
        end else
        begin
          inc(iii);
          Writeln('Anvil: Times missed is ' +IntToStr(iii));
          Wait(500 + Random(1000));
          if iii>9 then
          begin
            Result:= false
            Exit;
          end;
        end;
      until(SmithingScreen)
      FFlag(0);

      FindBar(InvBar, InvBox(1), true)

      MarkTime(lTimer);
      repeat
        if SmithItem(SmithingItem, 'All') then
        begin
          Writeln('Smithing ' + Capitalize(SmithingItem));
          Result:= true;
          Break;
        end;
        if TimeFromMark(lTimer) > 5000 then
          Exit;
      until(false)

      Total_Bars:= Total_Bars + WithdrawBars;
      inc(Total_Loads);

      MarkTime(e);
      repeat
        wait(500+random(100));
        FindNormalRandoms;
        DoAntiBan;
        if LevelUp then
        begin
          Inc(Total_LevelUps);
          ClickToContinue;
          Result := True;
          Exit;
        end;
        if TimeFromMark(e)>(1000*60*3) then
        begin
          Players[CurrentPlayer].Loc:= 'Bar counting error';
          Result:= false;
          Break;
        end;
      Writeln('Bars left to smith: '+IntToStr(CountBar(InvBar)));
      until (CountBar(InvBar)<=0)
      RunEnergy(35);
    end;

    function DepositSmithed: Boolean;
    var
      i, ii: Integer;
    begin
      if not LoggedIn then
        Exit;

      repeat
        if OpenMyBank then
        begin
          ii:= 0;
          for i:=0 to 1000 do
          begin
            if BankScreen or PinScreen then
            begin
              Wait(100+random(50));

              if PinScreen then
                InPin(Players[CurrentPlayer].Pin);

              DepositAll;
              Result:= true;
              Exit;
            end;
          end;
        end else
        begin
          inc(ii);
          Writeln('Bank: Times missed is ' +IntToStr(ii));
          if ii>9 then
          begin
            Result:= false;
            Exit;
          end;
        end;
      until(BankScreen or Pinscreen)
    end;

    function WithdrawAllBars: Boolean;
    var
      x, y, i, ii: Integer;
      BankPoint: Tpoint;
    begin
      if not LoggedIn then
        Exit;

      if InvCount>0 then
        DepositSmithed;

      repeat
        if OpenMyBank then
        begin
          ii:=0;
          for i:=0 to 1000 do
            if BankScreen or PinScreen then
              Break;
        end else
        begin
        inc(ii);
        Writeln('Bank: Times missed is ' +IntToStr(ii));
        if ii>9 then
        begin
          Result:= false;
          Players[CurrentPlayer].Loc:= 'Could not withdraw';
          Exit;
        end;
      end;
      until(BankScreen or PinScreen)

      Wait(100+random(50));

      if PinScreen then
        InPin(Players[CurrentPlayer].Pin);

      if not BankScreen then Writeln('WARNING: Could not find Bankscreen; continuing anyway');

      FixBank;
      BankTab(1);
      while not FindColorBox(x, y, srl_outline_black, BankIndexToMSBox(1)) do
      begin
        Wait(200+Random(150));
      end;
      if FindBar(BankBar, BankIndexToMSBox(1), true) then // Currently ALWAYS updates TPA//if FindDTM(DTM_Bar, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
      Writeln('Amount of bars left: '+IntToStr(GetAmountBox(BankIndexToMSBox(1))));
        if GetAmountBox(BankIndexToMSBox(1)) <= (WithdrawBars) then
        begin
          Writeln('Out of bars!');
          Players[CurrentPlayer].Loc:= 'No bars in the bank';
          Result:= false;
          Exit;
        end;

        BankPoint:= BankBar.Slot;
        if Withdraw(BankPoint.x , BankPoint.y, WithdrawBars) then
          Result:= true;

      end else
      begin
        Writeln('Bars not found in bank');
        Players[CurrentPlayer].Loc:= 'No bars in the bank';
      end;

      SMART_ClearCanvas;
      //CloseBank;
    end;

    procedure SetupScript;
    var
      tLoad: Integer;
    begin
      MarkTime(tLoad);

      ClearDebug;
      ClearReport;

      Writeln('Setting up script...');

      Smart_Server := 10;
      Smart_Members := True;
      Smart_Signed := True;
      Smart_SuperDetail := False;

      SetupSRL;

      DeclarePlayers;
      LoadDTMs;
      LoadColourTol;
      LoadGlobals;

      SMART_SetupDebug;
      SMART_ClearCanvas;

      WhenBreak:= ((1000*60)*Whenbreak);
      Writeln('Script loaded in ' +IntToStr(Round(TimeFromMark(tLoad) / 1000))+ ' seconds.');
      AddOnTerminate('ProgressReport');
    end;

    procedure SetupPlayer;
    begin
      LoginPlayer;
      wait(100+random(50));

      MarkTime(RoundTime);

      SetRun(true);
      MakeCompass('N');
      {$IFDEF SRL5}
        SetAngle(SRL_ANGLE_HIGH);
      {$ELSE}
        SetAngle(true);
      {$ENDIF}

      if CheckLoc='anvil' then
        ToBank;

      {if not FindHammer then
      begin
        Players[CurrentPlayer].Loc:= 'You have no hammer';
        Exit;
      end;        }


      if not WithdrawAllBars then
        Writeln('Could not withdraw bars');
    end;

    procedure ProgressReport;
    var
      i: Integer;
    begin
      Players[CurrentPlayer].Worked:= PlayerWorked(CurrentPlayer);

      Writeln('|-------------------------------------------------------------|');
      Writeln(PadR('|                       -daazndagger-''s', 62) + '|');
      Writeln(PadR('|                 ' +ScriptName, 62) + '|');
      Writeln(PadR('|                        Version ' + ScriptVersion, 62) + '|');
      Writeln('|-------------------------------------------------------------|');
      Writeln(PadR('|     Time Running  : ' +MsToTime(GetTimeRunning, Time_Abbrev), 62) + '|');
      Writeln(PadR('|     Bars Smithed  : ' +IntToStr(Total_Bars), 62) + '|');
      Writeln(PadR('|     Loads         : ' +IntToStr(Total_Loads), 62) + '|');
      Writeln(PadR('|     Level Up''s    : ' +IntToStr(Total_LevelUps), 62) + '|');
      Writeln(PadR('|     ', 62) + '|');
      Writeln(PadR('|     False Reasons : ', 62) + '|');
      for i:=0 to HowManyPlayers-1  do
        Writeln(PadR('|       Player ' +IntToStr(i)+': ' +Players[i].Loc, 62) + '|');
      Writeln(PadR('|     ', 62) + '|');
      Writeln(PadR('|     ', 62) + '|');
      Writeln('|-------------------------------------------------------------|');

    end;

    procedure LogoutProcess;
    begin
      Writeln('Loging out...');

      if BankScreen then CloseBank;

      ProgressReport;

      if not( lowercase(Players[CurrentPlayer].Loc) = '') then
        Players[CurrentPlayer].Active:= false;

      if AllPlayersInactive then
        Exit;

      NextPlayer(Players[CurrentPlayer].Active);
    end;

    begin
      SetupScript;

      SetupPlayer;

        repeat
          if not( lowercase(Players[CurrentPlayer].Loc) = '') then
            Break;

          ToAnvil;

          SmithBars;

          ToBank;

          DepositSmithed;

          WithdrawAllBars;

          ProgressReport;
        until false;

      if LoggedIn then
    end.
    Thanks! It works great for me!

  24. #149
    Join Date
    May 2012
    Posts
    30
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    He is getting stuck when he disposed a load of platebodys (made 21 plates)

    It says: "The following DTMs are not freed: [2, 3]"

  25. #150
    Join Date
    Feb 2012
    Posts
    25
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The new posted version works for me. But it always runs to the room east of the room wih the anvils in it. And then has to run around the wall when it goes to smith. Very bot like. How can i adjust where it clicks on the compass? its just to the left a few degrees.

Page 6 of 8 FirstFirst ... 45678 LastLast

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
  •