How to check if typewriter text has finished?

Hi guys,
I’m currently having difficulty figuring out how can I check when the text has finished typing.
This is my code:
/**
* @param {string} text
*/
paragraphText(text, choices) {
var length = text.length
let i = 0;
this.time.addEvent({
callback: () => {
this.text_paragraph.text += text[i]
++i;
},
repeat: length - 1,
delay: 70
})
}

Thanks in advance!

  • Sorry, I couldn’t find how to format code in the forums!

:wave:

Save the added TimerEvent and check its repeatCount property in the callback. It should be 0 during the last call.