Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Triggering a twine sugarcube widget with javascript?

Hello all. Simple question... how do I trigger a twine widget from pure javascript code?
setup.enemycd = function () {
	var elem  = document.getElementById("enemycdbar");
	var width = 1;
	var id    = setInterval(frame, state.active.variables.enemy_cd2);

	function frame() {
		if (width >= 100) {
			clearInterval(id);
                        <<twine_widget>>;
		}
		else if (state.active.variables.enemy_is_stunned != 0) {}
		else {
			width++;
			elem.style.width = width + '%';
		}
	}
};

Basically once the width of the "enemycdbar" hits 100%, my <<twine_widget>> is triggered. Obviously the "<< >>" syntax is just to show what I'm trying to achieve, I know it's not the right way to do it in pure javascript >_<.

Comments

Sign In or Register to comment.