Skip to Content
It is currently July 17th, 2019, 3:33 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Pal. wait for time
PostPosted: April 6th, 2019, 10:56 am 
Offline
New User
New User

Joined: October 25th, 2018, 12:48 pm
Posts: 1
For some reason, this just jumps to PAL.WaitForTime('23:59:59'); and ignores the other wait for times.

Bug or do I need to add code?


Code:
if DayOfWeek(Now) = Saturday then
begin
PAL.WaitForTime('05:59:59');
File_Remote1 := File_Remote;
getwx();
PAL.WaitForTime('10:59:59');
File_Remote1 := File_Remote;
getwx();
PAL.WaitForTime('18:59:59');
File_Remote1 := File_Remote';
getwx();
 PAL.WaitForTime('23:59:59');
end;


Last edited by Mastacheata on April 8th, 2019, 12:55 pm, edited 1 time in total.
Please use [CODE] tags next time


Top
 Profile  
Reply with quote  
 Post subject: Re: Pal. wait for time
PostPosted: April 8th, 2019, 1:06 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7860
Location: Aachen (Germany)
It is a bug, but a bug inside the language that Spacial is aware of and doesn't have a solution for.
You can NOT wait inside an IF. Try writing a loop with a condition that only executes once instead.

PAL Quick Start Guide p.7 wrote:
Very important note: Due to implementation problems, you can not do PAL.WaitForXXX within an IF statement block. This will be discussed later.


PAL Quick Start Guide p.10 wrote:
Now, a few important concepts about waiting:
You can not wait inside
a) IF..THEN statements
b) CASE..OF statements
c) Custom functions & procedures
PAL will simply skip over the wait command. This is an unfortunate result of the implementation of the core language PAL was based on. This language was never meant to be execute line-by-line, but rather as a complete program. Thus we had to significantly modify this language to meet our needs. Unfortunately we were not able to work around this problem for the above mentioned statement blocks.

The good news is that there is ways to avoid this problem.
1. Do not wait inside functions & procedures. Rather repeat the source lines where needed.
2. In the case of IF..THEN and CASE..OF statements, use a WHILE..DO loop instead.

For example:
IF (A>B) THEN
begin
PAL.WaitForPlayCount(1);
end;

Can be replaced with:
var Dummy : Boolean = True;
WHILE (A>B) AND (Dummy) DO
begin
PAL.WaitForPlayCount(1);
Dummy := False;
end;

While obviously not the perfect solution, it gets the job done. Oh, another tip. You can use the Dummy variable if you have many replacements to do. You just have to remember to either set Dummy := True; before the while loop.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group