VGMQ: SCRIPTED QUIZ

The my-event editor already provides many special features you can use to create a custom experience.

With the scripted quiz, you can now define your own re-usable specials!

It also gives you more control over the quiz, and enables conditionnal specials through the use of player variables

DEMO SPECIALS

SAMPLE SCRIPT


function quiz($quiz, $player, $scope, $room, $chat, $me, $timeout){

	$scope.categories = ['rpg','sport','strategy','action'];
	$scope.selectCat = c => {
		$scope.myCat = c;
		$player.set('cat',c);
	}

	$quiz.on('init',()=>{
		// the quiz is ready, after it is launched or player join/F5 during                
		// we restore player variables needed in html scope
		$scope.myCat = $player.get('cat');
	});    

	$quiz.on('round-start',o=>{
		console.info('ROUNDSTART',o.current,o);
		if(o.current===1) $chat.warn('This is the first round');    		
	});

	$quiz.on('intro',()=>{
		$chat.warn('The intro STARTED');
	});

	$quiz.on('outro',()=>{
		$chat.warn('The outro STARTED');
	});

	$quiz.on('destroy',()=>{
		// remove eventual service listeners...        
	});
	
	
}
			

TEMPLATE


<div class="my-super-quiz" >
    <b ng-if="myCat">YOUR CATEGORY: {{myCat}}</b>
    <div ng-if="!myCat">
        <span ng-repeat="c in ::categories">
            <button ng-click="selectCat(c)">{{::c}}</button>
        </span>
    </div>
</div>
			

CSS


#quiz .my-super-quiz button {
	color:red;
}
			

OTHER SAMPLES