Sunset / Sunrise timer

Write here what nice effects or shows you have done with MADRIX or ask other users.

Moderator: MADRIX Team

Locked
JD
Posts: 1
Joined: Mon Jan 30, 2017 2:16 pm

Sunset / Sunrise timer

Post by JD »

I want to control my output with sunset and sunrise. On sunset the quelist need to play, on sunrise it need to stop.

This is wat I have so far:

Code: Select all

void InitEffect()  
{  
    date d =GetDate();// today  
    
    time tr =GetTimeSunriseCity(d,CITY_TILBURG); 
    WriteText("Sunrise: "+(string)tr.hour+":"+(string)tr.min);

    time ts =GetTimeSunsetCity( d,CITY_TILBURG); 
    WriteText("Sunset : "+(string)ts.hour+":"+(string)ts.min);  

    
	time TimeCode  =GetTime();
	WriteText("Current time: "+(string)TimeCode.hour+":"+(string)TimeCode.min);
}  
  

Thanks
Guertler
Support
Support
Posts: 909
Joined: Tue Feb 04, 2014 10:47 am

Re: Sunset / Sunrise timer

Post by Guertler »

Hello JD,
Welcome to the MADRIX forum.
.
First of all I think we need to clearify what should happen when Cue List stops at the sunrise. I assume no effect should play (like a blackout).
In that case you have to create a Cue List in MADRIX which consists of all your desired cues plus a cue which is assigned to an empty strorage place (for the blackout). This cue I would add as the last cue in the Cue List. Also this black out cue should not have duration or time code settings.
Now you have to set the "Follow Cue" to 1 at the penultimate cue of the list. Because when MADRIX is playing the Cue List in a loop it never should play this blackout cue.
After you have create your Cue List you can try to work with the following script:

Code: Select all

@scriptname="Starts and Stops Cue List by sunset/sunrise";
@author="inoage";
@version="1.0";
@description="Starts the Cue List at Sunset and jumps to a special cue at the Sunset";

const int BLACKCUE = 5;		//Please set cue number which should be playback at sunset
date d;
time currentTime;
time tr;
time ts;
int gate = 0;


void InitEffect()
{
	d = GetDate();// today
	tr = GetTimeSunriseCity(d,CITY_TILBURG);
	ts = GetTimeSunsetCity( d,CITY_TILBURG);
}

void PreRenderEffect()
{
	d = GetDate();// today
	currentTime = GetTime();
	tr = GetTimeSunriseCity(d,CITY_TILBURG);
	ts = GetTimeSunsetCity( d,CITY_TILBURG);	

	
	if(ts.hour == currentTime.hour && ts.min == currentTime.min && ts.sec == currentTime.sec )
	{
		if(gate == 0)
		{
			CuelistPlay();
			gate = 1;
		}
	}

	if(tr.hour == currentTime.hour && tr.min == currentTime.min && tr.sec == currentTime.sec )
	{
		if(gate == 1)
		{
			CuelistGoto(BLACKCUE-1);
			gate = 0;
		}
	}
}

void PostRenderEffect()
{

}

void MatrixSizeChanged()
{
	InitEffect();
}

Locked