Results 1 to 6 of 6

Thread: breaks in script

  1. #1
    Join Date
    Mar 2008
    Posts
    84
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default breaks in script

    can some1 teach me how to add a break procedure after a few loads in any script?

  2. #2
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Like an exit? Is it in a loop? Wouldn't a simple "Break;" work if it's in a loop?

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  3. #3
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You can do it a few ways...
    Example:

    SCAR Code:
    repeat
      DoLoads;
      if (LoadsDone >= 5) then Exit;
    until (false);
    SCAR Code:
    repeat
      DoLoads;
    until (LoadsDone >= 5);
    SCAR Code:
    while (LoadsDone < 5) do
    begin
      DoLoads;
    end;

    Break; is used in a script when you want to break out of a loop.
    Example:
    SCAR Code:
    for i := 0 to i <= 5 do
    begin
      DoStuff;
      if(not(DoMoreStuff))then Break; // When it breaks, then it will no longer goto next line.
      ThenDoMoreStuff;
    end;

  4. #4
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    repeat
      DoLoads;
      if (LoadsDone >= 5) then Break;
    until (false);
    Corrected .

  5. #5
    Join Date
    Mar 2008
    Posts
    84
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I mean the script will log out for a few mins and log back in again after a while.
    Thx for the help, I'm only a beginner.

  6. #6
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    I just use TimeFromMark's.
    SCAR Code:
    program Sleeper;
    {.include SRL/SRL.scar}

    var
      Running, _SleepEvery : Integer;

    const
      Sleeper = True;  // Use sleeping?
      SleepEvery = 11; // Sleep every (xx) minutes
      SleepFor = 0; // Sleep for (xx) minutes (0 = a random amount of seconds _below_ 1 minute)

    procedure _Sleep;
    var
      t : Integer;
    begin
      if Not Sleeper then
        Exit;
      if TimeFromMark(Running) >= (SleepEvery * 60000) then
      begin
        Logout;
        if SleepFor = 0 then
          t := Random(59999)
        else
          t := SleepFor * 60000;
        Inc(Players[CurrentPlayer].Integers[3]);
        IncEx(Players[CurrentPlayer].Integers[4], t);
        Wait(t);
        LoginPlayer;
        SetAngle(True);
        MakeCompass('N');
        MarkTime(Running);
      end;
    end;

    begin
      SetupSRL;
      _SleepEvery := (SleepEvery * 60000) + Random(30000);
      MarkTime(Running);
      repeat
        DoLoop;
        _Sleep;
      until(False);
    end.
    Ce ne sont que des gueux


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
  •