Skip to content

Next: GetBuiltin

Archie_UwU edited this page Dec 25, 2023 · 1 revision

Retrieves the value of a local built-in or a global built-in variable.

Syntax

AurieStatus GetBuiltin(
    [in]           std::string_view Name,
    [in, optional] CInstance*       TargetInstance
    [in, optional] int              ArrayIndex
    [out]          RValue&          Value
);

Parameters

Name

The case-sensitive name of the built-in variable to access.

Important

Using this function, you can get the index of either a local built-in (such as id, image_index, etc.), or a global built-in (such as room, instance_count, etc.).

A global built-in variable IS NOT the same as a regular global variable, and cannot be treated as such - to look up a global variable, use the variable_global_get built-in function, or the GetInstanceMember function together with the global instance obtained from GetGlobalInstance.

TargetInstance

The instance whose built-in variables are being accessed. While this parameter is unused while accessing most global built-in variables, local built-in variables (such as object_index) rely on this instance being valid and may crash the game if an invalid instance is provided.

ArrayIndex

An optional array index to use when accessing a built-in arrays (like argument). For non-array accesses, specify NULL_INDEX, defined in YYTK's Shared.hpp file.

Value

A buffer into which the value of the built-in variable will be written. The contents of this buffer are guaranteed to remain unchanged if the function fails.

Return Value

On success, the function returns AURIE_SUCCESS and writes the value of the built-in variable into the Value buffer. If the function fails, it returns a matching error code. If the internal variable lookup facilities aren't available, the function returns AURIE_MODULE_INTERNAL_ERROR. If the variable referenced by the Name parameter does not exist, the function returns AURIE_OBJECT_NOT_FOUND. If the variable can't be fetched (has no getter), the function returns AURIE_ACCESS_DENIED.

Quick Access

Documentation

Writeups

Clone this wiki locally