Hello all. Simple question... how do I trigger a twine widget from pure javascript code?
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 >_<.
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 >_<.