Next: CallGameScriptEx - AurieFramework/YYToolkit GitHub Wiki

Calls a user-defined script within a user-specified context.

Syntax

AurieStatus CallGameScriptEx(
    [out]          RValue&                    Result,
    [in]           std::string_view           ScriptName, 
    [in, optional] CInstance*                 SelfInstance,
    [in, optional] CInstance*                 OtherInstance,
    [in]           const std::vector<RValue>& Arguments
);

Parameters

Result

A reference to a buffer into which the result of the script is written. If the script does not return a value, the RValue will be undefined. If the call fails, the buffer's contents are guaranteed to be unchanged.

ScriptName

The case sensitive name of the script, including the gml_Script prefix, to be called.

SelfInstance

The instance or struct pointed to by the self keyword in GML. Can be set to nullptr if you are sure the script doesn't access the self object. Games usually expect a custom calling convention for scripts. If your code provides an object that doesn't adhere to the game's calling convention, unexpected behavior may occur.

OtherInstance

The instance or struct pointed to by the self keyword in GML. Can be set to nullptr if you are sure the script doesn't access the other object. Games usually expect a custom calling convention for scripts. If your code provides an object that doesn't adhere to the game's calling convention, unexpected behavior may occur.

Arguments

A vector of arguments, with which the script will be invoked. The arguments are passed in the same order as if calling the script from regular GameMaker code.

Return Value

Value Description
AURIE_SUCCESS The script was called successfully.
AURIE_OBJECT_NOT_FOUND The script does not exist.
AURIE_INVALID_PARAMETER ScriptName refers to a built-in or an extension function instead of a script.
AURIE_ACCESS_DENIED No function is linked to the script.

Requirements

Criterium Value
Minimum YYTK Version 4.0.0
Context Engine-synchronous
⚠️ **GitHub.com Fallback** ⚠️