2019-03-18 22:29:13

Hello! How can i create a thing like this in bgt: I launch the game. Then, the voice says Welcome and the game starts. Then i press the left arrow key and the voice speaks some text. Then, after i press the left arrow(this is the function startgame) then the new function will start. Then the voice speaks a message again. How do i do this so that the other function will also wait for my keypresses after the previous one has finished? If this sounds a little confusing, i will put the code below. Please tell me what i should do:


void main()
{
tts_voice voice;
show_game_window("test");
voice.speak_wait("Welcome");
startgame();
}
void startgame()
{
tts_voice voice;
voice.speak_wait("Ready? Go!");

while(!key_pressed(KEY_ESCAPE))
{
if(key_pressed(KEY_LEFT))
{
voice.speak_wait("Up, what next?");
difficult();
}
}
else if(key_pressed(KEY_RETURN))
{
voice.speak_wait("Ptich");
}
}
}


void difficult()
{
tts_voice voice;
voice.speak_wait("That was not so difficult, saw... But haha. I reversed the keys.");
while(key_pressed(KEY_ESCAPE))
{
if(key_pressed(KEY_UP))
{
voice.speak_wait("Here we go!");

}
}
}
Thanks
Best regards: Marco

Best regards: Marco

2019-03-19 07:18:06

if you want voice wait and then speak, you have too options: right speak timer and use timer, or wait(milliseconds)

2019-03-19 08:15:57

No one is going to use timers for that lol, at least not for a sapi voice. @Op, you already know about speak_wait() so I think you just probably want mPro, which is in Carter's BGT includes Github repository. I don't know how to use it as I never really got that much into BGT though.

Facts with Tom MacDonald, Adam Calhoun, and Dax
End racism
End division
Become united