New Icon New Struct

This action is only used when creating structs using a function that has been flagged as a constructor function (see Declare A New Function for more information). This action takes the function method for a previously defined function, as well as a number of arguments, which you can expand to add more if required using the Expand Arguments Icon icon on the left. These arguments should correspond to the inputs required by the function, and will be used to populate the struct that is being created. The struct will be returned to the target variable, which can be flagged as a temporary local variable or not.

 

Action Syntax:

New Action

Arguments:

ArgumentDescription
FunctionThe name of the script or user-defined function to call.
Argument0 ... Argument3The different arguments (values) that are to be passed to the script or function (unused arguments can be left blank)
TargetThe name of the variable that is to be targeted for any returned values (can be left blank)

 

Extended Example:

New Exmaple 1The above action block code would probably go in the Create Event of an instance, and declares a new constructor function init_char_struct with four arguments: _str1, _str2, _val1 and _val2. These arguments are then used to populate the given variables within the struct that the function is creating. You would then call the function using the New Struct action in any subsequent event, like this:

New Exmaple 2The function is called and it will return a new struct to the array "char", and the struct will be populated with the variables "name", "location", "hp" and "mana", set to the values used for the corresponding arguments in the function.