Page 3 of 3 FirstFirst 123
Results 51 to 52 of 52

Thread: Request a Function/Procedure

  1. #51
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by MasterCrimez View Post
    I don't understand. What does Breakearly mean and nobreak?
    Well it was just a suggestion so that you don't end up breaking out of the "mainloop" every 30 minutes. That seems somewhat predictable; to me at least. I guess I could show you how I meant for those variables to be used:

    Simba Code:
    var
      BreakTime, t: Integer;
      BreakEarly, NoBreak: Boolean;
    // ^ Note that these are global vars

    procedure HandleBreak;
    var
      Rand: Integer;
    begin
      if BreakEarly or NoBreak then
        Exit;
      Rand := Random(500);
      case Rand of
        0: BreakEarly := True;
        1: NoBreak := True;
      end;
    end;

    begin
      BreakTime := (30 * 1000);
      BreakEarly := False;
      NoBreak := False;
      repeat
        SetupScript;
        // ...
        MarkTime(t);
        repeat
          HandleBreak;
          MainLoop;
          // ...
          if BreakEarly then // Nifty feature #1
          begin
            BreakEarly := False;
            Break;
          end;
          if NoBreak then // Nifty feature #2
          begin
            NoBreak := False;
            MarkTime(t);
          end;
        until (TimeFromMark(t) >= BreakTime)
      until (Whatever)
    end.

    Taking a look back at your original code, I think you might be confused because your MainLoop has repeats. This would only work if you don't repeat your MainLoop inside the MainLoop. Instead you use the repeats of what I did above to cycle through the HandleBreak, MainLoop, etc. So you essentially make your MainLoop equivalent to one load, or one complete cycle of your script. Then it will check for a BreakEarly and a NoBreak quite often.

  2. #52
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    thanks!

Page 3 of 3 FirstFirst 123

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
  •