Time of Day scene-loading?

Hey gang,

I’ve been trying to load different scene based on Time of Day on page-load, and naturally Not Quite Getting It. Any suggestions here?

Here’s my code (using 10 for afternoon for testing purposes):

var myDate = new Date(); 
if ( myDate.getHours() > 18 )  
	{ 
		hypeDocument.showSceneNamed('evening');
	} else if { ( myDate.getHours() > 10 )			
		hypeDocument.showSceneNamed('afternoon');
	}				

}

dayornight.hype.zip (27.2 KB)

Thank you to all in advance…

Typo! You misplaced the bracket, it should be:
var myDate = new Date();

if ( myDate.getHours() > 18 ){ 
	hypeDocument.showSceneNamed('evening');
} else if ( myDate.getHours() > 10 ){	
	hypeDocument.showSceneNamed('afternoon');
}
1 Like

I should use a ‘start’-scene with the script on scene-load. Check this out: dayornight.hype.zip (31.1 KB)

Oh ffs :wink: KILL ME NOW. Un grand merci René! (with the assumption you’re French-speaking)

You’re welcome, it was nothing…
:slight_smile:
Although my name is French, I’m born and raised in the Netherlands :wink:

Aaah, that’s two silly mistakes today. Apologies René!