Skip to main content

The "vngen_event" Function

Syntax#

vngen_event([pause], [noskip], [label]);
ArgumentTypeDescription
[pause]realOptional: Sets a delay in seconds before the event is executed
[noskip]booleanOptional: Enables or disables responding to user input for the duration of the event
[label]stringOptional: Sets a string label for the event which can be used in place of a numeric ID

Description#

Initializes a segment of code containing Quantum actions. Once this script has been run, as many actions as desired can be executed inside it, provided no two actions of the same type are applied to the same entity. By default, all actions contained in the event will be executed simultaneously. Once all actions are complete, the event will deactivate and the following event (if any) will be activated in its place.

For the sake of performance, vngen_event is intended to be used within an 'if' statement. This guarantees that actions within an event will only be executed while the event is active.

While no arguments are required to create an event, there are three optional parameters which can be used to customize the event's behavior. Unlike other functions, these parameters can be input in any order, however be aware that numeric values will always be interpreted as 'pause' first, then 'noskip'.

tip

Although noskip may be a boolean value, because true and false can be interpreted as 1 and 0, respectively, there is no other way to differentiate between pause and noskip than their input order.

If no pause value is supplied, the event will begin execution immediately upon activation. Otherwise, execution will be delayed by the given number of seconds unless skipped by running vngen_continue. It is also possible to set the event pause to -1, delaying the event indefinitely until vngen_continue is run. In either case, only the event pause will be skipped and not the event itself.

important

If auto mode is enabled, negative pause values will be interpreted literally, not indefinitely. This allows crafting a fully automated experience that retains temporary pauses where appropriate. To change this behavior, see vngen_set_auto_type.

Both event pauses and event actions can be prevented from being skipped by setting the 'noskip' value to 'true'. If 'noskip' mode is enabled, vngen_continue will be ignored for the duration of the current event. Naturally, this poses a problem for features like indefinite pauses and text actions which require user input to continue, so in these instances the event will automatically progress on its own.

The third and final optional argument is the event label. Every event is automatically assigned a numeric ID which is used to determine execution order and to manage unique behaviors. However, determining a specific event's ID can be cumbersome. Typically this isn't a problem, as VNgen handles event IDs for you, but in some cases you may wish to have a more memorable way to identify particular events than by their numeric IDs. Labels act as string identifiers to complement internal numeric IDs, so that when you refer to an event by its label, the corresponding numeric ID is chosen instead. Most events will not require labels at all, but for those that do, labels are a very powerful feature.

Note that it is required to run the vngen_event_set_target script before the first event and vngen_event_reset_target script after the last event in the sequence.

Example#

vngen_event_set_target();
if vngen_event() {
//Actions
}
if vngen_event(1, true, "my_event") {
//Actions
}
vngen_event_reset_target();