Results 1 to 3 of 3

Thread: Problem With Skipping Procedures

  1. #1
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Problem With Skipping Procedures

    Alright so my script is a Draynor Willow Chopper, and After It walks to the willows and chops a load, it occasionally goes to banking and skips walk to bank procedure, if anyone could help me with this that would be greatly appreciated.
    -blumblebee

    heres script
    SCAR Code:
    program DraynorWillowChopper;
    {.include SRL/SRL/Misc/Smart.scar}
    {.include srl/srl.scar}
    {.include srl/srl/skill/woodcutting.scar}

    const

    LoadsPerPlayer = 1; //Amounts of loads per player before switching.

    World = 81;//World you want to smart to load

    var
    x, y, GainedLvl, LogDTM, Chopped, WillowDTM, done, AxeDTM : Integer;

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

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Booleans[0] := true;//True = Weilded False = Not Weilded
      Players[0].Active := True;

      {Players[1].Name := '';
      Players[1].Pass := '';
      Players[1].Nick := '';
      Players[1].Active := True;}

    end;

    {------------------------------------------------------------------------------}
    //-------Don't----Touch----Anything----Below----This----Point---Please--------\\
    {------------------------------------------------------------------------------}
    //----------------------Unless You Know What Your Doing------------------------\\
    {------------------------------------------------------------------------------}









    {---------------------------------}
    //-----My Starting Signature-----\\
    {---------------------------------}
    procedure StartUp;
    begin
      ClearDebug;
      wait(1000);
      WriteLn(' _      _              _      _       _                           ');
      wait(225);
      WriteLn('| |    | |            | |    | |     | |                     ');
      wait(225);
      WriteLn('| |___ | | _ _  _____ | |___ | | ___ | |___  ___  ___                        ');
      wait(225);
      WriteLn('|   | || || | ||     ||   | || || |_||   | || |_|| |_|                  ');
      wait(225);
      WriteLn('|_____||_||___||_|_|_||_____||_||___||_____||___||___|                   ');
      wait(225);
      WriteLn('');
      wait(1500);
      clearDebug;
      WriteLn('Presents:');
      WriteLn('--------');
      WriteLn('Draynor Willow Smasher Version 2.0');
      WriteLn('------------------------------------');
      WriteLn('Please Post Bugs/Proggies on Thread');
      WriteLn('------------------------------------');
    end;

    {-------------------------------------}
    //-----Loads All DTM's In Script-----\\
    {-------------------------------------}

    procedure LoadDTMs;
    begin
      LogDTM := DTMFromString('78DA631465606010604001AE76120C92409A1' +
        '1CA67940512ACA86A1CACC451D528020931543506DA82A86AD830D52' +
        '44498A1AAE102129C04D4F0010969543505E9F6286A0042200603');
      AxeDTM := DTMFromString('78DA6394646060E06440018EE1890CFF81342' +
        '394CF280D24D818D00023AA1A2920C14F408D00906025A046084870E' +
        '357030086DB06A1');
    end;

    {-----------------------------}
    //-----Terminates Script-----\\
    {-----------------------------}

    procedure ScriptTerminate;
    begin
      Disguise('Script Done');
      freedtm(Logdtm);
      freedtm(AxeDTM);
      TerminateScript;
    end;

    {---------------------------------}
    //-----Finds An Axe For Wcing-----\\
    {---------------------------------}

    function FindAnAxe: Boolean;
    begin
      LoadDTMs;
      wait(500 + random(200));
      if (Players[CurrentPlayer].Booleans[0] = True) then
      GameTab(5);
      if FindDTM(AxeDTM, x, y, 532, 183, 751, 485) then
      begin
        Result := True;
        FreeDTM(AxeDTM);
        writeln('------------------------');
        Writeln('Found Axe Weilded');
      end;
      if not (Result) then
      begin
        if (Players[CurrentPlayer].Booleans[0] = False) then
        GameTab(4);
        if FindDTM(AxeDTM, x, y, MIX1, MIY1, MIX2, MIY2) then
        begin
          result := True;
          FreeDTM(AxeDTM);
          writeln('------------------------');
          Writeln('Found Axe In Inventory');
        end;
      end;
      if not (Result) then
      begin
        writeln('--------------------------------------');
        Writeln('Could Not find Axe Terminating Script');
        ScriptTerminate;
      end;
    end;

    {----------------------------}
    //-----Beginning Set Up-----\\
    {----------------------------}

    procedure SetUp1;
    begin
      SetupSRL;
      SmartSetupEx(World, True, True, False);
      SetTargetDC(SmartGetDC);
    end;

    {----------------------------------}
    //-----Set Up for Each player-----\\
    {----------------------------------}

    procedure SetUp2;
    begin
      DeclarePlayers;
      if not (LoggedIn) then
      begin
        LogInPlayer;
      end;
      if LoggedIn then
      begin
        FindAnAxe;
        SetRun(True);
        SetAngle(true);
        MakeCompass('N');
        Wait(400 + Random(655));
      end;
    end;

    {--------------------------------}
    //-----Finds Gained levels -----\\
    {--------------------------------}

    function FindGainedLevel: boolean;
    begin
      if not LoggedIn then Exit;
      if ClickContinue(False,False) then
      begin
        if FindNPCChatText('lations', Nothing) then
        begin
          writeln('We gained a woodcutting level!');
          GainedLvl:=GainedLvl+1;
          ClickContinue(True,True);
          Result := True;
          Exit;
        end;
      end;
    end;

    {---------------------------------}
    //-----My AntiBan Procedure-----\\
    {---------------------------------}

    Procedure AntiBan;
    begin
      if(not(LoggedIn))then
       Exit;
      case Random(45) of
        0: begin
             Status('AntiBan');
             HoverSkill('Woodcutting', false);
             wait(2453+Random(432));
             GameTab(4);
           end;
        1: begin
             Status('AntiBan');
             HoverSkill('Strength',false);
             wait(2000+Random(413));
             GameTab(4);
           end;
        2: PickUpMouse;
        3: begin
             Status('AntiBan');
             MakeCompass('N');
             wait(100+random(5));
             MakeCompass('S');
             wait(100+random(5));
             MakeCompass('N');
           end;
        4:begin
            Status('AntiBan');
            RandomRClick;
            wait(500 + random(500));
          end;
        5:begin
            Status('AntiBan');
            IdleTime(1000 + Random(750), 500, 0.5);
            Wait(300 + random(700));
          end;
        8: BoredHuman;
      end;
    end;

    {------------------------------------------}
    //-----Loads All DDTM's Used in Script-----\\
    {------------------------------------------}

    function LoadAllDDTM(WalkNumber: Integer): Integer;

    var
      dtmMainPoint: TDTMPointDef;
      dtmSubPoints: Array [0..3] of TDTMPointDef;
      TempTDTM: TDTM;
    begin
      case WalkNumber of
      1:begin
          dtmMainPoint.x := 658;
      dtmMainPoint.y := 51;
      dtmMainPoint.AreaSize := 3;
      dtmMainPoint.AreaShape := 0;
      dtmMainPoint.Color := 15527148;
      dtmMainPoint.Tolerance := 300;

      dtmSubPoints[0].x := 661;
      dtmSubPoints[0].y := 51;
      dtmSubPoints[0].AreaSize := 3;
      dtmSubPoints[0].AreaShape := 0;
      dtmSubPoints[0].Color := 15527148;
      dtmSubPoints[0].Tolerance := 300;

      dtmSubPoints[1].x := 653;
      dtmSubPoints[1].y := 55;
      dtmSubPoints[1].AreaSize := 3;
      dtmSubPoints[1].AreaShape := 0;
      dtmSubPoints[1].Color := 60909;
      dtmSubPoints[1].Tolerance := 35;

      dtmSubPoints[2].x := 653;
      dtmSubPoints[2].y := 50;
      dtmSubPoints[2].AreaSize := 3;
      dtmSubPoints[2].AreaShape := 0;
      dtmSubPoints[2].Color := 60909;
      dtmSubPoints[2].Tolerance := 35;

      dtmSubPoints[3].x := 652;
      dtmSubPoints[3].y := 41;
      dtmSubPoints[3].AreaSize := 3;
      dtmSubPoints[3].AreaShape := 0;
      dtmSubPoints[3].Color := 195836;
      dtmSubPoints[3].Tolerance := 35;

      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
        end;
      2:Begin
          dtmMainPoint.x := 114;
          dtmMainPoint.y := 128;
          dtmMainPoint.AreaSize := 3;
      dtmMainPoint.AreaShape := 0;
      dtmMainPoint.Color := 4341322;
      dtmMainPoint.Tolerance := 35;

      dtmSubPoints[0].x := 114;
      dtmSubPoints[0].y := 128;
      dtmSubPoints[0].AreaSize := 3;
      dtmSubPoints[0].AreaShape := 0;
      dtmSubPoints[0].Color := 4341322;
      dtmSubPoints[0].Tolerance := 35;

      dtmSubPoints[1].x := 113;
      dtmSubPoints[1].y := 124;
      dtmSubPoints[1].AreaSize := 1;
      dtmSubPoints[1].AreaShape := 0;
      dtmSubPoints[1].Color := 4341322;
      dtmSubPoints[1].Tolerance := 35;

      dtmSubPoints[2].x := 117;
      dtmSubPoints[2].y := 128;
      dtmSubPoints[2].AreaSize := 1;
      dtmSubPoints[2].AreaShape := 0;
      dtmSubPoints[2].Color := 4341322;
      dtmSubPoints[2].Tolerance := 35;

      dtmSubPoints[3].x := 114;
      dtmSubPoints[3].y := 132;
      dtmSubPoints[3].AreaSize := 1;
      dtmSubPoints[3].AreaShape := 0;
      dtmSubPoints[3].Color := 2235946;
      dtmSubPoints[3].Tolerance := 35;

      TempTDTM.MainPoint := dtmMainPoint;
      TempTDTM.SubPoints := dtmSubPoints;
      Result := AddDTM(TempTDTM);
        end;
      end;
    end;

    {------------------------------------------------------------}
    //-----Rotates Camera Around (Somewhat Like an AntiBan)-----\\
    {------------------------------------------------------------}

    procedure CameraRotate;
    begin
      if(not(LoggedIn))then
        Exit;
      case Random(40) of
        0:Begin
            MakeCompass('N');
            Wait(100+random(5));
          end;
        1:Begin
            MakeCompass('S');
            Wait(100+random(5));
          end;
        2:Begin
            MakeCompass('N');
            wait(100+random(5));
          end;
        3:Begin
            MakeCompass('E');
            wait(100+random(5));
          end;
        4:Begin
            MakeCompass('W');
            wait(100+random(5));
          end;
      end;
    end;

    {------------------------------------------}
    //-----Finds Ents, Made By DeathSytex-----\\
    {------------------------------------------}

    function FindTheEnt(Range : Integer; UseText : Boolean): Boolean;//Credit to Deathsytex
    var
      EntX, EntY, EX1, EY1, EX2, EY2 : Integer;
    begin
      if (not (IsUpText('hop'))) then
       Exit;
      EX1 := MMCX - 75;
      EY1 := MMCY - 19;
      EX2 := MMCX + 185;
      EY2 := MMCX + 27;
      if (UseText) then
        Result := FindColorTolerance(EntX, EntY, 388075, 80, 6, 127, 20, 30);
    end;

    {--------------------------------------}
    //-----Basic AntiRandom Procedure-----\\
    {--------------------------------------}

    procedure FindRandoms;
    begin
      if (not (LoggedIn)) then
        Exit;
        FindNormalRandoms;
        if (FindFight) then
        begin
          RunTo('E', True)
          FFlag(0);
          Wait(1000 + random(500));
          if FindSymbol(x, y, 'fish') then
          begin
          mouse(x, y + 15, 6, 6, true);
          end;
        end;
      end;
     
    {--------------------------------------}
    //-----Walks Character to Willows-----\\
    {--------------------------------------}
     
    function WalkToWillows: Boolean;
    var
      WalkDTM: integer;
    begin
      FindRandoms;
      WalkDTM := LoadAllDDTM(2);
      if FindDTM(WalkDTM, X, Y, MMx1,MMy1,MMx2,MMy2) then
      begin
        Mouse(X, Y, 8, 8, True);
        writeln('------------------------');
        WriteLn('Walked To Willows Using DDTM');
        FFlag(0);
        Result := True;
      end else
        if RadialWalk(FindWaterColor, 210, 260, 50, 4, 4) then
        begin
          writeln('------------------------------------');
          Writeln(' Walked To Willows Using Radial Walk');
          Result := True;
        end else
        begin
          Result := False;
          writeln('-----------------------------------------------');
          Writeln('Both DDTM and Radial Walking Failed, Nextplayer');
          FreeDTM(WalkDTM);
          if not (Result) then
          begin
            NextPlayer(false); // logs out.
          end;
        end;
    end;

    {-----------------------------------}
    //-----Walks Character To Bank-----\\
    {-----------------------------------}

    function WalkToBank: Boolean;
    var
      WalkDTM: integer;
    begin
      MakeCompass('N');
      FindRandoms;
      WalkDTM := LoadAllDDTM(1);
      if FindDTM(WalkDTM, X, Y, MMx1,MMy1,MMx2,MMy2) then
      begin
        Mouse(X, Y, 8, 8, True);
        writeln('------------------------');
        WriteLn('Walked To Bank Using DDTM');
        FFlag(0);
        Result := True;
      end else
      if FindSymbol(x, y, 'bank') then
        begin
          mouse(x, y, 2, 2, true);
          writeln('------------');
          Writeln('Back to Bank');
          FFlag(2);
          writeln('---------------------------------');
          Writeln(' Walked To Bank Using Bank Symbol');
          Result := True;
        end else
        begin
          Result := False;
          writeln('-------------------------------');
          Writeln('Could Not Find Bank, Nextplayer');
          FreeDTM(WalkDTM);
          if not (Result) then
          begin
            NextPlayer(false); // logs out.
          end;
        end;
    end;

    {---------------------------}
    //-----Progress Report-----\\
    {---------------------------}

    procedure PReport;
    begin
      WriteLn('Thank You For Using Blumblebees Draynor Masher');
      WriteLn('---------------------------------------------------');
      writeln('|Script Ran For ' + TimeRunning);
      WriteLn('|Chopped ' + IntToStr(Chopped) + ' Logs');
      WriteLn('|Gained ' + IntToStr(GainedLvl) + ' Level(s)');
      WriteLn('---------------------------------------------------');
      WriteLn('');
      WriteLn('');
    end;

    {---------------------------------}
    //-----Banks Load Of Willows-----\\
    {---------------------------------}

    function Banking: Boolean;
    begin
      LoadDTMs;
      begin
        FindRandoms;
        MakeCompass('S');
        begin
          Wait(350 + Random(500));
          writeln('-----------');
          Writeln('Banking...');
          OpenBankFast('db');
          FFlag(0);
          Wait(500 + Random (500));
          if FindDTM(WillowDTM,x,y,MIX1,MIY1,MIX2,MIY2) then
          begin
            Mouse(x, y, 4, 3, false);
            Wait(200 + Random(100));
            Deposit(2, 28, true);
            FreeDTM(WillowDTM);
          end;
          begin
            CloseBank;
            Wait(150 + random (250));
            MakeCompass('N');
            Result := True;
            Chopped := Chopped+27;
            inc(Done);
            wait(500+ Random(200));
            PReport;
          end;
        end;
      end;
    end;

    {--------------------------------------}
    //-----Finds Broken Axe Using Chat-----\\
    {---------------------------------------}

    procedure FindBrokenAxe;
    var
      baxe: integer;
    begin
      if not (LoggedIn) then
        Exit;
        if TimeFromMark(baxe) < 1500 then
          Exit;
          FindNormalRandoms;
          MarkTime(baxe);
          if (FindBlackChatMessage('ou do not')) then
          begin
           writeln('-----------------------------');
           Writeln('Broken Axe...Getting new axe.');
           WalkToBank;
           Banking;
          end;
        end;
       
    {--------------------------------}
    //-----Chops Willow Tree's -----\\
    {--------------------------------}
       
    function ChopTree: Boolean;
    var
      x : integer;
      y : integer;
    begin
      if not(LoggedIn) then Exit;
      writeln('---------------------');
      Writeln('Chopping Willow trees');
      Status('Chopping Willows');
      wait(1000+random(250));
        repeat
        if not(LoggedIn) then Exit;
        If(FindNormalRandoms) or (InvFull) then Exit;
        FindBrokenAxe;
        if FindObjTPA(x, y, 4876128, 20, 2, 15, 25, 10, ['illow', 'Willo', 'Willow']) then
        begin
          Result := True;
          Mouse(x, y, 0, 0, false);
          ChooseOption('hop')
          FindObjTPA(x, y, 4876128, 20, 2, 15, 25, 10, ['illow', 'Willo', 'Willow'])
        end;
        repeat
          FindTheEnt(35,True);
          FindRandoms;
          FindBrokenAxe;
          AntiBan;
          CameraRotate;
          wait(500+random(250));
          FindGainedLevel;
          wait(1000+random(175));
        Until  not IsUpText('Willow') or (InvFull);
        FindRandoms;
        FindBrokenAxe;
        FindGainedLevel;
      Until(invfull);
      if not (Result) then
      begin
        NextPlayer(False);
        exit;
      end;
    end;

    {----------------------}
    //-----My MainLoop-----\\
    {-----------------------}

    Procedure MainLoop;
    begin
      SetUp1;
      StartUp;
      wait(500 + random (200));
      SetUp2;
      repeat
        repeat
          WalkToWillows;
          ChopTree;
          If (InvFull) then
            WalkToBank;
            Banking;
            If Not (LoggedIn) Or Not (Players[CurrentPlayer].Active) Then
              NextPlayer(false);
              If Not LoggedIn Then
              Begin
                NextPlayer(false);
                SetUp2;
              end;
        until(done >= LoadsPerPlayer);
        begin
          NextPlayer(True);
          SetUp2;
        end;
      until(AllPlayersInactive);
    end;

    begin
      MainLoop;
      ScriptTerminate;
    end.

    All and Any Help Would Be appreciated
    “Ignorance, the root and the stem of every evil.”

  2. #2
    Join Date
    Mar 2008
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    If it doesnt find the bank dtm it will skip the procedure... Put in some kind of failsafe...

    edit, also use dtmrotated for finding dtms on the map

  3. #3
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok tyvm! haha yeah i put up the wrong version i use dtmrotated on my current one, thanks
    -Blumblebee
    “Ignorance, the root and the stem of every evil.”

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. function skipping
    By TheSantaMan in forum OSR Help
    Replies: 5
    Last Post: 09-08-2007, 07:28 PM
  2. Skipping RW
    By rkroxpunk in forum OSR Help
    Replies: 14
    Last Post: 04-29-2007, 02:13 PM
  3. keeps skipping steps
    By del_signo in forum OSR Help
    Replies: 2
    Last Post: 03-05-2007, 01:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •