Results 1 to 2 of 2

Thread: Need help making advanced sleeping procedure/s

  1. #1
    Join Date
    May 2008
    Location
    Oregon, USA
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Need help making advanced sleeping procedure/s

    Ok i have been working on some scripts but i have been stuck for a couple days trying to make a procedure that gets the system time and would if the time is between around 1 and 5 AM go to sleep for 5-9 hours/ until 6-11 am. I have reviewed lots of scripts with sleeping and far as i can tell non of the ones i have found use the time on the computer to choose sleep time. It would be simpler if when the GetSystemtime procedure was used the outcome wasn't just random numbers that make no since to me. If someone could please explane how to decode the outcome of the system time for has a procedure or even could just tell me how to do this it would be greatly appreciated! This is for use in scripts that have the ability to run for days... i just want to make them sleep properly.

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

    Default

    this is a simple mock up of a sleep procedure, which is really all you need.

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

    const
      sleeptime = 2000; //time in mili seconds
      sleepfor = 1000; //in miliseconds
     
    var time : integer;

    procedure checksleep;
    begin
      t := gettimerunning;
      if t >= sleeptime then
      begin
        writeln('sleeping');
        wait(sleepfor + random(sleepfor));
        t := 0;
      end;
    end;

    begin
      marktime(time);
      wait(2000);
      checksleep;
    end.

    ofcorse, change it up to how every you want
    Last edited by Awkwardsaw; 08-07-2009 at 09:01 AM.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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
  •