In any script, you can use the dt variable passed to the update function to increment a timer. For example:
var Timer = pc.createScript('timer');
// initialize code called once per entity
Timer.prototype.initialize = function() {
this.timer = 0;
};
// update code called every frame
Timer.prototype.update = function(dt) {
this.timer += dt;
if (this.timer > 10) {
// 10 seconds has elapsed - do whatever you need here...
// Reset the timer
this.timer = 0;
}
};