Results 1 to 11 of 11

Thread: Lagging etc!!

  1. #1
    Join Date
    May 2007
    Location
    Seattle
    Posts
    1,069
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Lagging etc!!

    Why does my script lag like crazy?! ( its not finished! )

    SCAR Code:
    {
    [-]                          SpoonDemon V0.1                                 [+]
    [-]                                                                          [+]
    [-]                                                                          [+]
    [-]                                                                          [+]
    [-]                                                                          [+]
    [-]                                                                          [+]
    [-]                                                                          [+]
    [-]                                                                          [+]
    }

    program SpoonDemon;
    {.include SRL\SRL.SCAR}

    var
      x, y, CurrentCuttingTime, Loads, TLoads, SDTime: Integer;
      TypeTree: string;

    const

    TreeColor = 662038;//Normal Tree Color
    OakColor = 1191727;//Oak Tree Color
    WillowColor = 1582886;//Willow Tree Color
    YewColor = 857879;//Yew Tree Color


    Procedure DeclarePlayers;
    var load : integer;
    begin

    {

    Locations:

    Bank - Draynor Bank (@ the bank!! XD)
    Trees - Draynor Trees (north of bank)
    Oaks - Draynor Oaks (east of bank)
    Willows - Draynor Willows (south west of bank)
    Yews - Draynor Yews (north west of bank)

    }


         HowManyPlayers  :=6;               // Set Number of Players here.
         NumberOfPlayers(HowManyPlayers);   // Sets the Players Array Length;
         CurrentPlayer:=0;              // CurrentPlayer = Array Index

         Players[0].Name :='';          // Username
         Players[0].Pass :='';          // Password
         Players[0].Nick :='';          // Nickname, 3 - 4 letters of username
         Players[0].Loc  :='bank';      // Players Location
         players[0].integers[0]:= 2;    // Amount of Loads
         Players[0].Active:=True;       // Active?

         Players[1].Name :='';
         Players[1].Pass :='';
         Players[1].Nick :='';
         Players[1].Loc  :='bank';
         players[1].integers[0]:= 2;
         Players[1].Active:=True;

         Players[2].Name :='';
         Players[2].Pass :='';
         Players[2].Nick :='';
         Players[2].Loc  :='bank';
         players[2].integers[0]:= 2;
         Players[2].Active:=True;

         Players[3].Name :='';
         Players[3].Pass :='';
         Players[3].Nick :='';
         Players[3].Loc  :='bank';
         players[3].integers[0]:= 2;
         Players[3].Active:=True;

         Players[4].Name :='';
         Players[4].Pass :='';
         Players[4].Nick :='';
         Players[4].Loc  :='bank';
         players[4].integers[0]:= 2;
         Players[4].Active:=True;

         Players[5].Name :='';
         Players[5].Pass :='';
         Players[5].Nick :='';
         Players[5].Loc  :='bank';
         players[5].integers[0]:= 2;
         Players[5].Active:=True;

         WriteLn('Will now SpoonDemonize ' + inttostr(HowManyPlayers)+' players...');

    end;



    {...><> Sig and Proggie Procedures <><...}
    procedure Signature;
    begin
      ChangeReportWidth(220);
      Status('Starting Up...');
      WriteLn('  __________________                                              ');
      Wait(250);
      WriteLn(' |                  |                 __                          ');
      Wait(250);
      WriteLn(' |_______     ______|                |__|                         ');
      Wait(250);
      WriteLn('        |     |__  _______ __      _____  _________               ');
      Wait(250);
      WriteLn('        |     |  |/__\    \  \    /  /  |/  ______/               ');
      Wait(250);
      WriteLn('        |     |   /  ___   \  \  /  /|  |  \______                ');
      Wait(250);
      WriteLn('        |     |  |  |   |   \  \/  / |  |\_____   \               ');
      Wait(250);
      WriteLn('        |     |  |  |___|    \    /  |  |______/  /               ');
      Wait(250);
      WriteLn('        |_____|__|________/\__\__/   |__|\_______/                ');
      Wait(250);
      WriteLn('                   SpoonDemon | Version V0.1                      ');
      Wait(6000);
    end;



    procedure Proggie;
    begin
      Writeln('//==================Progress Report==================\\');
      Writeln('Thank you for using SpoonDemon!');
      Writeln('Cut approx. ' + IntToStr(TLoads*28) + ' logs!');
      Writeln('Please post this proggie at http://srl-forums.com!');
      Writeln('\\=================End Progress Report================//');
      Writeln('Script by: Travis AKA born2code!');
    end;


    {...><> Randoms Procedures <><...}


    procedure Randoms;
    begin
      FindNormalRandoms;
      if (FindFight) then
      begin
        Status('Running...');
        RunAwayDirection('N');
        Wait(8500 + random(3500));
        RunBack;
      end;
    end;

    {...><> Fix Client Procedure <><...}
    procedure FixClient;
    begin
      if(not(LoggedIn)) then Exit;
      SetChat('hide', 1);
      SetChat('off', 2);
      SetChat('on', 3);
      HighestAngle;
      MakeCompass('N');
    end;

    {...><> Banking Procedures <><...}
    procedure Bank;
    begin
      FixClient;
      FFlag(0);
      Wait(2050+random(550));
      Writeln('Banking')
      Repeat
        OpenBankGlass('db', false, false)
      Until(BankScreen);
      FFlag(0);
      wait(500 + random(500));
      if PinScreen then
      begin
        WriteLn('You have a pin. Please delete.');
      end;
      FixBank;
      Deposit(2,28,2);
      CloseBank;
      FixClient;
      Loads := Loads + 1
    end;




    {...><> Chopping Procedures <><...}
    procedure DecideWhatToChop;
    var
    LVL: integer;
    begin
      LVL := GetSkillLevel('woodcutting');
      if (LVL >= 1) then
      begin
        TypeTree := 'Tree';
      end;
      if (LVL >= 15) then
      begin
        TypeTree := 'Oak';
      end;
      if (LVL >= 30) then
      begin
        TypeTree := 'Willow';
      end;
      if (LVL >= 60) then
      begin
        TypeTree := 'Yew';
      end;
    end;


    procedure ChopTree;
    begin
      FixClient;
      Randoms;
      repeat
      if(not(FindObj(x,y,'ree',TreeColor,3))) then
      begin
        WriteLn('Could not find Tree.');
      end;
      until FindObj(x,y,'ree',TreeColor,3);
      Mouse(x,y,1,2,true)
      Wait(5000+random(1550));
      Randoms;
    end;

    procedure ChopOak;
    begin
      FixClient;
      Randoms;
      repeat
      if(not(FindObj(x,y,'ak',OakColor,3))) then
      begin
        WriteLn('Could not find Oak.');
      end;
      until FindObj(x,y,'ak',OakColor,3);
      Mouse(x,y,2,1,true)
      Wait(5000+random(1550));
      Randoms;
      Wait(5000+random(1550));
      Randoms;
    end;

    procedure ChopWillow;
    begin
      FixClient;
      Randoms;
      repeat
      if(not(FindObj(x,y,'illow',WillowColor,3))) then
      begin
        WriteLn('Could not find Oak.');
      end;
      until FindObj(x,y,'illow',WillowColor,3);
      Mouse(x,y,2,1,true)
      Wait(1500+random(550));
      Randoms;
      Wait(2000+random(1550));
      Randoms;
    end;

    procedure ChopYew;
    begin
      FixClient;
      Randoms;
      repeat
      if(not(FindObj(x,y,'ew',YewColor,3))) then
      begin
        WriteLn('Could not find Oak.');
      end;
      until FindObj(x,y,'ew',YewColor,3);
      Mouse(x,y,2,1,true)
      Wait(3000+random(1550));
      Randoms;
      Wait(3000+random(1550));
      Randoms;
      Wait(3000+random(1550));
      Randoms;
    end;


    procedure Chop;
    begin
      case TypeTree of
        'Tree': ChopTree;
        'Oak': ChopOak;
        'Willow': ChopWillow;
        'Yew': ChopYew;
      end;
    end;



    {...><> Walking and Figuiring Procedure <><...}

    //Walking
    procedure WalkTree;
    begin
    end;

    procedure WalkOak;
    begin
    end;

    procedure WalkWillow;
    begin
    end;

    procedure WalkYew;
    begin
    end;



    //Now Banking
    procedure WalkTreeBank;
    begin
    end;

    procedure WalkOakBank;
    begin
    end;

    procedure WalkWillowBank;
    begin
    end;

    procedure WalkYewBank;
    begin
    end;




    procedure WalkToTree;
    begin
      case TypeTree of
        'Tree': WalkTree;
        'Oak': WalkOak;
        'Willow': WalkWillow;
        'Yew': WalkYew;
      end;
    end;

    procedure WalkToBank;
    begin
      case TypeTree of
        'Tree': WalkTreeBank;
        'Oak': WalkOakBank;
        'Willow': WalkWillowBank;
        'Yew': WalkYewBank;
      end;
    end;



    {...><> Loops and Startup Procedures <><...}
    procedure StartUp;
    begin
      ClearReport;
      ClearDebug;
      SetupSRL;
      Signature;
      ActivateClient;
      MarkTime(SDTime);
      DeclarePlayers;
    end;


    procedure Loop;
    begin
      if(not(LoggedIn)) then Exit;
      repeat
        FixClient;
        WalkToTree;
        MarkTime(CurrentCuttingTime);
        repeat
          Chop;
        until(InvFull) or (TimeFromMark(CurrentCuttingTime) >= 15*60000+random(60700));
        WalkToBank;
        Loads:=Loads+1
        Tloads:=Tloads+1
        Proggie;
        DecideWhatToChop;
      Until (Loads=players[currentplayer].integers[0]);
      NextPlayer(True);
      Loads:=0;
      Exit;
    end;



    begin
      StartUp;
      if not LoggedIn then LoginPlayer;
      repeat
        NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
        If(not(LoggedIn))then NextPlayer(False);
        Loop;
      until(false);
    end.
    FORMERLY BORN2CODE | Play Internet Games
    http://img147.imageshack.us/img147/2084/sigg.png

  2. #2
    Join Date
    Mar 2007
    Posts
    3,681
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    compiles fidn with me..

    meh maybe add wait(10) after every line

  3. #3
    Join Date
    May 2007
    Location
    Seattle
    Posts
    1,069
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    It compiles, buy on rs, it lags my char like crazy! It wont do anything.

    (ram, thats a temp thing)
    FORMERLY BORN2CODE | Play Internet Games
    http://img147.imageshack.us/img147/2084/sigg.png

  4. #4
    Join Date
    Oct 2006
    Location
    MI USA
    Posts
    3,166
    Mentioned
    6 Post(s)
    Quoted
    11 Post(s)

    Default

    hmmm...not sure of the lag, but what's the reasoning behind this ?

    if PinScreen then
    begin
    WriteLn('You have a pin. Please delete.');


  5. #5
    Join Date
    May 2007
    Location
    Seattle
    Posts
    1,069
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Fixed!

    @ram its temporary
    FORMERLY BORN2CODE | Play Internet Games
    http://img147.imageshack.us/img147/2084/sigg.png

  6. #6
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    come on add waits in ur loops!

    Repeat
    OpenBankGlass('db', false, false)
    Until(BankScreen);

    add a 500ms wait


    repeat
    if(not(FindObj(x,y,'ree',TreeColor,3))) then
    begin
    WriteLn('Could not find Tree.');
    end;
    until FindObj(x,y,'ree',TreeColor,3);
    Add wait!

    repeat
    Chop;
    until(InvFull) or (TimeFromMark(CurrentCuttingTime) >= 15*60000+random(60700));

    -.- once more...

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  7. #7
    Join Date
    Jul 2007
    Location
    UK
    Posts
    307
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    I would not say 500ms I would say bout 30ms - 100ms but waits in loops are pretty much a nessary unless you want lag :P

  8. #8
    Join Date
    Feb 2006
    Location
    L.A, USA
    Posts
    1,632
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You need more failsafes, in your loops.

    You should try adding counters.

    Code:
    repeat
      c := c + 1; 
      // stuff 
    until (c > 5)
    About lag, yes add some Waits.

  9. #9
    Join Date
    May 2007
    Location
    Seattle
    Posts
    1,069
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by WhiteShadow View Post
    You need more failsafes, in your loops.

    You should try adding counters.

    Code:
    repeat
      c := c + 1; 
      // stuff 
    until (c > 5)
    About lag, yes add some Waits.
    Thanks. I know how to add failsafes and I need to do so.

    Ty everyone!
    FORMERLY BORN2CODE | Play Internet Games
    http://img147.imageshack.us/img147/2084/sigg.png

  10. #10
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by born2code View Post
    Thanks. I know how to add failsafes and I need to do so.

    Ty everyone!
    That's why we are here, to help people out
    Btw it still does lagg as hell?
    [QUOTE=Santa_Clause;277761]I love you too TSN :p[/QUOTE]
    [CENTER][URL="http://www.stats.srl-forums.com/sigs"][IMG]http://www.stats.srl-forums.com/sigs/1324.png[/IMG][/URL][/CENTER]

  11. #11
    Join Date
    May 2007
    Location
    Seattle
    Posts
    1,069
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by the scar noob View Post
    That's why we are here, to help people out
    Btw it still does lagg as hell?
    No. The problem is solved. Ty for your interest.
    FORMERLY BORN2CODE | Play Internet Games
    http://img147.imageshack.us/img147/2084/sigg.png

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Lagging bad!
    By Illkillutill in forum OSR Help
    Replies: 6
    Last Post: 04-15-2008, 01:04 AM
  2. its keeps on lagging
    By cheese444222 in forum OSR Help
    Replies: 2
    Last Post: 10-08-2007, 09:58 PM
  3. Why is this lagging?
    By Dude in forum OSR Help
    Replies: 4
    Last Post: 08-16-2007, 01:33 AM

Posting Permissions

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