Triggered variable one time

Hello guys!
I got a problem.
I make game similar to FTL and i need this for my crew members code.
So... i got script for rooms and crew members which are cloned obj_crew.
This is inside the room_script which are in draw event of gui_object.
This code it's for slots on my room scripts for the crew.

I need when the crew got inside the room the variable
global.free_room_slot =+1 once

var inst;

inst = collision_rectangle(argument2,argument3,argument2+105,argument3+105, obj_crew, false, true)

if inst != noone



        global.free_room_slot += 1




Thank you in advance!


Are you saying that you only want to add to free_room_slot once? Then set some other variable to true when you do that and check that variable before running that line. But in that case, it looks like the value will only ever be 0 or 1, so I don't see why you would need +=.
Dear Nidoking, i got 4 free lots...
So the value have to be 0,1,2,3
I need when the crew it's inside this value to increase with +1
i need to triggered one time in step event this variable free_room_slot +=1

Room explanation slots:
free_room_slot = 0 - This is for the first slot
free_room_slot = 1 - This is for the second slot
free_room_slot = 2 - This is for the third slot
free_room_slot = 3 - This is for the second slot

When crew goes inside the room , free_room_slot value have to increase because the slot are already in use. So the next crew will go the next free_room_slot

free_room_slot variable are connected with the 4 aray cordinates for the rooms which are used by obj_crew .

The variable it's 0 when the crew are not inside the selected room. I use it for emty rooms, when the room it's emty the crew going to slot 0

I hope that you will understand me whell..
Thank you in advance!
Last edited:



Increase = -1;


if Increase == -1
free_room_slot += 1;
Increase = 0;

You need something like that. A flag to only allow the increase by one.