Skip to content

$utility

11 natives. Read-only natives only look things up; the rest change something. Parameter types use the language's names (Types).

entity_ref_guid_equals_string

$utility.entity_ref_guid_equals_string(entity: Entity, guid_string: string) -> bool

Check if an entity_ref's GUID matches a given string.

ParameterTypeMeaning
entityEntityThe entity_ref.
guid_stringstringThe GUID as a string.

Returns bool: True if the GUID and string are equivalent.

generate_hash32

read-only
$utility.generate_hash32(hash_elements: list) -> int

Generate a hashed 32-bit int given a list of values to hash.

ParameterTypeMeaning
hash_elementslistList containing the values to use when generating the hash.

Returns int: int containing the resultant 32-bit hash.

generate_unique_id

$utility.generate_unique_id() -> vec4

Generates an id based on this device.

Returns vec4: unique identifier

get_app_index

read-only
$utility.get_app_index() -> int

Gets the instance index. Normally 0, unless e.g. -game -game.

Returns int: app client index

get_asset_guid

read-only
$utility.get_asset_guid(asset: Reference) -> var

Get the GUID of a game asset.

ParameterTypeMeaning
assetReferenceThe asset to get the guid from.

Returns var: The Guid

get_filename

read-only
$utility.get_filename(file: Reference) -> string

Gets the filename of a file ref (e.g. 'my_file.animation').

ParameterTypeMeaning
fileReferenceThe file ref.

Returns string: The filename.

get_host_id

$utility.get_host_id(include_app_index: bool) -> vec4

Gets this device's host id. This identifier may change each time Viper restarted.

ParameterTypeMeaning
include_app_indexboolIf true, each app instance will have a unique id.

Returns vec4: device host id

get_packed_value

read-only
$utility.get_packed_value(storage: vec4, index: int, bits: int) -> int

Gets a value from within homogenously packed storage.

ParameterTypeMeaning
storagevec4The storage to read the value from.
indexintIndex to read the value at.
bitsintNumber of bits per entry (1-32).

Returns int: The value from the packed storage

get_system_uuid

$utility.get_system_uuid() -> string

Get a unique identifier string for this device. This identifier should only change when the device changes.

Returns string: device UUID

is_shipping_build

read-only
$utility.is_shipping_build() -> bool

Is this build flagged as shipping?

Returns bool: Are we flagged as shipping?

set_packed_value

read-only
$utility.set_packed_value(storage: vec4, value: int, index: int, bits: int) -> vec4

Sets a value in homogenously packed storage.

ParameterTypeMeaning
storagevec4The storage to add the value to.
valueintThe value to set.
indexintIndex to write the value at.
bitsintNumber of bits per entry (1-32).

Returns vec4: Updated packed storage