GML How to delay text blips

C

chimericalCharlatan

Guest
I'm working on a dialogue system and everything is working just fine except for the text blips that play every time a character is typed - I'd like to delay each blip so it doesn't sound so weird. I know GM 8.1 had a wait() function but I can't think of a replacement for that that doesn't involve an alarm or a step timer.

Here's my code on my text writing object:

Code:
if (characters < message_length)
    {
    characters_old = characters
    hold = keyboard_check(ord("Z"));
    characters += increase * (1 + hold);
    message_draw = string_copy(message[message_current], 0, characters); 
    if round(characters) > characters_old scr_playblip(snd_textblip)
}
else
    {
    if (keyboard_check_pressed(ord("Z")))
    {
        if (message_current < global.message_end)
        {
            message_current += 1;
            message_length = string_length(message[message_current]); 
            characters = 0;
            message_draw = "";
        }
        else {
            instance_destroy();
        }
    }
}
and here's the code for my script scr_playblip that plays the text blip:

Code:
if audio_is_playing(argument0)
{
audio_stop_sound(argument0)
audio_play_sound(argument0,0, false)
}
else
audio_play_sound(argument0,0, false)
 

TheouAegis

Member
Wait() was crap, one reason they removed it. You want a timer, or you can increase the dead air of your blip sound...

But your sound playing code is playing the sound even if it's already playing. You don't want that. If it's playing, don't play another one.
 
Top