Jump to content

Vertex/VSig

From Vellocet Developer Community

VSig connects events to actions in a map. Use it for triggers, doors, timers, and reusable map logic. The game SDK supplies the available entity classes and game events.

Open the map script

Save a map with a game connection. Vertex creates and associates a companion <map_name>.vsig when no entry script is selected. Choose Code → Map script to open it. Use Map → Choose map script… to select an existing entry file.

Keep shared .vsiglib files under the same source folder. More → New source… in Code creates another file there; creating it does not make it the map's entry script.

The Code workspace checks syntax and bindings using the current map and SDK. A successful build performs the final validation and embeds the compiled program. Save scripts regularly: map recovery does not recover unsaved script edits.

Events and actions

A handler starts with on source.event:. Indented lines beneath it run when that event occurs. A ref binds a short alias to an authored entity by class and hierarchy path.

The game's entity reference defines valid inputs and outputs. For a complete trigger-to-door example, see Grimwar/VSig. A different game's SDK may use different class and signal names.

Inputs are actions a script calls. Outputs are events it listens to. Properties read a running entity's state. A ref can match several objects for broadcast actions, but a property read needs one unambiguous object.

Values and reusable logic

Use const for a fixed value, var for map state, and state inside a reusable module. Primitive types are bool, int, float, and string. Quote strings and indent blocks consistently.

VSig includes twelve standard logic modules: counter, accumulator, relay, timer, selector, random_selector, sequence, latch, toggle, state_machine, debounce, and cooldown. Use them directly; no library file or import is needed. These modules also work in existing Unity-authored maps that were made without Vertex.

This complete script creates a counter instance and increments it once when the map is ready:

scene "Counter example"

use counter as visits(max_value = 100)

once on map.ready:
    visits.add

Each instance has its own state. Give every instance a unique alias. See the standard module reference for parameters, inputs, and outputs.

For custom behavior, declare a module or import one from a companion .vsiglib file:

module visit_tracker(start: int = 0):
    state value: int = start
    output changed(value: int)

    input add(amount: int = 1):
        value = value + amount
        emit changed(value)

use visit_tracker as visits

Move that module declaration into Counters.vsiglib to share it, then import and instantiate it with:

from "Counters.vsiglib" use visit_tracker
use visit_tracker as visits(start = 2)

Explicitly declared or imported modules take precedence over built-in modules with the same name. Existing imports of Logic.vsiglib, including the old SDK and Vertex package paths, remain supported. Custom library imports still resolve within the captured source files. A game may also supply a library through an SDK asset or prefab; its documentation explains how to bind that library.

Timing and authority

wait 250ms pauses the current execution chain. A named schedule runs delayed or repeating work and can be cancelled. Reusing a schedule name replaces the existing work. Cancel round-specific timers when the round ends.

Handlers use server authority by default. Prefix a handler with client for a presentation action whose entity contract allows client access. A client handler cannot grant itself server access.

map.ready is the standard startup event. Other events, allowed commands, multiplayer rules, and entity behavior belong to the game SDK. They are not available just because a script uses their names.