Results 1 to 4 of 4

Thread: if(wait(1000))then

  1. #1
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default if(wait(1000))then

    Hello,

    I want to make a clock. One problem. I don't know how to start

    I want something that works like what's in the title. It waits a certain amount of time, and preforms a command.

    Please help,

    Mike.

  2. #2
    Join Date
    Dec 2006
    Location
    SC
    Posts
    692
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well, you can't do it how you had it, because "Wait" doesn't return a boolean. Try this.

    SCAR Code:
    program Timing;

    var
    Time: Integer;

    begin
     repeat
      Time:=Time+25;
       Wait(1);
     if (Time>=1000) then
       WriteLn('Yes!');
     until(false);
    end.

  3. #3
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Showing how much time has passed is a stopwatch. For that you can use wait. Wait does not return anything, it just makes the script do nothing for that many milliseconds.

    SCAR Code:
    program New;
    {.include SRL/SRL.scar}
    var NumberOfSecondsPassed:integer;
    begin
      SetupSRL;
     
      repeat
        wait(1000);
        NumberOfSecondsPassed:=  NumberOfSecondsPassed+1;
        cleardebug;
        Writeln(inttostr(NumberOfSecondsPassed)+' seconds have passed');
      until isfkeydown(12);
    end.

    For a clock, you can get the time from the computer and display it how you want. Someone posted an analog clock scripts, prolly in other scripts.

  4. #4
    Join Date
    Jan 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    and this could be just a simple clock i made, when i saw this threed:


    SCAR Code:
    program SimpleClock;

    var
    secondes,minutes,hours: integer;

    begin
    cleardebug;

    repeat

    writeln('Clock:');

         if(secondes>=60) then
              begin
              secondes:=0
              end;

         if(minutes>=60) then
              begin
              minutes:=0
              end;

    writeln(inttostr(hours)+' hours '+inttostr(minutes)+' minutes '+inttostr(secondes)+' secundes ');
    wait(1000);

         if(secondes=59) then
              begin
              minutes:=minutes+1
              end;

         if(minutes=59) then
              begin
              hours:=hours+1
              end;
              secondes:=secondes+1
              cleardebug;

    until(isfkeydown(12))
    end.
    end.

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
  •