![]() |
![]() |
![]() |
![]() |
parse_v/load_v_script
Synopsis
module parse_v {
string+read _v_commands;
prim+read _trigger;
int+read _active;
int+read _on_inst;
group+read *relative;
int+read _no_errors;
int+read _sync;
int _mode;
};
module load_v_script {
string+read _filename;
prim+read _trigger;
int+read _active;
int+read _on_inst;
group+read *relative;
};Description
parse_v and load_v_script execute a script of V commands. Note that for the purposes of this reference page, a "V command" can be a V command (which is prefixed with a $ character) or a V statement (which is not). parse_v gets the V commands from a string object, load_v_script picks up the list of V commands from a file. Otherwise, the operation of these two commands is the same.
Parameters
For the parse_v module, contains a string of Vcommands that are to be parsed when this module's method runs. For example:
$ commands included in v_commands must be separated by line breaks. Note also that double quotes can be included in the string, but must be escaped.
The V commands are loaded into the object specified by the relative parameter. The module's update method is triggered when this value changes unless the active parameter is set to 0.
For the load_v_script module, this input parameter specifies the filename of a file containing valid V commands that are parsed when the update method runs. The V commands in the file are loaded into the object specified by the relative parameter. The module's update method is triggered when this value changes unless the active parameter is set to 0.
When this value changes, the V commands for this module are parsed unless the active parameter is set to 0.
This parameter is used to disable the execution of the module. One use is to allow changing the v_commands or the filename parameters without having the module execute. You can set active to 0, change the other parameters, and then set active back to 1 again.
If set to 0, this parameter prevents the V commands from being loaded when the object is instanced. You use this parameter if you want the parse_v or load_v_script modules to be only executed when a particular user interaction occurs.
This parameter is a pointer to an object that is the context in which the V commands are executed. If its value is left unset, the Applications object is used. The value of this parameter is the parent for objects created in the V statements. It also is the starting point to start searching for object names referenced by the V statements.
If this parameter is non-zero, all methods triggered by parameters modified by the V commands are run before this module completes execution.
If mode is set to 0, then the entire string in parse_v is executed within a single push-pop context, i.e.:
However, if mode is not equal to zero, then each statement is executed in it's own push-pop context. E.g. for the statement " int v=1; v=v+1; ... ":
Example
This is an example of how to use the parse_v object to attach a button to the visibility of a UIshell object. The parse_v module fires when the button is pressed. Its command string sets the visibility parameter of the UIshell to 0. Since the relative parameter is connected to the UIshell object, the V statement "visible = 0;" sets the value of the parameter UIshell.visible.
GMOD.parse_v parse_v {
v_commands = "visible = 0;";
trigger => <-.UIbutton.do;
relative => <-.UIshell;
};
UIshell UIshell;
UIbutton UIbutton {
parent => <-.UIshell;
};
![]() |
![]() |
![]() |
![]() |