Skip to content

var_template

Kamran Wali edited this page Dec 1, 2024 · 4 revisions

Inherits: Resource

Resource template script for creating new var variables.

Description

var_template is a Resource template script. You can use this template script to create new scripts/objects that will act as a var. These scripts basically stores and shares the value through reference. The stored value can also be changed during run time. The value can NOT be set during the editor mode. Example of var scripts are cop_bool_var, cop_float_var and cop_int_var.

Note: Make sure to give a unique class name for the new script so that you can create it in the editor.

Tutorial

Properties

Type Name Default Value
untype value

Methods

Return Type Name
untype get_value()
void set_value( untype value )

Property Descriptions

untype value

The stored value that will be shared through the method get_value(). This value can also be changed during runtime through the method set_value(). The property MUST be given a type. If NOT then this script will throw errors.

Note: This value can NOT have a pre-defined value when the application starts. It can only be set through script.


Method Descriptions

untype get_value ()

This method returns the stored _value. Do NOT call the _value directly as that may give unwanted results. The return type is untype. So make sure to give the return type same as the _value's type. If NOT done so then this script will give an error whenever this method is called.

Note: To get the stored value you MUST call this method. Do NOT call the _value directly as that may give unwanted results.


void set_value ( untype value )

This method sets the _value. Do NOT call the _value directly as that may give unwanted results. The parameter value is untype. So make sure the type of this parameter is same as the _value's type. If NOT then this method will throw errors whenever it is called.


Clone this wiki locally