T2008
Member
For some reason, the alarm event will not update a variable to turn true and I have no idea why. After the on sound is played, I want to play a message but beep_on never turns to true. Sometimes in other objects, alarm event works fine. I guess I don't understand how this event works. I've posted the step event code and alarm event code below. Any insight would be greatly appreciated.
Edit: i got it to work using a clock variable; still don't know why alarm doesn't work. Do I have to put alarm[0] = -1 in create event?
Create Event:
Step Event:
Alarm Event:
Edit: i got it to work using a clock variable; still don't know why alarm doesn't work. Do I have to put alarm[0] = -1 in create event?
Create Event:
Code:
image_speed = 0;
beep_on = false;
beep_sound_played = false;
message_played = false;
sound_on = snd_intercom_beep_on;
sound_message = snd_intercom_last_stop;
beep_clock = 150;
start_message = false;
Code:
//Set Image Index
if (!beep_on) || (message_played) {
image_index = 0;
} else {
image_index = 1;
}
//Turn On If Player Is Close
if (!beep_on) && (distance_to_object(obj_player) < 50) {
if (!beep_sound_played) && (!audio_is_playing(sound_on)) {
audio_play_sound(sound_on,10,false);
beep_sound_played = true;
}
}
if (beep_sound_played) {
//Set Alarm To Update Beep Variable
alarm[0] = 150;
}
//Play Message If On And Beep Played
if (beep_on) && (!message_played) {
if (!audio_is_playing(sound_message)) {
audio_play_sound(sound_message,10,false);
}
}
if (beep_on) && (!audio_is_playing(sound_message)) {
message_played = true;
}
Code:
beep_on = true;
Last edited: