[SOLVED] Object/Asset ID not working

Dan1

Member
Hey guys,

I'm having a little trouble trying to identify an objects name by a given ID.
Where global.idremove is the unique ID number given to each object (and the value of the variable is loading correctly according to the debug settings), I'm trying to check if the ID that matches that value is a certain object, but it's not, for some reason, giving me the right output.

I've tried:
Code:
if object_get_name(global.idremove) = ob_Conveyor then global.building = 1
Code:
if object_get_name(global.idremove) = "ob_Conveyor" then global.building = 1
Code:
if asset_get_index(object_get_name(global.idremove)) = ob_Conveyor then global.building = 1
and no matter what, it doesn't return the value of 1 for global.building

Any idea where I'm going wrong with this?
Much appreciated!
 
Also note that the "then" operator is completely superfluous in GML's C-style syntax and is also undocumented, but has been kept for backwards compatibility. I would recommend nipping this in the bud and removing it now just in case it is ever fully deprecated in the future.
 
Top