SRL Archive - Other Scripts

if(wait(1000))then


Jason2gs

2007-02-02 17:06:34

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.

WhoCares357

2007-02-02 17:37:23

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

program Timing;

var
Time: Integer;

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

Boreas

2007-02-02 17:37:49

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.

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.

snapy gapi

2007-02-04 08:53:09

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



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.