Skip to Content
It is currently August 25th, 2019, 6:13 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: April 5th, 2019, 2:26 pm 
Offline
New User
New User

Joined: April 5th, 2019, 6:59 am
Posts: 2
We're a college/volunteer radio station, so shows almost never happen exactly on time. We have a working system for our main studio, but for remote events I wrote a PAL script to handle going on/off air. It waits for an HTTP event (to start the show), then when that happens it clears the queue, adds the URL of the stream from the remote event to the active deck, then waits for another HTTP event (to end the show). After the second event, it queues up a station ID and goes back to the regularly scheduled programming.

My question is, that script only works for one event. I'm trying to write this with Murphy's Law in mind, so I want to have no more than 5 minutes between remote broadcasts in case something doesn't work right. I could add that script as an event that gets triggered once every 5 minutes or so, but I'd rather not have to add almost 300 times to the event by hand. Is there a way to automatically re-start a script as soon as it ends? I've tried just using PAL.Loop, but the Wait statements get skipped over inside a Loop.


Top
 Profile  
Reply with quote  
PostPosted: April 6th, 2019, 5:02 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7869
Location: Aachen (Germany)
If PAL.Loop skips WaitForEvent, that's a bug and not by design.
Please report that behavior with a sample PAL Script to the Spacial Helpdesk and ask for a fix, maybe this can be repaired for one of the next versions.

In the meantime, you can try using an endless loop instead:
This will repeat as long as True is a truthy value (i.e. forever):
Code:
WHILE True DO
BEGIN
...
PAL.WaitForEvent('event');
...DoStufff();
...
END;


or

This will stop repeating as soon as False is a truthy value (i.e. never):
Code:
REPEAT
...
PAL.WaitForEvent('event');
...DoStuff();
...
UNTIL False;

_________________
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  
PostPosted: April 6th, 2019, 8:22 am 
Offline
New User
New User

Joined: April 5th, 2019, 6:59 am
Posts: 2
That first snippet worked great, thanks! I guess I misread the quick-start scripting guide, I thought it said you couldn't wait in a loop when it's talking about how you can't wait in an if-then statement.


Top
 Profile  
Reply with quote  
PostPosted: April 8th, 2019, 2:09 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7869
Location: Aachen (Germany)
The Quick Start Guide only says you can't wait inside an IF and even explains to some detail how to use a WHILE loop as a makeshift-IF for waiting.

_________________
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  [ 4 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 5 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