Results 1 to 3 of 3

Thread: 1/6 done smither

  1. #1
    Join Date
    Feb 2013
    Posts
    37
    Mentioned
    0 Post(s)
    Quoted
    19 Post(s)

    Lightbulb 1/6 done smither

    Bare bones planned out script. I have yet to do most of the scripting. I would like feed back/suggestions for getting too and from the anvil. here is the code so far. I will update as I work on it. Just spent like 30 minutes planning everything.
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2007
    Location
    Mars, I thought all men were from Mars.
    Posts
    513
    Mentioned
    7 Post(s)
    Quoted
    124 Post(s)

    Default

    SPS walking is fairly acurate. And I would use ODTM as a failsafe.

    Also here is my smelter script I'm building. And I haven't even opened a rs screen yet. Almost finish with the skeleton script. Then I will go in and fill in all the correct info(dtm's, colors, sps walk pts, etc) Then I will test and fix bugs and add failsafes as necessary. Maybe you can get some ideas from it
    Simba Code:
    program new;
    {$DEFINE SMART}
    {$I SRL/SRL.Simba}
    {$I SPS/SPS.simba}
    {$i ObjectDTM\ObjDTMInclude.simba}

    type
      Item = record
      Color, Tol, Bmp, Dtm, Amount, BankLoc: Integer;
      Hue, Sat: Extended;
      UpText: TStringArray;
    end;

    type
      Bank = record
      color, Tol, Bmp, Dtm: Integer;
      Hue, Sat: Extended;
      UpText: TStringArray;
      BankPoints: TPointArray;
    end;

    type
      Furnace = record
      color, Tol, Bmp, Dtm: Integer;
      Hue, Sat: Extended;
      UpText: TStringArray;
      FurnacePoints: TPointArray;
    end;



    var
      // Item Type Vars
      CopperOre, TinOre, IronOre, SilverOre, CoalOre, GoldOre, MithrilOre,
      AdamantOre, RuneOre, SilverBar, SteelBar, GoldBar, CutSapphire, CutEmerald,
      CutRuby, CutDiamond, CutOnyx, RingMould, NecklaceMould, BraceletMould,
      AmuletMould, HolyMould, UnholyMould, SickleMould, TiaraMould: Item;

      // Bank Type Vars
      EdgevilleBank, AlKharidBank, FaladorBank, LumbridgeBank, ArdougneBank,
      NeitiznotBank: Bank;

      // Furnace Type Vars
      EdgevilleFurnace, AlKharidFurnace, FaladorFurnace, LumbridgeFurnace,
      ArdougneFurnace, NeitiznotFurnace: Furnace;

    //Global vars
    var
      SpinT: Integer;
      ItemsNeed: TStringArray;
      Restart, Bug: Boolean;
      BankPoints, FurnacePoints: TPointArray;



      Const
    {  -Location List-
      Edgeville, AlKharid, Falador, Lumbridge, Ardougne, Neitiznot}


    { -Smelting List-
      BronzeBar, IronBar, SilverBar, GoldBar, MithrilBar,
      AdamantBar, RuneBar, CannonBallLong, CannonBallShort, SapphireRing,
      EmeraldRing, RubyRing, DimondRing, DragonStoneRing, OnyxRing,
      SapphireNecklace, EmeraldNecklace, RubyNecklace, DimondNecklace,
      DragonStoneNecklace, OnyxNecklace, SapphireBracelet, EmeraldBracelet,
      RubyBracelet, DimondBracelet, DragonStoneBracelet, OnyxBracelet,
      SapphireAmulet, EmeraldAmulet, RubyAmulet, DimondAmulet, DragonStoneAmulet,
      OnyxAmulet, HolySymbol, UnholySymbol, Sickle, Tiara}


      Location     = 'Faldor';
      SmeltingWhat = 'GoldBar';


      Debug = True;

    Procedure DeclarePlayers;
    begin
    {*}{*}{*}{*}{*}{*}{*}{*}{*}{ USER SETUP  }{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}
    {*}  //SRLStats_Username := '';                                              {*}
    {*}  //SRLStats_Password := '';                                              {*}
    {*}                                                                        {*}
    {*}  HowManyPlayers := 1;                                                  {*}
    {*}  CurrentPlayer := 0;                                                   {*}
    {*}  SetLength(Players, HowManyPlayers);                                   {*}
    {*}                                                                        {*}
    {*}  Players[0].Name := '';                                                {*}
    {*}  Players[0].Pass := '';                                                {*}
    {*}  Players[0].Nick := '';                                                {*}
    {*}  Players[0].Pin  := '';                                                {*}
    {*}  Players[0].Member := False;                                           {*}
    {*}  Players[0].Active := True;                                            {*}
    {*}                                                                        {*}
    {*}                                                                        {*}
    {*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}
    {*}{*}{*}{*}{*}{*}{*}{*}{*}{ END SCRIPT SETUP  }{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}
    {*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}{*}
    end;

    Function rs_TakeScreen(s: string): Integer;
    var
      tpa: TPointArray;
      TIA, TIA2, TIA3: TIntegerArray;
      w, h: Integer;
      atpa: T2DPointArray;
    begin
      Result := BitmapFromClient(MSX1, MSY1, MSX2, MSY2);
      setBitmapSize(Result, 673, 350);
      setLength(atpa, 3);

      TPAFromBoxWrap(mmBox, atpa[0]);
      FilterPointsDist(atpa[0], 0, 76, MMCX, MMCY);
      TPAFromBoxWrap(IntToBox(MSCX - 13, MSCY - 20, MSCX + 13, MSCY + 20), ATPA[1]);
      TPAFromTextWrap(s, statchars, w, h, atpa[2]);

      GetColorsWrap(atpa[0], TIA);
      TIA2 := ColorsFromTPA(ATPA[1], clRed);
      TIA3 := ColorsFromTPA(ATPA[2], clRed);
      OffsetTPA(atpa[0], Point(-35, -6));
      OffsetTPA(atpa[2], Point(2, +336))
      MergeATPAWrap(ATPA, TPA);

      try
        fastSetPixels(Result, TPA, TIA+TIA2+TIA3);
      except
        writeln('rs_TakeScreen: Failed to set pixels, prehaps shutdown reason is too long!');
      end;
    end;
    // By Ollybest
    Procedure rs_SaveScreenshot(reason, savePath: string);
    var
      bmp, x: Integer;
    begin
      if (not(loggedIn)) then
        Exit;

      bmp := rs_TakeScreen(reason);
      if FileExists(savePath + ' [' + ToStr(x) +']' + '.png') then
        while FileExists(savePath + ' [' + ToStr(x) + ']' + '.png') do
          Inc(x);

      try
        SaveBitmap(bmp, savePath + ' [' + ToStr(x) + ']' + '.png');
      except
        writeln('rs_TakeScreenshot: Failed saving screenshot');
      finally
        FreeBitmap(bmp);
      end;
    end;

    // By Ollybest
    Procedure shutdown(s: string);
    var
      path, name: string;
    begin
      path := AppPath + 'Scripts\BudsGuildFisherBugImgs';
      name := 'Shutdown - '+ TheDate(Date_Day)+ ' ';
      if not DirectoryExists(Path) then
        CreateDirectory(Path);
      rs_SaveScreenshot(s, Path + Name);
    end;

    procedure SwitchWorlds;
    begin
      WaitFunc(@ExitToLobby, RandomRange(1000, 1200), RandomRange(8000, 10000));
      ChangeWorld(RandomWorld(True,False));
      WaitFunc(@loggedin, RandomRange(1000, 1200), RandomRange(1000, 30000));

      while not ExitSquealOfFortune do
      begin
        wait(100);
      end;
    end;


    Procedure PaintCross(x,y,col: Integer);
    var
      CTPA ,HighTPA, i, c: Integer;
      TP: Tpoint;
      TPA, NewTPA: TPointArray;
    begin
      SetLength(TPA, 104);
      SetLength(NewTPA, Length(TPA));
      //Draw right
      TP := Point(x, y);
      for CTPA:= 0 to 9 do
      begin
       TPA[CTPA] := TP;
       TP := point(TP.x + 1, TP.y);
      end;
      TP := Point(x, y - 1);
      for CTPA := 10 to 17 do
      begin
       TPA[CTPA] := TP;
       TP := point(TP.x + 1, TP.y);
      end;
      TP := Point(x,y+1);
      for CTPA:= 18 to 25 do
      begin
       TPA[CTPA] := TP;
       TP := point(TP.x + 1, TP.y);
      end;
      //Draw down
      TP := Point(x, y);
      for CTPA := 26 to 35 do
      begin
       TPA[CTPA] := TP;
       TP := point(TP.x, TP.y + 1);
      end;
      TP := Point(x + 1, y);
      for CTPA := 36 to 43 do
      begin
       TPA[CTPA] := TP;
       TP := point(TP.x, TP.y + 1);
      end;
      TP := Point(x - 1, y);
      for CTPA := 44 to 51 do
      begin
       TPA[CTPA] := TP;
       TP := point(TP.x, TP.y + 1);
      end;
      //Draw left
      TP := Point(x, y);
      for CTPA := 52 to 61 do
      begin
       TPA[CTPA] := TP;
       TP := point(TP.x - 1, TP.y);
      end;
      TP := Point(x, y + 1);
      for CTPA := 62 to 69 do
      begin
       TPA[CTPA] := TP;
       TP := point(TP.x - 1, TP.y);
      end;
      TP := Point(x, y - 1);
      for CTPA := 70 to 77 do
      begin
       TPA[CTPA] := TP;
       TP := point(TP.x - 1, TP.y);
      end;
      //Draw up
      TP := Point(x, y);
      for CTPA:= 78 to 87 do
      begin
       TPA[CTPA] := TP;
       TP := point(TP.x, TP.y - 1);
      end;
      TP := Point(x + 1, y);
      for CTPA := 88 to 95 do
      begin
       TPA[CTPA] := TP;
       TP := point(TP.x, TP.y - 1);
      end;
      TP := Point(x - 1, y);
      for CTPA:= 96 to 103 do
      begin
       TPA[CTPA] := TP;
       TP := point(TP.x, TP.y - 1);
      end;
      c := 0;
      HighTPA := High(TPA)
      for i := 0 to HighTPA do
      begin
        if not (TPA[i].x < MSX1 + 1) and
           not (TPA[i].x > MSX2 - 1) and
           not (TPA[i].y < MSY1 + 1) and
           not (TPA[i].y > MSY2 - 1) then
        begin
          NewTPA[c] := TPA[i];
          inc(c);
        end;
      end;

      SetLength(NewTPA, c)
      SMART_DrawDotsEx(False, NewTPA, col);
    end;

    Procedure WriteDebug(txt: string);
    begin
      if (Debug = True) then
        WriteLn(txt);
    end;

    Function CheckLogin: Boolean;
    begin
      Result := False;
      if not loggedin then
      begin
        if not loginplayer then
        begin
          Restart := True;
          Result := True;
        end;

        SetAngle(SRL_ANGLE_HIGH);
      end;

      while not ExitSquealOfFortune do
      begin
        wait(100);
      end;



    end;

    Function CheckPin: Boolean;
    begin
      Result := False;
      if CheckLogin then Exit;
      if(PinScreen)then
      begin
        if(Players[CurrentPlayer].Pin = '')then
        begin
          Writeln('We are at the pin screen and you didn''t enter a pin');
          shutdown('bug');
          if (Debug = False) then Logout;
          Bug := True;
          Exit;
        end;
        WriteDebug('Found Pin Screen');
        InPin(Players[CurrentPlayer].Pin);
        WriteDebug('Pin successfully entered');
        if WaitFunc(@BankScreen, RandomRange(200, 220), RandomRange(1000, 1200)) then
        begin
          Result := True;
        end;
      end;
    end;


    (*
    Looks uptext using 4 different methods. Returns True if found

    *)

    Function IsUpTextAdv(Text: TStringArray): Boolean;
    var
    TP : TPoint;
    begin
      Result := FindTextEx(TP.x,TP.y,Text,['UpChars'],MSX1,MSY1,MSX1+300,MSY1+30) or
                FindTextEx(TP.x,TP.y,Text,['UpChars_s'],MSX1,MSY1,MSX1+300,MSY1+30) or
                FindTextEx(TP.x,TP.y,Text,['UpCharsEx'],MSX1,MSY1,MSX1+300,MSY1+30) or
                IsUpTextMultiCustom(Text);
    end;


    (*
    Looks for both uptext and mouseover text. Returns True if found

    *)

    Function FindTextAdv(Text: TStringArray): Boolean;
    var
      x, y: Integer;
    begin
      if CheckLogin then Exit;
      Result := False;
      //Looks for uptext
      if IsUpTextAdv(Text) then
      begin
        Result := True;
      end else
      begin
        //Looks for Mouseover text
        if FindTextEx(x, y, Text, ['UpCharsEx'], MSX1, MSY1, MIX2, MIY2) then
        begin
          Result := True;
        end else
        begin
          WriteDebug('Did not Find ' + Text[0] + ' UpText');
        end;
      end;
    end;

    Procedure AntiBan;
    var
      i: Integer;
    begin
      if CheckLogin then Exit;
      i := random(1000)
      //CheckForText(CheckTextType, HopForChat);
      case i of
        111: begin
             HoverMovingObject;
           end;
        222: begin
             HoverSkill ('Fishing', False);
             GameTab(tab_Inv);
           end;
        333:
           begin
             PickUpMouse;
           end;
        444:
           begin
             RandomRClick;
           end;
        555:
           begin
             ExamineInv;
           end;
        666:
           begin
             MMouseOffClient('random');
             Wait(RandomRange(1000, 4000));
           end;
        777:
           begin
             RandomFKeys(True);
           end;
        888:
           begin
             MMouseOffClient('random');
             Wait(RandomRange(5000, 8000));
           end;
        999:
           begin
             SmallRandomMouse;
           end;
      end;
    end;

    Procedure FindSpinTicketACA;
    var
      x, y, i, ct, tmpCTS: Integer;
      box: TBox;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.11, 0.42);

      {if (TurnOnUrns = True) then
        ct := 3
      else}
    ct := 1;

      for i := ct to 28 do
      begin
        box := InvBox(i);
        if ExistsItem(i) or FindColorTolerance(x, y, 4088717, box.x1, box.y1, box.x2, box.y2, 2) then
        begin
          if FindColorTolerance(x, y, 4088717, box.x1, box.y1, box.x2, box.y2, 2) then
          begin
            InvMouse(i, 2);
            if IsUpTextAdv(['Clai','im sp','spin']) then
            begin
              WriteDebug('TicketUpText was found with UpText');
              ClickMouse2(1);
              inc(SpinT);
            end else
            begin
              WriteDebug('Did not find TicketUpText with UpText, trying Mouseover Text');
              if FindTextEx(x, y, ['Clai','im sp','spin'], ['UpCharsEx'], MSX1, MSY1, MIX2, MIY2) then
              begin
                WriteDebug('TicketUpText was found with Mouseover Text');
                ClickMouse2(1);
              inc(SpinT);
              end else
              begin
                WriteDebug('Did not Find TicketUpText');
              end;
            end;
          end;
        end;
      end;
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    end;

    Procedure CheckForSpinTicket;
    var
      x, y: Integer;
    begin
      if CheckLogin then Exit;
      if FindSpinTicketObj(x, y) then
      begin
        MMouse(x -5, y- 3, 10, 6);
        if IsUpTextAdv(['Clai','im sp','spin']) then
        begin
          WriteDebug('TicketUpText was found with UpText');
          ClickMouse2(1);
          inc(SpinT);
        end else
        begin
          WriteDebug('Did not find TicketUpText with UpText, trying Mouseover Text');
          if FindTextEx(x, y, ['Clai','im sp','spin'], ['UpCharsEx'], MSX1, MSY1, MIX2, MIY2) then
          begin
            WriteDebug('TicketUpText was found with Mouseover Text');
            ClickMouse2(1);
          inc(SpinT);
          end else
          begin
            WriteDebug('Did not Find TicketUpText');
          end;
        end;
      end else
      begin
        WriteDebug('SRL Function didn''t find a ticket, trying my way');
        FindSpinTicketACA;
      end;
    end;

    //by LeJingle!!!
    Procedure ConvertTime64(timeMS:int64; var YEAR, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND:Integer);
    var
      x: int64;
    begin
      x := timeMS;
      (* Better to do the calculations in my opinion (especially for year) now,
       * trying at run time usually Results in breaking/miscalculation.
       * Hence, commented out [equilavent] expressions
       *)

      YEAR   := x div (31536000000); // 1000 * 60 * 60 * 24 * 365 (1 year or 365 days)
      x      := x mod (31536000000);
      MONTH  := x div (2592000000); // 1000 * 60 * 60 * 24 * 30 (1 month or 30 days)
      x      := x mod (2592000000);
      WEEK   := x div (604800000); // 1000 * 60 * 60 * 24 * 7 (1 week or 7 days)
      x      := x mod (604800000);
      DAY    := x div (86400000); // 1000 * 60 * 60 * 24 (1 day or 24 hours)
      x      := x mod (86400000);
      HOUR   := x div (3600000); // 1000 * 60 * 60 (1 hour or 60 minutes)
      x      := x mod (3600000);
      MINUTE := x div (60000); // 1000 * 60 (1 minute or 60 seconds)
      x      := x mod (60000);
      SECOND := x div (1000); // 1000 (1 second, is in MS format now)
      x      := x mod (1000);
    end;

    Function MsToTime64(MS: int64): string;
    var
      STA: TVariantArray;
      Time: array [0..6] of Integer;
      i: Integer;
    begin
      Result := '';
      STA := [' Years, ', ' Months, ', ' Weeks, ', ' Days, ', ' Hours, ',
              ' Minutes and ', ' Seconds', 0];
      ConvertTime64(MS, Time[0], Time[1], Time[2], Time[3], Time[4], Time[5], Time[6]);
      for i := 0 to 6 do
        if (Time[i] > 0) or (STA[7]) or (i = 6) then
          Result := Result + PadZ(IntToStr(Time[i]), STA[7]) + STA[i];
    end;

    Function GetMyLocation: string;
    var
      MyPos: TPoint;
      BankBox, FurnaceBox: TBox;
    begin
      if CheckLogin then Exit;
      Result := 'Failed';
      MyPos := SPS_GetMyPos();

      //Bank
      case Lowercase(Location) of
        'edgeville' : BankBox := IntToBox(0, 0, 0, 0);
        'alkharid' : BankBox := IntToBox(0, 0, 0, 0);
        'falador' : BankBox := IntToBox(0, 0, 0, 0);
        'lumbridge' : BankBox := IntToBox(0, 0, 0, 0);
        'ardougne' : BankBox := IntToBox(0, 0, 0, 0);
        'neitiznot' :BankBox := IntToBox(0, 0, 0, 0);
      end;

      //Bank
      case Lowercase(Location) of
        'edgeville' : FurnaceBox := IntToBox(0, 0, 0, 0);
        'alkharid' : FurnaceBox := IntToBox(0, 0, 0, 0);
        'falador' : FurnaceBox := IntToBox(0, 0, 0, 0);
        'lumbridge' : FurnaceBox := IntToBox(0, 0, 0, 0);
        'ardougne' : FurnaceBox := IntToBox(0, 0, 0, 0);
        'neitiznot' :FurnaceBox := IntToBox(0, 0, 0, 0);
      end;

      // Furnace
      if (MyPos.x > FurnaceBox.x1) and (MyPos.x < FurnaceBox.x2) and
         (MyPos.y > FurnaceBox.y1) and (MyPos.y < FurnaceBox.y2) then
      begin
        Result := 'Furnace';
        Exit;
      end;
      // Bank
      if (MyPos.x > BankBox.x1) and (MyPos.x < BankBox.x2) and
         (MyPos.y > BankBox.x2) and (MyPos.y < BankBox.y2) then
      begin
        Result := 'Bank';
        Exit;
      end;
    end;

    Function WaitOptionExist(S: TStringArray; Time: Integer): Boolean;
    var
      T: Integer;
    begin
      Result := False;
      T := GetSystemTime + Time;
      while (GetSystemTime < T) do
      begin
        if (OptionsExist( S, False)) then
        begin
          Result := True;
          Exit;
        end;
        Wait(20 + Random(10));
      end;
    end;

    //Uses 3 dif methods to find Bank Item
    function FindBankItem(var ItemLoc: Integer; Item: string; FindType: string): Boolean;
    var
      x, y, i, TPAL, ItemColor, ItemTol, ItemDtm, ItemBmp, tmpCTS: Integer;
      TPA: TPointArray;
      Box: TBox;
      TVA: TVariantArray;
      ItemHue, ItemSat: Extended;
      ItemUpText: TStringArray;
      FoundItem: Boolean;
    begin
      Result := False;
      if CheckLogin then Exit;
      case Item of
        'CopperOre'     : begin
                            ItemColor := CopperOre.Color
                            ItemTol := CopperOre.Tol;
                            ItemHue := CopperOre.Hue;
                            ItemSat := CopperOre.Sat;
                            ItemDtm := CopperOre.Dtm;
                            ItemBmp := CopperOre.Bmp;
                            ItemUpText := CopperOre.UpText;
                          end;
        'TinOre'        : begin
                            ItemColor := TinOre.Color
                            ItemTol := TinOre.Tol;
                            ItemHue := TinOre.Hue;
                            ItemSat := TinOre.Sat;
                            ItemDtm := TinOre.Dtm;
                            ItemBmp := TinOre.Bmp;
                            ItemUpText := TinOre.UpText;
                          end;
        'IronOre'       : begin
                            ItemColor := IronOre.Color
                            ItemTol := IronOre.Tol;
                            ItemHue := IronOre.Hue;
                            ItemSat := IronOre.Sat;
                            ItemDtm := IronOre.Dtm;
                            ItemBmp := IronOre.Bmp;
                            ItemUpText := IronOre.UpText;
                          end;
        'SilverOre'     : begin
                            ItemColor := SilverOre.Color
                            ItemTol := SilverOre.Tol;
                            ItemHue := SilverOre.Hue;
                            ItemSat := SilverOre.Sat;
                            ItemDtm := SilverOre.Dtm;
                            ItemBmp := SilverOre.Bmp;
                            ItemUpText := SilverOre.UpText;
                          end;
        'CoalOre'       : begin
                            ItemColor := CoalOre.Color
                            ItemTol := CoalOre.Tol;
                            ItemHue := CoalOre.Hue;
                            ItemSat := CoalOre.Sat;
                            ItemDtm := CoalOre.Dtm;
                            ItemBmp := CoalOre.Bmp;
                            ItemUpText := CoalOre.UpText;
                          end;
        'GoldOre'       : begin
                            ItemColor := GoldOre.Color
                            ItemTol := GoldOre.Tol;
                            ItemHue := GoldOre.Hue;
                            ItemSat := GoldOre.Sat;
                            ItemDtm := GoldOre.Dtm;
                            ItemBmp := GoldOre.Bmp;
                            ItemUpText := GoldOre.UpText;
                          end;
        'MithrilOre'    : begin
                            ItemColor := MithrilOre.Color
                            ItemTol := MithrilOre.Tol;
                            ItemHue := MithrilOre.Hue;
                            ItemSat := MithrilOre.Sat;
                            ItemDtm := MithrilOre.Dtm;
                            ItemBmp := MithrilOre.Bmp;
                            ItemUpText := MithrilOre.UpText;
                          end;
        'AdamantOre'    : begin
                            ItemColor := AdamantOre.Color
                            ItemTol := AdamantOre.Tol;
                            ItemHue := AdamantOre.Hue;
                            ItemSat := AdamantOre.Sat;
                            ItemDtm := AdamantOre.Dtm;
                            ItemBmp := AdamantOre.Bmp;
                            ItemUpText := AdamantOre.UpText;
                          end;
        'RuneOre'       : begin
                            ItemColor := RuneOre.Color
                            ItemTol := RuneOre.Tol;
                            ItemHue := RuneOre.Hue;
                            ItemSat := RuneOre.Sat;
                            ItemDtm := RuneOre.Dtm;
                            ItemBmp := RuneOre.Bmp;
                            ItemUpText := RuneOre.UpText;
                          end;
        'SteelBar'      : begin
                            ItemColor := SteelBar.Color
                            ItemTol := SteelBar.Tol;
                            ItemHue := SteelBar.Hue;
                            ItemSat := SteelBar.Sat;
                            ItemDtm := SteelBar.Dtm;
                            ItemBmp := SteelBar.Bmp;
                            ItemUpText := SteelBar.UpText;
                          end;
        'SilverBar'     : begin
                            ItemColor := SilverBar.Color
                            ItemTol := SilverBar.Tol;
                            ItemHue := SilverBar.Hue;
                            ItemSat := SilverBar.Sat;
                            ItemDtm := SilverBar.Dtm;
                            ItemBmp := SilverBar.Bmp;
                            ItemUpText := SilverBar.UpText;
                          end;
        'GoldBar'       : begin
                            ItemColor := GoldBar.Color
                            ItemTol := GoldBar.Tol;
                            ItemHue := GoldBar.Hue;
                            ItemSat := GoldBar.Sat;
                            ItemDtm := GoldBar.Dtm;
                            ItemBmp := GoldBar.Bmp;
                            ItemUpText := GoldBar.UpText;
                          end;
        'RingMould'     : begin
                            ItemColor := RingMould.Color
                            ItemTol := RingMould.Tol;
                            ItemHue := RingMould.Hue;
                            ItemSat := RingMould.Sat;
                            ItemDtm := RingMould.Dtm;
                            ItemBmp := RingMould.Bmp;
                            ItemUpText := RingMould.UpText;
                          end;
        'NecklaceMould' : begin
                            ItemColor := NecklaceMould.Color
                            ItemTol := NecklaceMould.Tol;
                            ItemHue := NecklaceMould.Hue;
                            ItemSat := NecklaceMould.Sat;
                            ItemDtm := NecklaceMould.Dtm;
                            ItemBmp := NecklaceMould.Bmp;
                            ItemUpText := NecklaceMould.UpText;
                          end;
        'BraceletMould' : begin
                            ItemColor := BraceletMould.Color
                            ItemTol := BraceletMould.Tol;
                            ItemHue := BraceletMould.Hue;
                            ItemSat := BraceletMould.Sat;
                            ItemDtm := BraceletMould.Dtm;
                            ItemBmp := BraceletMould.Bmp;
                            ItemUpText := BraceletMould.UpText;
                          end;
        'AmuletMould'   : begin
                            ItemColor := AmuletMould.Color
                            ItemTol := AmuletMould.Tol;
                            ItemHue := AmuletMould.Hue;
                            ItemSat := AmuletMould.Sat;
                            ItemDtm := AmuletMould.Dtm;
                            ItemBmp := AmuletMould.Bmp;
                            ItemUpText := AmuletMould.UpText;
                          end;
        'HolyMould'     : begin
                            ItemColor := HolyMould.Color
                            ItemTol := HolyMould.Tol;
                            ItemHue := HolyMould.Hue;
                            ItemSat := HolyMould.Sat;
                            ItemDtm := HolyMould.Dtm;
                            ItemBmp := HolyMould.Bmp;
                            ItemUpText := HolyMould.UpText;
                          end;
        'UnholyMould'   : begin
                            ItemColor := UnholyMould.Color
                            ItemTol := UnholyMould.Tol;
                            ItemHue := UnholyMould.Hue;
                            ItemSat := UnholyMould.Sat;
                            ItemDtm := UnholyMould.Dtm;
                            ItemBmp := UnholyMould.Bmp;
                            ItemUpText := UnholyMould.UpText;
                          end;
        'SickleMould'   : begin
                            ItemColor := SickleMould.Color
                            ItemTol := SickleMould.Tol;
                            ItemHue := SickleMould.Hue;
                            ItemSat := SickleMould.Sat;
                            ItemDtm := SickleMould.Dtm;
                            ItemBmp := SickleMould.Bmp;
                            ItemUpText := SickleMould.UpText;
                          end;
        'TiaraMould'    : begin
                            ItemColor := TiaraMould.Color
                            ItemTol := TiaraMould.Tol;
                            ItemHue := TiaraMould.Hue;
                            ItemSat := TiaraMould.Sat;
                            ItemDtm := TiaraMould.Dtm;
                            ItemBmp := TiaraMould.Bmp;
                            ItemUpText := TiaraMould.UpText;
                          end;
        'CutSapphire'   : begin
                            ItemColor := CutSapphire.Color
                            ItemTol := CutSapphire.Tol;
                            ItemHue := CutSapphire.Hue;
                            ItemSat := CutSapphire.Sat;
                            ItemDtm := CutSapphire.Dtm;
                            ItemBmp := CutSapphire.Bmp;
                            ItemUpText := CutSapphire.UpText;
                          end;
        'CutEmerald'    : begin
                            ItemColor := CutEmerald.Color
                            ItemTol := CutEmerald.Tol;
                            ItemHue := CutEmerald.Hue;
                            ItemSat := CutEmerald.Sat;
                            ItemDtm := CutEmerald.Dtm;
                            ItemBmp := CutEmerald.Bmp;
                            ItemUpText := CutEmerald.UpText;
                          end;
        'CutRuby'       : begin
                            ItemColor := CutRuby.Color
                            ItemTol := CutRuby.Tol;
                            ItemHue := CutRuby.Hue;
                            ItemSat := CutRuby.Sat;
                            ItemDtm := CutRuby.Dtm;
                            ItemBmp := CutRuby.Bmp;
                            ItemUpText := CutRuby.UpText;
                          end;
        'CutDiamond'    : begin
                            ItemColor := CutDiamond.Color
                            ItemTol := CutDiamond.Tol;
                            ItemHue := CutDiamond.Hue;
                            ItemSat := CutDiamond.Sat;
                            ItemDtm := CutDiamond.Dtm;
                            ItemBmp := CutDiamond.Bmp;
                            ItemUpText := CutDiamond.UpText;
                          end;
        'CutOnyx'       : begin
                            ItemColor := CutOnyx.Color
                            ItemTol := CutOnyx.Tol;
                            ItemHue := CutOnyx.Hue;
                            ItemSat := CutOnyx.Sat;
                            ItemDtm := CutOnyx.Dtm;
                            ItemBmp := CutOnyx.Bmp;
                            ItemUpText := CutOnyx.UpText;
                          end;
      end;

      Box := IntToBox(MBX1, MBY1, MBX2, MBY2);
      TVA := [ItemUpText];
      if (Debug = True) then SMART_DrawBox(Box);

      case FindType of
        'Bmp' : begin
                  if not FindBitmapsSpiralTolerance(ItemBmp, x, y, TPA, MBX1, MBY1, MBX2, MBY2, 20) then
                  begin
                    WriteDebug('Did''t find any matching Bmp''s on whole bank screen');
                    if (Debug = True) then SMART_ClearCanvas;
                  end;
                end;
        'Dtm' : begin
                  if not FindDTMs(ItemDtm, TPA, MBX1, MBY1, MBX2, MBY2) then
                  begin
                    WriteDebug('Did''t find any matching Bmp''s on whole bank screen');
                    if (Debug = True) then SMART_ClearCanvas;
                  end;
                end;
        'ACA' : begin
                  tmpCTS := GetColorToleranceSpeed;
                  ColorToleranceSpeed(2);
                  SetColorSpeed2Modifiers(ItemHue, ItemSat);

                  if not FindColorsTolerance(TPA, ItemColor, MBX1, MBY1, MBX2, MBY2, ItemTol) then
                  begin
                    WriteDebug('Did''t find any matching Bmp''s on whole bank screen');
                    if (Debug = True) then SMART_ClearCanvas;
                  end;
                  ColorToleranceSpeed(tmpCTS);
                  SetColorSpeed2Modifiers(0.2, 0.2);
                end;
      end;

      TPAL := High(TPA);
      if (Debug = True) then
      begin
        for i := 0 to TPAL do
        begin
          PaintCross(TPA[i].x, TPA[i].y, clRed);
        end;
      end;

      for i := 0 to TPAL do
      begin
        MMouse(TPA[i].x, TPA[i].y, 0, 0);
        if WaitFuncEx('FindTextAdv', TVA, RandomRange(100,150),RandomRange(900,1000)) then
        begin
          WriteDebug('Item found with Bmp on whole screen');
          ItemLoc := BankPointToBankIndex(TPA[i]);
          Result := True;
          if (Debug = True) then SMART_ClearCanvas;
          Exit;
        end;
      end;
      WriteDebug('Did''t find Bmp on whole bank screen, trying single slot checker');


      FoundItem := False;
      for i := 1 to 40 do
      begin
        Box := BankIndexToMSBox(i);
        if (Debug = True) then SMART_ClearCanvas;
        if (Debug = True) then SMART_DrawBox(Box);
        case FindType of
          'Bmp' : begin
                    if FindBitmapToleranceIn(ItemBmp, x, y, Box.x1, Box.y1, Box.x2, Box.y2, 50) then
                    begin
                      WriteDebug('Found matching Bmp in slot' + IntToStr(i));
                      FoundItem := True;
                      if (Debug = True) then SMART_ClearCanvas;
                    end;
                  end;
          'Dtm' : begin
                    if FindDTM(ItemDtm, x, y, Box.x1, Box.y1, Box.x2, Box.y2) then
                    begin
                      WriteDebug('Found matching Dtm in slot' + IntToStr(i));
                      FoundItem := True;
                      if (Debug = True) then SMART_ClearCanvas;
                    end;
                  end;
          'ACA' : begin
                    tmpCTS := GetColorToleranceSpeed;
                    ColorToleranceSpeed(2);
                    SetColorSpeed2Modifiers(ItemHue, ItemSat);

                    if FindColorTolerance(x, y, ItemColor, Box.x1, Box.y1, Box.x2, Box.y2, ItemTol) then
                    begin
                      WriteDebug('Found matching Color in slot' + IntToStr(i));
                      FoundItem := True;
                      if (Debug = True) then SMART_ClearCanvas;
                    end;
                    ColorToleranceSpeed(tmpCTS);
                    SetColorSpeed2Modifiers(0.2, 0.2);
                  end;
        end;

        if (FoundItem = True) then
        begin
          MouseBankSlot(i, 2);
          if WaitFuncEx('FindTextAdv', TVA, RandomRange(100,150),RandomRange(900,1000)) then
          begin
            WriteDebug('Item found using single slot checker');
            ItemLoc := BankPointToBankIndex(TPA[i]);
            Result := True;
            if (Debug = True) then SMART_ClearCanvas;
            Exit;
          end;
        end;
      end;
      WriteDebug('Did''t find Item using single slot checker');
      if (Debug = True) then SMART_ClearCanvas;
    end;



    function FindItemInBank(Item: string; var ItemLoc: Integer): Boolean;
    var
      x, y, ItemColor, ItemTol, ItemDtm, ItemBmp: Integer;
      ItemHue, ItemSat: Extended;
      ItemUpText: TStringArray;
    begin
      if CheckLogin then Exit;
      //Tries to find Item with Bmp
      if FindBankItem(ItemLoc, Item, 'Bmp') then
      begin
        WriteDebug('Found ' + Item + ' with Bmp');
        Result := True;
        Exit;
      end else  WriteDebug('Did''t find ' + Item + ' with Bmp');
      //Tries to find Item with DTM
      if FindBankItem(ItemLoc, Item, 'Dtm') then
      begin
        WriteDebug('Found ' + Item + ' with Dtm');
        Result := True;
        Exit;
      end else  WriteDebug('Did''t find ' + Item + ' with Dtm');
      //Tries to find Item with Color Tol 2
      if FindBankItem(ItemLoc, Item, 'ACA') then
      begin
        WriteDebug('Found ' + Item + ' with ACA');
        Result := True;
        Exit;
      end else  WriteDebug('Did''t find ' + Item + ' with ACA');
    end;

    function StoreBankItem(Item: string): Integer;
    var
      ItemLoc: Integer;
    begin
      if CheckLogin then Exit;
      case Item of
        'CopperOre'     : ItemLoc := CopperOre.BankLoc;
        'TinOre'        : ItemLoc := TinOre.BankLoc;
        'IronOre'       : ItemLoc := IronOre.BankLoc ;
        'SilverOre'     : ItemLoc := SilverOre.BankLoc;
        'CoalOre'       : ItemLoc := CoalOre.BankLoc;
        'GoldOre'       : ItemLoc := GoldOre.BankLoc;
        'MithrilOre'    : ItemLoc := MithrilOre.BankLoc;
        'AdamantOre'    : ItemLoc := AdamantOre.BankLoc;
        'RuneOre'       : ItemLoc := RuneOre.BankLoc;
        'SteelBar'      : ItemLoc := SteelBar.BankLoc ;
        'SilverBar'     : ItemLoc := SilverBar.BankLoc;
        'GoldBar'       : ItemLoc := GoldBar.BankLoc;
        'RingMould'     : ItemLoc := RingMould.BankLoc;
        'NecklaceMould' : ItemLoc := NecklaceMould.BankLoc;
        'BraceletMould' : ItemLoc := BraceletMould.BankLoc;
        'AmuletMould'   : ItemLoc := AmuletMould.BankLoc;
        'HolyMould'     : ItemLoc := HolyMould.BankLoc;
        'UnholyMould'   : ItemLoc := UnholyMould.BankLoc;
        'SickleMould'   : ItemLoc := SickleMould.BankLoc;
        'TiaraMould'    : ItemLoc := TiaraMould.BankLoc;
        'CutSapphire'   : ItemLoc := CutSapphire.BankLoc;
        'CutEmerald'    : ItemLoc := CutEmerald.BankLoc;
        'CutRuby'       : ItemLoc := CutRuby.BankLoc;
        'CutDiamond'    : ItemLoc := CutDiamond.BankLoc;
        'CutOnyx'       : ItemLoc := CutOnyx.BankLoc;
      end;

      if not(ItemLoc = 0) then
      begin
        WriteDebug('Found stored ' + Item + ' in slot ' + IntToStr(ItemLoc));
        Result := ItemLoc;
      end else
      begin
        if FindItemInBank(Item, ItemLoc) then
        begin
          case Item of
            'CopperOre'     : CopperOre.BankLoc := ItemLoc;
            'TinOre'        : TinOre.BankLoc := ItemLoc;
            'IronOre'       : IronOre.BankLoc := ItemLoc;
            'SilverOre'     : SilverOre.BankLoc := ItemLoc;
            'CoalOre'       : CoalOre.BankLoc := ItemLoc;
            'GoldOre'       : GoldOre.BankLoc := ItemLoc;
            'MithrilOre'    : MithrilOre.BankLoc := ItemLoc;
            'AdamantOre'    : AdamantOre.BankLoc := ItemLoc;
            'RuneOre'       : RuneOre.BankLoc := ItemLoc;
            'SteelBar'      : SteelBar.BankLoc := ItemLoc ;
            'SilverBar'     : SilverBar.BankLoc := ItemLoc;
            'GoldBar'       : GoldBar.BankLoc := ItemLoc;
            'RingMould'     : RingMould.BankLoc := ItemLoc;
            'NecklaceMould' : NecklaceMould.BankLoc := ItemLoc;
            'BraceletMould' : BraceletMould.BankLoc := ItemLoc;
            'AmuletMould'   : AmuletMould.BankLoc := ItemLoc;
            'HolyMould'     : HolyMould.BankLoc := ItemLoc;
            'UnholyMould'   : UnholyMould.BankLoc := ItemLoc;
            'SickleMould'   : SickleMould.BankLoc := ItemLoc;
            'TiaraMould'    : TiaraMould.BankLoc := ItemLoc;
            'CutSapphire'   : CutSapphire.BankLoc := ItemLoc;
            'CutEmerald'    : CutEmerald.BankLoc := ItemLoc;
            'CutRuby'       : CutRuby.BankLoc := ItemLoc;
            'CutDiamond'    : CutDiamond.BankLoc := ItemLoc;
            'CutOnyx'       : CutOnyx.BankLoc := ItemLoc;
          end;
          WriteDebug(Item + ' stored in bank slot ' + IntToStr(ItemLoc));
          Result := ItemLoc;
        end else
        begin
          WriteDebug(Item + ' not found in bank');
          WriteDebug('Item storage failed');
          shutdown('Report bug');
          if (Debug = False) then Logout;
          Bug := True;
          Exit;
        end;
      end;
    end;

    function WithdrawFromBank(ItemLoc, Amount: Integer): Boolean;
    var
      amtS: string;
      x, y, c, amtI: Integer;
    begin
      Result := False;
      if CheckLogin then Exit;
      if not BankScreen then
      begin
        WriteDebug('Not at bankScreen');
        Exit;
      end;

      // Check we have more than withdraw amount in bank.
      amtI := GetBankIndexItemAmount(ItemLoc);
      if (Amount < amtI) then
      begin
        WriteDebug('You only have ' + IntToStr(amtI) + ' items in bank slot ' + IntToStr(ItemLoc) + ' and you need ' + IntToStr(amtI));
        Bug := True;
        Exit;
      end;

      //Rightclick Bankslot
      MouseBankSlot(ItemLoc, 0);
      // Loop: wait till find uptext or repeated `0 times
      while FindTextEx(x, y, ['ithdr', 'Withd', 'thdra'], ['UpCharsEx'], MSCX, MSCY, MIX2, MIY2) or (c > 10) do
      begin
        wait(RandomRange(200, 220));
        inc(c);
      end;



      // Looks for amount numbers in the option menu
      amtS := IntToStr(Amount)
      if FindTextEx(x, y, [amtS], ['UpCharsEx'], MSCX, MSCY, MIX2, MIY2) then
      begin
        WriteDebug('Withdrawing ' + amtS);
        if ChooseOption(amtS) then
        begin
          WriteDebug('Withdrawing ');
          Result := True;
        end;
      end else
      begin
        //Didn't find numbers, now will look for X option
        WriteDebug('Withdrawing ' + amtS);
        if ChooseOption('X') then
        begin
          wait(RandomRange(1000, 1500));
          SendKeys(amtS,5,5);
          wait(RandomRange(500, 1000));
          Result := True;
        end;
      end;
    end;

    function GetBankItem(Item: string; Amount: Integer): Boolean;
    var
      x, y, ItemLoc: Integer;
    begin
      if CheckLogin then Exit;
      Result := False;
      ItemLoc := StoreBankItem(Item); //Gets Item location
      if WithdrawFromBank(ItemLoc, Amount) then // withdraws item
        Result := True;

    end;

    function DepositInv: Boolean;
    begin

    end;

    function DoBanking: Boolean;
    var
      ItemL, i, amt: Integer;
    begin
      if CheckLogin then Exit;
      Result := False;
      if not DepositInv then
      begin
        WriteDebug('Failed at depositing inv');
        Exit;
      end;

      //Gets the amount number for next item needed
      ItemL := High(ItemsNeed);
      for i := 0 to ItemL do
      begin
        case ItemsNeed[i] of
          'CopperOre'     : amt := CopperOre.Amount;
          'TinOre'        : amt := TinOre.Amount;
          'IronOre'       : amt := IronOre.Amount ;
          'SilverOre'     : amt := SilverOre.Amount;
          'CoalOre'       : amt := CoalOre.Amount;
          'GoldOre'       : amt := GoldOre.Amount;
          'MithrilOre'    : amt := MithrilOre.Amount;
          'AdamantOre'    : amt := AdamantOre.Amount;
          'RuneOre'       : amt := RuneOre.Amount;
          'SteelBar'      : amt := SteelBar.Amount ;
          'SilverBar'     : amt := SilverBar.Amount;
          'GoldBar'       : amt := GoldBar.Amount;
          'RingMould'     : amt := RingMould.Amount;
          'NecklaceMould' : amt := NecklaceMould.Amount;
          'BraceletMould' : amt := BraceletMould.Amount;
          'AmuletMould'   : amt := AmuletMould.Amount;
          'HolyMould'     : amt := HolyMould.Amount;
          'UnholyMould'   : amt := UnholyMould.Amount;
          'SickleMould'   : amt := SickleMould.Amount;
          'TiaraMould'    : amt := TiaraMould.Amount;
          'CutSapphire'   : amt := CutSapphire.Amount;
          'CutEmerald'    : amt := CutEmerald.Amount;
          'CutRuby'       : amt := CutRuby.Amount;
          'CutDiamond'    : amt := CutDiamond.Amount;
          'CutOnyx'       : amt := CutOnyx.Amount;
        end;

        if not GetBankItem(ItemsNeed[i], amt) then // Gets bank Item
        begin
          WriteDebug('Failed at getting item from bank');
          Exit;
        end;
      end;
      Result := True;
    end;

    function FindTheBank: Boolean;
    begin
      if CheckLogin then Exit;
    end;


    function OpenTheBank: Boolean;
    begin
      if CheckLogin then Exit;
      WriteDebug('Seaching for bank');

    end;


    function GoToBank: Boolean;
    var
      x, y, HPtsL: Integer;
      SPSTP: TPoint;
    begin
      if CheckLogin then Exit;
      Result := False;

      if BankScreen then
      begin
        WriteDebug('Already inside bank');
        Result := True;
        Exit;
      end;

      if (GetMyLocation = 'Bank') then
      begin
        if OpenTheBank then
        begin
          Result := True;
          Exit;
        end;
      end else WriteDebug('Not at bank, walking to it');

      HPtsL := High(BankPoints);
      if SPS_WalkPath(BankPoints) then
      begin
        if (GetMyLocation = 'Bank') then
        begin
          if OpenTheBank then
          begin
            Result := True;
            Exit;
          end;
        end;
      end else WriteDebug('SPS walkpath failed, seeing how close we are to bank');

        if FindSymbol(x, y, 'Bank') then
        begin
          SPSTP := SPS_PosToMM(BankPoints[HPtsL]);
          Mouse(SPSTP.x,SPSTP.y,1,1,1);
          if WaitFunc(@FlagPresent,RandomRange(200,220), RandomRange(1000, 1200)) then
          begin
            WriteDebug('Successfully click bank location on MM');
          end;
        end else
        begin
          WriteDebug('Didn''t find bank symbol, trying to correct loction');
          ClickNorth(SRL_ANGLE_HIGH);
          if SPS_BlindWalk(BankPoints[HPtsL]) then
          begin
            SPSTP := SPS_PosToMM(BankPoints[HPtsL]);
            Mouse(SPSTP.x,SPSTP.y,1,1,1);
            if WaitFunc(@FlagPresent,RandomRange(200,220), RandomRange(1000, 1200)) then
            begin
              WriteDebug('Successfully click bank location on MM');
            end;
          end;

        end;

      if (GetMyLocation = 'Bank') then
        if OpenTheBank then
        begin
          Result := True;
          Exit;
        end;

      WriteDebug('SPS To bank failed, trying to find ObjDTM');
      WriteDebug('SPS To bank failed, Ending char run');
      WriteDebug('Note to self buld ObjDTM');
    end;

    function Smelt: Boolean;
    begin

    end;

    function GoToFurnace: Boolean;
    var
      x, y, HPtsL: Integer;
      SPSTP: TPoint;
    begin
      if CheckLogin then Exit;
      Result := False;

      if (GetMyLocation = 'Furnace') then
      begin
        Result := True;
        Exit;
      end else WriteDebug('Not at Furnace, walking to it');

      if SPS_WalkPath(FurnacePoints) then
        if (GetMyLocation = 'Furnace') then
        begin
          Result := True;
          Exit;
        end else WriteDebug('SPS walkpath failed, seeing how close we are to Furnace');

      HPtsL := High(FurnacePoints);
      if FindSymbol(x, y, 'Furnace') then
      begin
        SPSTP := SPS_PosToMM(FurnacePoints[HPtsL]);
        Mouse(SPSTP.x,SPSTP.y,1,1,1);
        if WaitFunc(@FlagPresent,RandomRange(200,220), RandomRange(1000, 1200)) then
        begin
          WriteDebug('Successfully click Furnace location on MM');
        end;
      end else
      begin
        WriteDebug('Didn''t find Furnace symbol, trying to correct loction');
        ClickNorth(SRL_ANGLE_HIGH);
        if SPS_BlindWalk(FurnacePoints[HPtsL]) then
        begin
          SPSTP := SPS_PosToMM(FurnacePoints[HPtsL]);
          Mouse(SPSTP.x,SPSTP.y,1,1,1);
          if WaitFunc(@FlagPresent,RandomRange(200,220), RandomRange(1000, 1200)) then
          begin
            WriteDebug('Successfully click Furnace location on MM');
          end;
        end;
      end;

      if (GetMyLocation = 'Furnace') then
      begin
        Result := True;
        Exit;
      end;

      WriteDebug('SPS To bank failed, trying to find ObjDTM');
      WriteDebug('SPS To bank failed, Ending char run');
      WriteDebug('Note to self buld ObjDTM');

    end;


    procedure MainLoop;
    begin
      if CheckLogin then Exit;
      if not GoToBank then
      begin
        WriteDebug('Go to Bank Failed, Shutting Down');
        Bug := True;
        Exit;
      end else
      begin
        if not DoBanking then
        begin
          WriteDebug('Banking Failed, Shutting Down');
          Bug := True;
          Exit;
        end else
        begin
          if not GoToFurnace then
          begin
            WriteDebug('Go To Furnace Failed, Shutting Down');
            Bug := True;
            Exit;
          end else
          begin
            if not Smelt then
            begin
              WriteDebug('Go To Furnace Failed, Shutting Down');
              Bug := True;
              Exit;
            end;
          end;
        end;
      end;
    end;

    procedure LoadItemInfo;
    begin
      with CopperOre do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with TinOre do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with IronOre do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with SilverOre do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with CoalOre do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with GoldOre do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with MithrilOre do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with AdamantOre do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with RuneOre do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with SteelBar do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with GoldBar do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with RingMould do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with NecklaceMould do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with BraceletMould do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with AmuletMould do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with HolyMould do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with UnholyMould do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with SickleMould do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with TiaraMould do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with CutSapphire do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with CutEmerald do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with CutRuby do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with CutDiamond do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with CutOnyx do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
      end;

      with EdgevilleBank do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
        BankPoints := [Point(2183, 2947), Point(2142, 2910)];
      end;

      with AlKharidBank do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
        BankPoints := [Point(2183, 2947), Point(2142, 2910)];
      end;

      with FaladorBank do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
        BankPoints := [Point(2183, 2947), Point(2142, 2910)];
      end;

      with LumbridgeBank do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
        BankPoints := [Point(2183, 2947), Point(2142, 2910)];
      end;

      with ArdougneBank do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
        BankPoints := [Point(2183, 2947), Point(2142, 2910)];
      end;

      with NeitiznotBank do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
        BankPoints := [Point(2183, 2947), Point(2142, 2910)];
      end;

      with EdgevilleFurnace do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
        FurnacePoints := [Point(2183, 2947), Point(2142, 2910)];
      end;

      with AlKharidFurnace do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
        FurnacePoints := [Point(2183, 2947), Point(2142, 2910)];
      end;

      with FaladorFurnace do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
        FurnacePoints := [Point(2183, 2947), Point(2142, 2910)];
      end;

      with LumbridgeFurnace do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
        FurnacePoints := [Point(2183, 2947), Point(2142, 2910)];
      end;

      with ArdougneFurnace do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
        FurnacePoints := [Point(2183, 2947), Point(2142, 2910)];
      end;

      with NeitiznotFurnace do
      begin
        color := 979867;
        Tol := 9;
        Hue := 0.64;
        Sat := 0.64;
        UpText := ['Cage', 'Net'];
        Bmp
        Dtm := DTM;
        FurnacePoints := [Point(2183, 2947), Point(2142, 2910)];
      end;

    end;

    procedure ScriptSetup;
    begin
      {$IFDEF SMART}
        {$IFDEF SIMBAMAJOR980}
          Smart_Server := 10;
          Smart_Members := True;
          Smart_Signed := True;
          Smart_SuperDetail := False;
        {$ELSE}
          SRL_SixHourFix := True;
          Smart_FixSpeed := True;
        {$ENDIF}
      {$ENDIF}

      SetUpSRL;
      DeclarePlayers;

      if (SRLStats_Username = '') Then
        SetupSRLStats(1318, 'Guild Fisher', 'password')
      else
        SetupSRLStats(1318, SRLStats_Username, SRLStats_Password);

      ObjDTM_Setup;
      MouseSpeed := 12;

      //Log In
      while(not(RSReady()))do
        Wait(9000);
      if CheckLogin then Exit;

      //Fix screen
      SetAngle(SRL_ANGLE_HIGH);
      ClearDebug;
      SMART_ClearCanvas;
      while not ExitSquealOfFortune do
      begin
        wait(100);
      end;
      GameTab(Tab_Inv);
      ToggleXPBar(True);
      SetChat('filter',0);
      SpinT := 0;

      //Load Location Info
      case Lowercase(Location) of
        'edgeville' :
        begin
          SPS_Setup(runescape_surface,['10_6']);
          BankPoints := EdgevilleBank.BankPoints;
          FurnacePoints := EdgevilleBank.FurnacePoints;
        end;

        'alkharid' :
        begin
          SPS_Setup(runescape_surface,['12_9']);
          BankPoints := AlkharidBank.BankPoints;
          FurnacePoints := AlkharidBank.FurnacePoints;;
        end;

        'falador' :
        begin
          SPS_Setup(runescape_surface,['8_7','9_7']);
          BankPoints := FaladorBank.BankPoints;
          FurnacePoints := FaladorBank.FurnacePoints;
        end;

        'lumbridge' :
        begin
          SPS_Setup(runescape_surface,['11_8','11_9']);
          BankPoints := LumbridgeBank.BankPoints;
          FurnacePoints := LumbridgeBank.FurnacePoints;
        end;

        'ardougne' :
        begin
          SPS_Setup(runescape_surface,['5_8']);
          BankPoints := ArdougneBank.BankPoints;
          FurnacePoints := ArdougneBank.FurnacePoints;
        end;

        'neitiznot' :
        begin
          SPS_Setup(runescape_surface,['16_6']);
          BankPoints := NeitiznotBank.BankPoints;
          FurnacePoints := NeitiznotBank.FurnacePoints;
        end;
      end;

      case Lowercase(SmeltingWhat) of
        'bronzebar' :
        begin
          ItemsNeed := ['CopperOre', 'TinOre'];
          CopperOre.Amount := 14;
          TinOre.Amount := 14;
        end;

        'ironbar' :
        begin
          ItemsNeed := ['IronOre'];
          IronOre.Amount := 28;
        end;

        'silverbar' :
        begin
          ItemsNeed := ['SilverOre'];
          SilverOre.Amount := 28;
        end;

        'goldbar' :
        begin
          ItemsNeed := ['GoldOre'];
          GoldOre.Amount := 28;
        end;

        'steelbar' :
        begin
          ItemsNeed := ['IronOre', 'CoalOre'];
          IronOre.Amount := 9;
          CoalOre.Amount := 18;
        end;

        'mithrilbar' :
        begin
          ItemsNeed := ['MithrilOre', 'CoalOre'];
          MithrilOre.Amount := 5;
          CoalOre.Amount := 20;
        end;

        'adamantbar' :
        begin
          ItemsNeed := ['AdamantOre', 'CoalOre'];
          AdamantOre.Amount := 4;
          CoalOre.Amount := 24;
        end;

        'runebar' :
        begin
          ItemsNeed := ['RuneOre', 'CoalOre'];
          RuneOre.Amount := 3;
          CoalOre.Amount := 24;
        end;

        'cannonballlong' :
        begin
          ItemsNeed := ['IronOre', 'CoalOre'];
          IronOre.Amount := 9;
          CoalOre.Amount := 18;
        end;

        'cannonballshort' :
        begin
          ItemsNeed := ['SteelBar'];
          SteelBar.Amount := 27;
        end;

        'goldring' :
        begin
          ItemsNeed := ['GoldBar'];
          GoldBar.Amount := 27;
        end;

        'sapphirering' :
        begin
          ItemsNeed := ['GoldBar', 'CutSapphire'];
          GoldBar.Amount := 13;
          CutSapphire.Amount := 13;
        end;

        'emeraldring' :
        begin
          ItemsNeed := ['GoldBar', 'Emerald'];
          GoldBar.Amount := 13;
          CutEmerald.Amount := 13;
        end;

        'rubyring' :
        begin
          ItemsNeed := ['GoldBar', 'CutRuby'];
          GoldBar.Amount := 13;
          CutRuby.Amount := 13;
        end;

        'dimondring' :
        begin
          ItemsNeed := ['GoldBar', 'CutDimond'];
          GoldBar.Amount := 13;
          CutDimond.Amount := 13;
        end;

        'dragonstonering' :
        begin
          ItemsNeed := ['GoldBar', 'CutDragonStone'];
          GoldBar.Amount := 13;
          CutDragonStone.Amount := 13;
        end;

        'onyxring' :
        begin
          ItemsNeed := ['GoldBar', 'CutOnyx'];
          GoldBar.Amount := 13;
          CutOnyx.Amount := 13;
        end;

        'goldnecklace' :
        begin
          ItemsNeed := ['GoldBar'];
          GoldBar.Amount := 27;
        end;

        'sapphirenecklace' :
        begin
          ItemsNeed := ['GoldBar', 'CutSapphire'];
          GoldBar.Amount := 13;
          CutSapphire.Amount := 13;
        end;

        'emeraldnecklace' :
        begin
          ItemsNeed := ['GoldBar', 'Emerald'];
          GoldBar.Amount := 13;
          CutEmerald.Amount := 13;
        end;

        'rubynecklace' :
        begin
          ItemsNeed := ['GoldBar', 'CutRuby'];
          GoldBar.Amount := 13;
          CutRuby.Amount := 13;
        end;

        'dimondnecklace' :
        begin
          ItemsNeed := ['GoldBar', 'CutDimond'];
          GoldBar.Amount := 13;
          CutDimond.Amount := 13;
        end;

        'dragonstonenecklace' :
        begin
          ItemsNeed := ['GoldBar', 'CutDragonStone'];
          GoldBar.Amount := 13;
          CutDragonStone.Amount := 13;
        end;

        'onyxnecklace' :
        begin
          ItemsNeed := ['GoldBar', 'CutOnyx'];
          GoldBar.Amount := 13;
          CutOnyx.Amount := 13;
        end;

        'goldbracelet' :
        begin
          ItemsNeed := ['GoldBar'];
          GoldBar.Amount := 27;
        end;

        'sapphirebracelet' :
        begin
          ItemsNeed := ['GoldBar', 'CutSapphire'];
          GoldBar.Amount := 13;
          CutSapphire.Amount := 13;
        end;

        'emeraldbracelet' :
        begin
          ItemsNeed := ['GoldBar', 'Emerald'];
          GoldBar.Amount := 13;
          CutEmerald.Amount := 13;
        end;

        'rubybracelet' :
        begin
          ItemsNeed := ['GoldBar', 'CutRuby'];
          GoldBar.Amount := 13;
          CutRuby.Amount := 13;
        end;

        'dimondbracelet' :
        begin
          ItemsNeed := ['GoldBar', 'CutDimond'];
          GoldBar.Amount := 13;
          CutDimond.Amount := 13;
        end;

        'dragonstonebracelet' :
        begin
          ItemsNeed := ['GoldBar', 'CutDragonStone'];
          GoldBar.Amount := 13;
          CutDragonStone.Amount := 13;
        end;

        'onyxbracelet' :
        begin
          ItemsNeed := ['GoldBar', 'CutOnyx'];
          GoldBar.Amount := 13;
          CutOnyx.Amount := 13;
        end;

        'goldamulet' :
        begin
          ItemsNeed := ['GoldBar'];
          GoldBar.Amount := 27;
        end;

        'sapphireamulet' :
        begin
          ItemsNeed := ['GoldBar', 'CutSapphire'];
          GoldBar.Amount := 13;
          CutSapphire.Amount := 13;
        end;

        'emeraldamulet' :
        begin
          ItemsNeed := ['GoldBar', 'Emerald'];
          GoldBar.Amount := 13;
          CutEmerald.Amount := 13;
        end;

        'rubyamulet' :
        begin
          ItemsNeed := ['GoldBar', 'CutRuby'];
          GoldBar.Amount := 13;
          CutRuby.Amount := 13;
        end;

        'dimondamulet' :
        begin
          ItemsNeed := ['GoldBar', 'CutDimond'];
          GoldBar.Amount := 13;
          CutDimond.Amount := 13;
        end;

        'dragonstoneamulet' :
        begin
          ItemsNeed := ['GoldBar', 'CutDragonStone'];
          GoldBar.Amount := 13;
          CutDragonStone.Amount := 13;
        end;

        'onyxamulet' :
        begin
          ItemsNeed := ['GoldBar', 'CutOnyx'];
          GoldBar.Amount := 13;
          CutOnyx.Amount := 13;
        end;

        'holysymbol' :
        begin
          ItemsNeed := ['SteelBar'];
          SteelBar.Amount := 27;
        end;

        'unholysymbol' :
        begin
          ItemsNeed := ['SteelBar'];
          SteelBar.Amount := 27;
        end;

        'sickle' :
        begin
          ItemsNeed := ['SteelBar'];
          SteelBar.Amount := 27;
        end;
        'tiara' :
        begin
          ItemsNeed := ['SteelBar'];
          SteelBar.Amount := 27;
        end;

      end;
    end;

    Begin
    ScriptSetup;

    End.
    Last edited by bud_wis_er_420; 03-07-2013 at 05:45 PM.
    Not scripting for RS anymore, sorry. Banned too many times.
    MY SCRIPTS

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

    Default

    Pretty much use case's to define what the user will smith like above and use object DDTM if this is for RS07 because I heard SPS isn't reliable for RS07

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
  •