Results 1 to 6 of 6

Thread: How can i make it less laggy?

  1. #1
    Join Date
    Nov 2006
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How can i make it less laggy?

    How can i make my script less laggy?
    i do have freebitmap

    heres the script:

    SCAR Code:
    program New;
    {.include SRL/SRL.scar}


    var
    Tele,Oak2,Log,tree,GroundColor,GroundBMP: integer;

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



      Players[0].Name := 'go to sythe2';
      Players[0].Pass := 'buster';
      Players[0].Nick := 'yth';
      Players[0].Active := True;

      NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
    end;
    /////////////////////////////////////////////////////////////////////////////
    procedure DeclareBMPS;
    begin
      Tele := BitmapFromString(21, 21, 'z78DACD96510E83201044AF54' +
           '60557E6994FB1FA9A9FA413399CD20B5A9241B83C29B5D94C156B' +
           '39427B3929E679C6DB578C6A6FFF1BE821F3FC6C20C6DB49D6B2D' +
           '5DE0E62DAF3561A41A908E4FA147217628410AD1C6B8610A31563' +
           'F520D983BE851B84B594ACD18250D983B541BB98CE82B410DEC0B' +
           'C4AC59BE694A366F18FD3AB00AF472EBDEDA5147CF350D4AB58F9' +
           '95B16D28F7BA681AD824F6FB90A1D3550BA903BA363BB837E63E5' +
           'FFE0ABBBA661E48F3B9D05F69C1FED369D5EF6B59D96798DE06E4' +
           '32EC3DC0D9DCE759C5E8765ABAC9C40864E176C4E5F89500D7AB2' +
           '1A61296FEAA726617D5F65A640EE');

      tree := BitmapFromString(3, 3, '889049765B3768783488693F7A' +
           '5D3898A86582643B7D5F387D5F38');

      Oak2 := BitmapFromString(2, 2, '202816FF4027304006405016');

      GroundBMP := BitmapFromString(5, 5, 'z78DA333535363774351D6424' +
           '007EB4203B');

    end;
    //////////////////////////////////////////////////////////////////////
    Procedure Setup;
    begin
      SetupSRL;
      DeclareBMPS;
      ActivateClient;
      DeclarePlayers;
      LoginPlayer;
      ClearDebug;
      PerfectNorth;
      SetRun(true);
    end;
    ////////////////////////////////////////////////////////////////////
    Procedure GetToLumb;
    begin
      Gametab(7);
      if(FindBitmap(Tele, x, y))then
      begin
        MMouse(x, y, 1, 1);
        Mouse(x, y, 1, 1, True);
        Wait(19000+random(2000));
        GameTab(4);
      end;
      FreeBitmap(Tele);
    end;
    /////////////////////////////////////////////////////////////////////
    procedure GetToTree;
    begin
      RadialRoadWalk(FindRoadColor, 55, 75, 70, 0, 0);
      RadialRoadWalk(FindRoadColor, 60, 110, 70, 0, 0);
      RadialRoadWalk(FindRoadColor, 95, 64, 50, 0, 0);
      RadialRoadWalk(FindRoadColor, 336, 356, 64, 0, 0);
      RadialRoadWalk(FindRoadColor, 300, 343, 39, 0, 0);
    end;
    /////////////////////////////////////////////////////////////////////
    procedure GetToOak;
    begin
      RadialRoadWalk(FindRoadColor, 55, 75, 70, 0, 0);
      RadialRoadWalk(FindRoadColor, 110, 60, 60, 0, 0);
      RadialRoadWalk(FindRoadColor, 95, 64, 40, 0, 0);
    end;
    /////////////////////////////////////////////////////////////
    procedure GetToWillow;
    begin
      RadialRoadWalk(FindRoadColor, 55, 75, 70, 0, 0);
      GroundColor := AutoColorThis(GroundBMP,80,MMX1,MMY1,MMX2,MMY2);
      RadialWalk(GroundColor, 359, 304, 65, 0, 0);
    end;
    /////////////////////////////////////////////////////////////
    function FindFastRandoms: Boolean;
    var
      i: Integer;
    begin
      for i := 1 to 14 do
      begin
        case I of
          1: CloseWindow;
          2: if FindTalk then
              Result := True;
          3: if FindMod then
              Result := True;
          4: if FindMime then
              Result := True;
          5: if FindMaze then
              Result := True;
          6: if FindQuiz then
              Result := True;
          7: if FindDemon then
              Result := True;
          8: if FindScapeRune then
              Result := True;
          9: if FindTalk then // Call it twice
              Result := True;
          10: if FindLamp(LampSkill) then // Maybe we missed it?
              Result := True;
          11: if (FindNewBox) then
            begin
              Result := True;
              if (UseBoxSolver) then
                SolveBox
              else
                GambleNewBox;
            end;
          12: if FindTrade then
              Result := True;
          13:
            begin
              if NoGameTab then
              begin
                Result := True;
                Players[CurrentPlayer].Rand := 'No GameTab';
                //Players[CurrentPlayer].loc := 'No GameTab';
                Logout;
                Exit;
              end;
            end;
          14: if RC then
              Result := True;
        end;
        if Result then
          Break;
        Wait(1);
      end;
      SaveToChatLog;
    end;
    //////////////////////////////////////////////////////////////////////
    procedure findrandoms;
    begin
      FindFastRandoms;
      FindNormalRandoms;
    end;
    //////////////////////////////////////////////////////////////
    procedure antiban;
    begin
     case Random(10) of
      2:begin
       MouseBox(MSx1, MSy1, MSx2, MSy2, 3);
       end;

      4:begin
          HoverSkill('Woodcutting', False);
          wait(2000+random(1000));
          GameTab(4);
        end;

      5: PickUpMouse;

      6:begin
        MouseBox(MIx1, MIy1, MIx2, MIy2, 3);
        end;

      8: BoredHuman;

      9: begin
             GameTab(1 + Random(12));
             wait(1000+random(1000));
             GameTab(4);
           end;
     end;
    end;

    /////////////////////////////////////////////////////////////
    procedure ChopLog;
    begin
      repeat
        if FindObjectMulti(x, y, 'Tree', 'ree', 'Chop down Tree', 4624512, 4753536, 4026472, 4159600, 20, True, True)then
        begin
        Mouse(x, y, 0, 0, True);
        antiban;
        Wait(7000+random(5000));
      end;
    until (InvFull);
    FreeBitmap(tree);
    end;
    /////////////////////////////////////////////////////////////
    procedure ChopOak;
    begin
      Log := DTMFromString('78DA633CCEC4C0F0940105A4F9E9816946289' +
           'FF12450CD5B54350D4956A86AF661AAD934290855CD4E4CBB323D' +
           'A550D5EC07AAB98BAA26DA4D0B55CD69A09A5BA86A9C4D6451D55' +
           'C00AA79C080061851D55C02AA798DAA222BD000450D009C151425' +
           '');
      repeat
        if FindObjMulti('Oak', 123, 456, 789, 10) then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, True);
          antiban;
          findrandoms;
          Wait(10000+random(1000));
        end;
      until FindDTM(Log,x, y,688, 423, 731, 460);
    end;
    ///////////////////////////////////////////////////////////////////////
    procedure ChopWillow;
    begin
      repeat
        if FindObjMulti('Willow', 123, 456, 789, 10) then
        begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, True);
          antiban;
          findrandoms;
          Wait(15000+random(5000));
        end;
      until ( InvFull );
    end;
    /////////////////////Drop Logs/////////////////////////////////////////
    procedure DropLogs;

    var Log,x,y:integer;

    begin
      Log := DTMFromString('78DA633CCEC4C0F0940105A4F9E9816946289' +
           'FF12450CD5B54350D4956A86AF661AAD934290855CD4E4CBB323D' +
           'A550D5EC07AAB98BAA26DA4D0B55CD69A09A5BA86A9C4D6451D55' +
           'C00AA79C080061851D55C02AA798DAA222BD000450D009C151425' +
           '');
      repeat
        if (FindDTM(Log, x, y, mix1, miy1, mix2, miy2)) then
        MMouse(x, y, 2, 2);
        Wait(100 + Random(256));
        Mouse(x, y, 0, 0, False);
        ChooseOption(x, y, 'rop');
        Wait(1500 + Random(750));
      until (not (FindDTM(Log, x, y, mix1, miy1, mix2, miy2)));
    end;
    /////////////////////Sell Oaks/////////////////////////////////////////
    procedure GetToStore;
    begin
      RadialRoadWalk(FindRoadColor, 239, 290, 60, 0, 0);
      RadialRoadWalk(FindRoadColor, 290, 239, 40, 0, 0);
      RadialRoadWalk(FindRoadColor, 287, 328, 50, 0, 0);
      RadialRoadWalk(FindRoadColor, 296, 340, 30, 0, 0);
    end;
    ////////////////////////////////////////////////////////////////////
    procedure Getinshop;

    var Tries: Integer;

    begin
      repeat
        if(FindSymbol(x,y,'shop'))then
        begin
          Mouse(x,y,2,2,true);
          Flag;
          Exit;
          Tries := Tries + 1;
        end;
        wait(500+random(600));
      until(Tries = 10);
      begin
        GameTab(2);
        GameTab(4);
        repeat
          if(FindSymbol(x,y,'shop'))then
          begin
            Mouse(x,y,2,2,true);
            Flag;
            Exit;
            Tries := Tries + 1;
          end;
          wait(500+random(600));
        until(Tries = 15);
        begin
          Writeln('Shop To Crowded maybe try again later');
          Logout;
          end;
        end;
      end;
    /////////////////////////////////////////////////////////////////////////
    procedure FindShopGuy;
    begin
      repeat
        if not loggedin then Break;
        if FindObjMulti('Shop', 5663104, 2377319, 8092805, 10) then
        GetMousePos(x, y);
        Mouse(x, y, 0, 0, False);
      until (FindText(x, y,'-to', upchars, msx1,msy1,msx2,msy2))
      mouse(x,y+25,2,2,true)
    end;
    ///////////////////////////////////////////////////////////////////////////
    procedure SellOaks;
    var OakLogs,x,y:integer;
    begin
      OakLogs := DTMFromString('78DA639CCDC4C0F094010564051A806946289' +
           'F11A4E60E031A604455B30CA8E6360135AB806A5E1150B310A8E6' +
           '2D0135D3816A3EA0AA9852E48CAAA61FA8E60DAA9AD2302D54351' +
           '3816A1EE1B70B002B130F5E');
      if FindDTM(OakLogs,x, y,688, 463, 730, 428) then
      begin
        Mouse(x, y, 0, 0, False);
        PopUp('Sell 10 Oak logs');
        Wait(100+random(200));
        Mouse(x, y, 0, 0, False);
        PopUp('Sell 10 Oak logs');
        Wait(100+random(200));
        Mouse(x, y, 0, 0, False);
        PopUp('Sell 10 Oak logs');
      end;
    end;
    //////////////////////////////////////////////////////////////////////////////
    procedure GetBackToOak;
    begin
      RadialRoadWalk(RoadColor, 124, 143, 66, 0, 0);
      RadialRoadWalk(RoadColor, 113, 143, 66, 0, 0);
      RadialRoadWalk(FindRoadColor, 110, 60, 60, 0, 0);
      RadialRoadWalk(FindRoadColor, 95, 64, 40, 0, 0);
    end;
    //////////////////////////////////////////////////////////////////////////////
    procedure CleanSellOak;
    begin
      GetToStore;
      Getinshop;
      FindShopGuy;
      SellOaks;
      CloseWindow;
      GetBackToOak;
    end;
    ///////////////////////////End Selling Willows///////////////////////////////////////
    ///////////////////////////Sell Willows///////////////////////////////////////
    procedure GetToShop;
    begin
    end;

    /////////////////////////////Logs//////////////////////////////////////////
    procedure Logs;
    begin
      GetToTree;
      ChopLog;
      DropLogs;
    end;
    ///////////////////////////////////////////////////////////////////////////
    begin
      Setup;
      GetToLumb;
      Logs;
    end.

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

    Default

    Well the tele bitmap is HUGE.
    Shorten it down to like 10X10.
    Also you should free bitmaps after you use them, they get saved in memory.
    So after you are done with a bitmap do:

    SCAR Code:
    FreeBitmap(OakLogs)
    So it will be removed from memory and less laggy

  3. #3
    Join Date
    Nov 2006
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i dont have a oak log bitmap, i only have oak log dtm

  4. #4
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Usually you get lag when you don't have waits inside of loops.

    Like you have a loop for ChopLogs without any waits in it. Well, it waits if you find the object. If you don't find the object it immediately starts the loop over = lag.

    Add a Wait(500) in that loop just in case, and in any others that you may have in the script.

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

    Default

    same thing goes for DTM it was just an example:
    FreeDTM(OakLogs) works for DTMs.

    Try just shortening the size of that large bitamp also.

  6. #6
    Join Date
    Jul 2006
    Posts
    259
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    just use srl castspell(1) it teles to lumbrige no lag
    "your always where you supposed to be"

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. bitmaps make my script laggy
    By marpis in forum OSR Help
    Replies: 3
    Last Post: 12-15-2008, 09:19 PM
  2. Laggy Procedure
    By crossback7 in forum OSR Help
    Replies: 24
    Last Post: 07-14-2007, 09:20 PM
  3. computer becoming laggy..
    By sherlockmeister in forum News and General
    Replies: 4
    Last Post: 06-12-2007, 07:06 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
  •