time_source_exists

This function returns whether the given variable holds a Time Source.

If the Time Source was destroyed, this will return false, however if the Time Source was stopped or it merely expired, it will continue to exist, meaning this function returns true.

 

Syntax:

time_source_exists(id);

ArgumentTypeDescription
idTime SourceThe Time Source to check

 

Returns:

Boolean

 

Example:

if (time_source_exists(global.spawn_time_source))
{
    if (keyboard_check_pressed(vk_space))
    {
        time_source_destroy(global.spawn_time_source);
    }
}

This code checks if a Time Source exists. If it does, it checks if the Space key was pressed.

In that case, it destroys the Time Source.