JavaScript character conversation


#1

Hello,

I’m trying to make a character say multiple boxes of text. In Coblocks it’s easy to do with the pause block between say blocks, but in JavaScript I can’t figure out how to do the same function as the pause block. E.g.
Character.say(“Hello”);
pause(2);
Character.say(“I have been here for 9 years.”);

What is the equivalent to the pause in CoSapces JavaScript?


#2

I think I solved it myself with the awesome API.

character.say(“Hello”);
Scene.schedule(function(){character.say("The next thing. ")}, 2);

Don’t know if this is the best way, but it seemed to work for me.


#3

Hi @Ryan_Noonan_DETNSW,

the way you wrote it is correct. You schedule a new text be said after two seconds. The syntax with pause(2) you proposed above is interesting, and we’re currently looking into ways to make such delayed actions (or actions that happen after each other) easier to script in JS/TS :slight_smile: