• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

This line runs twice [SOLVED]


I'm curious why the line in the draw event runs twice.

global mouse left pressed event
line_to_check = [point, prev_point];
draw event
if (is_array(line_to_check)) // "if line_to_check != 0" will work but I want to know what I'm misunderstanding
    // Delete array
    line_to_check = 0;
    show_debug_message("this line ran");
The debug message, "this line ran", shows up twice. I thought that setting an array to 0 deletes it and therefore the next frame would not run what's the code inside the is_array condition

Maybe, b/c line_to_check equals 0, that is_array(0) is true b/c there is another array with that index? But there's only one array in the entire project.

Thanks for reading.
Last edited:


I'd check to see if you have more than one instance of an object. It might be worth putting a few of the following utility scripts into your project and using them instead so you can find out which object is calling that and on which frame, etc. :Using show_debug_message.

You could also try line_to_check = -1 to test your theory since as far as I know no resource ever has a negative id number.


@samspade Yeah, all those things came to mind as well. I'm just going to mark it solved. It's not a big deal anyway, I was just wondering why. It's as if it takes 2 frames to for the array to be recognized as deleted.