asset_has_tags

With this function you can check to see if one or more tag strings is assigned to any asset from the asset browser. You supply either the asset name (as a string) or its asset index, as well as either a single tag string or an array where each item is a single tag string. If you supply an asset index value, then you will need to supply the optional asset type argument (a constant), as assets of different types can have the same index, even though they cannot have the same name. The available asset types are listed in the table below:

 

Constant Description
asset_object The given name refers to an object.
asset_sprite The given name refers to a sprite.
asset_sound The given name refers to a sound.
asset_room The given name refers to a room.
asset_tiles The given name refers to a tile set.
asset_path The given name refers to a path.
asset_script The given name refers to a script.
asset_font The given name refers to a font.
asset_timeline The given name refers to a time line.
asset_shader The given name refers to a shader.
asset_animationcurve The given name refers to an Animation Curve.
asset_sequence The given name refers to a Sequence.

 

If the function succeeds and one or more of the tag(s) is present for the asset then it will return true otherwise it will return false.

 

 

Syntax:

asset_has_tags(name_or_index, tags, [asset_type]);

Argument Description
name_or_index The name of the asset (a string) or its index value (an integer).
tags A single asset tag string or an array with various asset tags.
[asset_type] OPTIONAL! The type of asset to check the tags for, only used when supplying an index for the first argument.

 

Returns:

Boolean

 

Example:

var _a = array_create(3);
_a[0] = "enemy";
_a[1] = "all_levels";
_a[2] = "boss";
asset_has_tags(obj_Enemy_Boss_Parent, _a, asset_object);

The above code will create an array of tags and then check to see if any of them are applied to the given object.