AwesomeSRL
2009-10-17 17:55:00
Hey guys, I was thinking of an idea of making a True/False function that could be called whether or not to take a break. It requires a break-time to be provided and if the play-time exceeds to break-time then it will return False to take a break.
[PHP]
Description: This can be used to to define whether to take a break or not by returning a True or False Statement.
Checks for if Play is True or False. If the "TimeTillBreak" is less then "TimePlayed" then it will return that you are at or have exceeded the time that is limited till a break; thus making PlayOrBreak = False.
PlayOrBreak = False MEANS that it is time to take a break
PlayOrBreak = True MEANS that it has not yet reached the time to break
TimePlayed: Will find how long you have been playing for in minutes
TimeTillBreak: Used by the script to define how long till break-time is reached. It must be defined in minutes.
[/PHP]
MY ORIGINAL SRL Code:
Awkwardsaw's Shortened Version:
[PHP]
Description: This can be used to to define whether to take a break or not by returning a True or False Statement.
Checks for if Play is True or False. If the "TimeTillBreak" is less then "TimePlayed" then it will return that you are at or have exceeded the time that is limited till a break; thus making PlayOrBreak = False.
PlayOrBreak = False MEANS that it is time to take a break
PlayOrBreak = True MEANS that it has not yet reached the time to break
TimePlayed: Will find how long you have been playing for in minutes
TimeTillBreak: Used by the script to define how long till break-time is reached. It must be defined in minutes.
[/PHP]
MY ORIGINAL SRL Code:
function PlayOrBreak: Boolean;
var
TimePlayed, TimeTillBreak: Integer;
begin
Result := True;
TimePlayed := Round(GetTimeRunning / 60000.0);
If
(TimeTillBreak <= TimePlayed) Then
Result := False;
TimeTillBreak := (TimeTillBreak + TimePlayed);
If
(TimeTillBreak >= TimePlayed) Then
Result := True;
end;Awkwardsaw's Shortened Version:
function PlayOrBreak(TimeTillBreak: integer): Boolean;
var
TimePlayed: Integer;
begin
TimePlayed := Round(GetTimeRunning / 60000.0);
result := TimePlayed >= TimeTillBreak;
end;