Parameters - Suvidriel/VNyanDoc GitHub Wiki
Parameters in VNyan are named variables to which values can be assigned. VNyan supports both numeric and text parameters. Once a parameter has been set, their values can be accessed through the parameter names by using specific nodes in the Node Graph system or by wrapping the parameter name in certain brackets in node input fields. This way, node graphs can be created that respond to changes of a given parameter's value.
When working with nodes that specifically perform actions on parameters, it is important to be aware that these nodes typically only work with one type of parameter. If any node graphs that include any parameter actions are not behaving as intended, make sure you are using the right nodes for the type of parameter you are working with.
Besides using nodes that specifically work with parameters, it is also possible to enter a parameter's value directly into most input fields on nodes by entering the parameter name between specific brackets. The kind of brackets used depends on the type of the parameter. Text parameters are entered into input fields with angle brackets (<>
, for example <TextParameterName>
). Numerical parameters are entered into input fields with square brackets ([]
, for example [NumberParameterName]
). When parameter values are used like this, they are interpreted as if the user typed them into the input field. This means that it is possible to directly fill numerical parameters into Text-only fields, and vice versa if the text parameter contains a number. Number parameters that contain decimal values are also automatically converted to whole numbers when required.
Content:
VNyan offer an intuitive and accessible monitor for values defined within it. To access the monitor, simply click the Monitor button in the side-menu on the right of the screen.
The monitor provides an overview of currently defined blendshape values, numerical and text parameters, and any connected VMC trackers. The monitor also provides performance statistics that may provide useful information when troubleshooting poor performance when using VNyan. Specifically, it lists Draw Calls, Frame Time, and RAM and VRAM use. For reference, Draw Calls should typically be under 150 when no world is loaded.
Known bugs:
- The monitor does not always report Blendshape values accurately, and may sometimes appear off by 1. This is purely an issue with how values are displayed, and does not reflect the underlying values or how these values are otherwise used (e.g. the filter blendshape node will in these cases filter according to the underlying value, not the value that is displayed in the monitor).
As outlined above, there are two main types of parameters in VNyan: Text Parameters and Numeric Parameters. VNyan also has two special kinds of parameters: Timer Parameters and Built-in Parameters. Detailed explanations are provided below.
Text parameters, also called string parameters, are the most flexible parameter type in VNyan in terms of their values. Their value can be set to virtually anything, and will be represented as text. This also means that numerical values are stored exactly. Nodes that act on Text Parameters have names that contain "Text Param(eter)", and ask for Parameter names as input, rather than specific values. Any other nodes will not operate on text parameters directly. For other nodes, text parameters can be entered into input fields with angle brackets (<>
, for example <TextParameterName>
). This will interpret the parameter value as though it was typed in. This can be used to enter text parameter values for numerical input, however text parameter values must be a number in that case.
Numeric parameters are parameters that contain a decimal number value, also called floating point numbers, or floats for short. When a whole number is stored in a number parameter, it will be converted to a decimal value (e.g. 4 becomes 4.00000). Unlike for text parameters, nodes that act on Numeric Parameters have names that only contain "Param(eter)". Like text parameter nodes, these nodes ask for Parameter names as input, rather than specific values. Any other nodes will not operate on numeric parameters directly. For other nodes, numeric parameters can be entered into input fields with square brackets ([]
, for example [NumericParameterName]
). This will interpret the parameter value as though it was typed in, and can be used without restriction to enter numerical parameter values into text input fields. If the input field is for number values (integers) rather than decimal values (floats), typically the parameter value will be rounded down to the nearest whole number. Hexadecimal values are not supported as numeric parameters.
Timer parameters are another kind of parameter in VNyan that represents the remaining time of an active timer started with the Start Timer node. The remaining time of a timer can be used as node input by filling in the name of the timer as specified in the Start Timer node between curly brackets ({}
, for example {TimerName}
). This will enter the remaining time on the timer into the node input whenever the node is activated, in milliseconds. If the timer does not exist or has finished, the parameter will return a value of 0. Note: timers are not listed in the monitor.
VNyan uses various builtin parameters to handle specific data. These parameters carry data that are not set by the user, but the user may want to access for various node graphs. Most notably, these parameters are linked to callback nodes relating to service integration. They are used to carry data from these services into VNyan. The help-file and wiki entry of each callback node contains information on which builtin parameters are supported. It is not recommended to manually set values to these names, as trying to retrieve values from these names will always refer to the builtin parameters over user-set parameters, and so may lead to unintended behavior. Below is an overview of the names reserved for these builtin parameters:
- [message] often contains numerical data related to the signalling callback node
- [message2] may contain additional numerical data related to callback node
- [message3] may contain additional numerical data related to callback node
- [heartrate] contains the current heart rate
- [heartpercent] percentage (0.0-1.0) of heart rate between 30-300
- <username> contains user's name when signalled by twitch callback nodes
- <message> contains text related to callback node. With Twitch nodes this is often the chat message
- _gamepadrightx, _gamepadrighty contains x and y rotation of the Right Joystick
- _gamepadleftx, _gamepadlefty contains x and y rotation of the Left Joystick
- _righthandgesture, _lefthandgesture respond to different hand gestures (open hand, fist, thumbs up, pointy finger, gun, and rock-n-roll)
VNyan has hand gesture support that responds to your model's hands. It reads the local rotations of your left and right hands after tracking is applied, so it should be compatible across different types VR trackers. The detected gestures are stored in the builtin parameters _righthandgesture and _lefthandgesture. Note that these values are not related to the gesture system that was introduced in VNyan's 1.4.4 update.
- Open hand = 0
- Fist = 1
- Thumbs Up = 2
- Finger Gun = 3
- Pointy finger = 4
- Rock-n-Roll/Devil horns = 5
VNyan supports receiving parameters via OSC signals. You can send float (decimal) and string (text) parameters directly to VNyan from third party applications. The OSC receiver port can be configured in Settings > Misc.
VNyan listens to either of these specific OSC-addresses:
/VNyan/Param/Float (name) (float value)
/VNyan/Param/String (name) (string value)
The first argument (name) will be the Parameter name that VNyan will store the value into. The second argument (value) will be the actual value stored in the parameter. The OSC-messages can also be bundled instead of being sent as individual messages. Note that the parameter name and value shouldn't be sent as part of the OSC-address, but as arguments.
VNyan will listen for incoming VRChat avater parameter through the OSC receiver, meaning many VRChat applications could be adapted to work with VNyan. This will occur automatically, and when working you should see these parameters show up in the monitor. This also will include sub-address hierarchies in the parameter name.
These OSC parameters would typically follow the following address formats:
/avatar/parameters/ParameterName (float value)
/avatar/parameters/sub-address/ParameterName (float value)
There is additional functionality to the parameter syntax described above that users may want to be aware of. This behavior is outlined below.
If a parameter is not set, then using the bracket syntax described above as node input will set the input value to what is written in the input field verbatim. In other words, if a Compare Text node's value input is set to <text1>, but there is no parameter by the name text1, then the text that will be compared is "<text1>", including brackets. If any node graphs use parameter values with the bracket syntax, it may be worth adding functions that check these parameters are defined, as to avoid unintended behavior. Doubling the specific brackets for the parameter type of a specified parameter also prevents the parameter from being interpreted (e.g. <<text1>> will always return the value "<<text1>>", even if text1 exists).
The exception to this are the curly brackets ({}
) for timer nodes, and the builtin parameters. If no timer with the specified name exists, the value provided by using curly brackets is always 0. Adding a space somewhere within the curly brackets prevents this from happening. This may be relevant when trying to use data in JSON format or packed dictionaries. Using the bracket syntax on builtin parameter names will always return that parameter's value, even if it is empty. Similarly, it will always return the builtin parameter value, even if a user-specified value is set to that name.
Concatenating (i.e. adding after one another) input values can be done very easily with the bracket syntax. Adding different parameters in brackets in an input field will set that input value to one long, combined input value. For example, specifying the Text Value input of a Set Text Parameter node as "<text1>[num1]" will create one big input that is the value of text1, followed by the value of num1. It is also possible to concatenate parameter values with constant values. For example "Avatar<text1>" will create one long input that is "Avatar" followed by the value of text1
VNyan supports more complex data containers in addition to the ones describes above. These containers contain a collection of values that are accessed via an index or a key. These will not appear in the Monitor.
Numeric arrays are lists or arrays containing exclusively numeric values. These arrays are indexed, meaning their entries can be accessed via their position in the array. Numeric arrays are zero-indexed, which means that the index of the first value is 0.
Arrays can be created or modified via the Array nodes. Arrays are created automatically when a value is added to a non-existent array. Numeric arrays cannot be accessed or modified by the TArray nodes.
Text arrays are lists or arrays containing text values. Numeric values inside a text array will be represented as text, rather than as their value. Text arrays are indexed, meaning their entries can be accessed via their position in the array. Text arrays are zero-indexed, which means that the index of the first value is 0.
Text arrays can be created or modified via the TArray nodes. Text arrays are created automatically when a value is added to a non-existent array. Text arrays cannot be accessed or modified by the Array nodes.
Dictionaries are like text arrays in that they store a collection of text values. However, dictionaries are unordered, and so entries cannot be accessed via their indices. Instead, each value inside a dictionary has an associated key used to access it. In other words, each entry is a key/value pair.
An example use case for a dictionary is to keep track of how often a chatter has used a command. The keys would consist of usernames, and the value for each key would be the number of times the command was used. Note that only one instance of a given key can exists within a dictionary at a time. Providing a different value for an existing key will overwrite the previous value.