Results 1 to 5 of 5

Thread: Script freezing

  1. #1
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Script freezing

    My script keeps freezing and I don't know the problem. I tried all different kinds of ways to find the rock but that's not it. I used t-point arrays, findobj, spiral tolerance ect. ect. Any help appreciated.

    SCAR Code:
    program SDMCPM;
    {.include srl/srl.scar}

    Var Loads,Mined :integer;

    procedure DeclarePlayers;
    begin
      HowManyPlayers:= 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
               ///// fill all of below in
      Players[0].Name    := '';
      Players[0].Pass    := '';
      Players[0].Nick    := '';
      Players[0].Active  := true;
      Players[0].BoxRewards := ['XP'];
      Players[0].Integers[0]:= 123; // loads to do
      Players[0].Integers[1]:= 123; // Ore Color
      Players[0].Booleans[0]:= false;  // Is your pick equiped?
    end;

    Procedure SetRandomObj;
    var RanObj,NoO,x,y :integer;
    begin
      NoO := BitmapFromString(23, 12, 'beNqNUQEOwiAQ40Fs2RJdnA4j0' +
           '/3/SbO7jnpiNJLLpZT2KCH116G5nZrpEPO5BZ7RjzvDPhc+DYUZjR' +
           'lb08TdNbxcxI6JmAmNpuXSMTMbjz5bresKF8vjb5XNwsUhmMwtbwQ' +
           'IIfgX6V3EyAANerClS2nklhiW6nZm9vrqFRqiLl6aXCbQ+OcQnirh' +
           'jyT4qSX13ugxwP3SiYESXQwm0Eve6z+9BFDC9UhdxQBDLD1IYfHU8' +
           'NSXvpgu5qQxW0JiJuc/MnnVQ1mQLdM2GTk3bLcwhq8qxls9AVo+Ey' +
           'o=');
      RanObj := BitmapFromString(14, 14, 'beNp1kj0Lg2AMhN8fJ52ko6' +
           'M4ttS1YJdSKE5O/cX6wMH1CPhyQ3K5fJi4DK/5ui7D7zuB571/TJf' +
           'b2AEM3ASMo8lTwQIlpmD/NCH1YujoLmJ4FitkPhP1GFuuBnBoe49U' +
           'zsRSJ5XALgVdM5WghLBL4lmRoszu2vlZYn6sD+Rhcg+p9HWssayQ2' +
           'GL0A7T2l4mnnfcsV4sFyvI1xawH8tTePw==');
      GameTab(tab_Objectives);
      If(FindBitmapToleranceIn(NoO,x,y,mix1,miy1,mix2,miy2,20)) then
      begin
        Writeln('Setting Objective')
        If(FindBitmapToleranceIn(RanObj,x,y,mix1,miy1,mix2,miy2,20)) then
         begin
          Mouse(x,y,3,3,true);
          Wait(500+Random(250))
          Case Random(5) of
               0: Mouse(92, 94, 3, 3, true);
               1: Mouse(261, 111, 3, 3, true);
               2: Mouse(423, 113, 3, 3, true);
               3: Mouse(89, 235, 3, 3, true);
               4: Mouse(379, 404, 3, 3, true);
               5: Mouse(427, 237, 3, 3, true);
          End;
          FreeBitmap(NoO);
          FreeBitmap(RanObj);
         End Else
         If(Not(FindBitmapToleranceIn(NoO,x,y,mix1,miy1,mix2,miy2,20))) Then
          begin
            Writeln('Objective Already Set')
            Exit;
          end;
      end;
    end;

    Function RandomTabs(TimesToSwitch: integer; WaitBetween :integer):integer;
    var TTS,I,WB :integer;
     begin
       TTS := TimesToSwitch;
       WB := WaitBetween;
       If(TTS > 0) then
       begin
         For I:= 0 to TTS do
         Case Random(15) of
            0: GameTab(tab_Combat);
            1: GameTab(tab_Stats);
            2: GameTab(tab_Quest);
            3: GameTab(tab_Diary);
            4: GameTab(tab_Inv);
            5: GameTab(tab_Equip);
            6: GameTab(tab_Prayer);
            7: GameTab(tab_Magic);
            8: GameTab(tab_Friends);
            9: GameTab(tab_Ignore);
            10: GameTab(tab_Clan);
            11: GameTab(tab_Options);
            12: GameTab(tab_Emotes);
            13: GameTab(tab_Music);
            14: GameTab(tab_Notes);
            15: GameTab(tab_Logout);
         end;
         Wait(WB)
     end else
       TTS := TimesToSwitch;
       WB := WaitBetween;
       If(TTS <= 0) then
       begin
         Case Random(4) of
            0: TTS := 1;
            1: TTS := 2;
            2: TTS := 3;
            3: TTS := 4;
            4: TTS := 5;
         end;
         For I:= 0 to TTS do
         Case Random(15) of
            0: GameTab(tab_Combat);
            1: GameTab(tab_Stats);
            2: GameTab(tab_Quest);
            3: GameTab(tab_Diary);
            4: GameTab(tab_Inv);
            5: GameTab(tab_Equip);
            6: GameTab(tab_Prayer);
            7: GameTab(tab_Magic);
            8: GameTab(tab_Friends);
            9: GameTab(tab_Ignore);
            10: GameTab(tab_Clan);
            11: GameTab(tab_Options);
            12: GameTab(tab_Emotes);
            13: GameTab(tab_Music);
            14: GameTab(tab_Notes);
            15: GameTab(tab_Logout);
         end;
         Wait(WB)
       end;
     end;

    Procedure AntiBan;
    begin
      case Random(70)of

        0:Pickupmouse;

        1:Begin
            Makecompass('w')
            wait(1000+random(500))
            makecompass('e')
            wait(1000+random(500))
            Makecompass('w')
          end;

        2: randomrclick;

        3: HoverSkill('Woodcutting', false);

        4: Sleepandmovemouse(3000+random(1000));

        5: Boredhuman;

        6: SetRandomObj;

        7: RandomTabs(5,700+Random(300))
    end;
    end;



    Function DropFT(FromS: Integer; ToE: Integer): Integer;
    Var FromF,ToT,I :Integer;
    Begin
      If(InvEmpty) Then Exit;
      FromF := FromS
      ToT := ToE
      GameTab(tab_inv);
      For I:= FromS To ToT do
      DropItem(I);
    end;

    procedure FTchoose;
    begin
      if(Players[currentplayer].Booleans[0])then
        begin
          DropFt(1,28);
          Loads := Loads+1
        end else
          if(not(Players[currentplayer].Booleans[0]))then
          DropFt(2,28);
          Loads := Loads+1
    end;

    procedure Mineing;
    var      k,l,x,y: integer;
    begin
      if(InvFull)then FTchoose;
      ClickToContinue;
      if(FindColorSpiralTolerance(X, Y, Players[Currentplayer].Integers[1], msx1, msy1, msx2, msy2, 25)) then
        begin
          MMouse(x, y, 0, 0);
          if (WaitUpText('ine', 300 + Random(550))) then
            begin
              Mouse(x, y, 0, 0, False)
              WaitOption('ine', 200+Random(50))
              MarkTime(k);
              l := Invcount;
              while (InvCount = l) and (TimeFromMark(k) < 20000) do AntiBan;
              If(TimeFromMark(k) > 20000)then exit;
              Mined := Mined +1;
              ClickToContinue;
            end;
        end;
    end;

    Procedure ScriptTerminate;
    begin
    Writeln('======================================================')
    Writeln('|Junkjs SDMCPM(South Dwarven Mine Copper Power Miner)');
    Writeln('|Mined ' + Inttostr(Mined) + ' copper' );
    Writeln('|Did ' + Inttostr(loads) + ' loads');
    Writeln('|Ran for ' + TimeRunning);
    Writeln('|Thank you for using');
    Writeln('======================================================')
    end;


    begin
    SetUpSRL;
    DeclarePlayers;
    ClearDebug;
    ActivateClient;
    if(not(Loggedin))then
    LoginPlayer;
    MakeCompass('S');
    SetAngle(True);
    repeat
    FindNormalRandoms;
    Mineing;
    Until( Loads = Players[currentplayer].Integers[0])
    end.

  2. #2
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Add some waits (10-50ms) in all of your loops (repeat, while, for to do) ect.
    Also, add some random writelns around to figure out exactly when/where the lag starts.
    Writeln('random checking)
    Writeln('dropping')
    Writeln('mining) ect. These will all help reduce, find the lag.

  3. #3
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ahh. Thanks YoHoJo. I redid the mining procedure. Also, added a wait time in the mainloop and some extra procedures. Any good way to find the rock? My mouse keeps moving it to different areas of the same color...

  4. #4
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by Junkj View Post
    Ahh. Thanks YoHoJo. I redid the mining procedure. Also, added a wait time in the mainloop and some extra procedures. Any good way to find the rock? My mouse keeps moving it to different areas of the same color...
    some good 'ol TPA's will do the trick especially with cts2-3(or even use SmartColors )
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  5. #5
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    I'm making powerminer also, its damn hard to get it working very consistently. Use ACA and TPAs and count pixels and crap like that :/. ITS SOOO HARD

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
  •