Skip to content

OSC Script Editor & Syntax Guide

Raphii edited this page Sep 24, 2022 · 1 revision

For some automations, Oyasumi allows you to send OSC commands to VRChat. This can be configured in the form of OSC scripts, which are sequences of OSC commands that execute in order. This page will explain how this works.

This guide assumes you are familiar with OSC and how it relates to VRChat. If you are not, please refer to the relevant parts of the VRChat documentation: VRChat OSC Overview

Simple Editor

The first and recommended method, is by using the simple editor. This is found under the "Simple" tab of the popup you get for editing OSC scripts.

See the following for the types of actions you can add here.

OSC Command

This is the action that will send an OSC command to VRChat. While there are many uses, a common one is to set avatar parameters.

Example: You want to set your avatar's VRCEmote menu parameter to a specific value, you would send a value to the OSC address /avatar/parameters/VRCemote.

There are three properties you have to set for your OSC command:

  1. The value type

    The type of value that you want to send. You have three options here:

    • Integer (A value ranging from 0 to 255, without any decimals)
    • Float (A value ranging from -1.0 to 1.0)
    • Boolean (Either true or false)
  2. The value

    This is the value you want to send.

  3. The address

    The OSC address you want to send the value to. Addresses always start with a / symbol, and can only contain ASCII characters. If you are setting a menu parameter, the address should look like /avatar/parameters/{ParameterName}.

Sleep

This action allows you to wait for a certain amount of time. This can be useful when you have to time your OSC commands, e.g. if you are emulating inputs, or have to do things slower so that an animator controller can keep up.

The sleep duration has a minimum of 1 millisecond, and a maximum of 5000 milliseconds per command. The total sleep duration of all sleep actions in a script combined is not allowed to exceed 10 seconds.

Script Editor

The second method, is to use the script editor. This is for more advanced users who prefer writing the script by hand. This advanced editor in future versions might have experimental actions enabled that are not yet accessible through the simple editor. This is found under the "Script" tab of the popup you get for editing OSC scripts.

Syntax for available actions is as follows:

OSC Command

Syntax: <type> <value> <address>

Example: i 2 /avatar/parameters/VRCEmote

For the type parameter, there are three options, which are case insensitive:

  • f for a float
  • i for an int
  • b for a boolean

For the value, the same restrictions apply as for the simple editor:

  • Float values range from -1.0 to 1.0
  • Int values range from 0 to 255
  • Boolean values are: (All case insensitive)
    • True: true, 1 or yes
    • False: false, 0, or no

The address parameter has to start with a / symbol and can only contain ASCII characters. It is case sensitive.

Sleep

Syntax: sleep <duration>[s|ms]

Examples:

  • Sleep 5 milliseconds: sleep 5
  • Sleep 5 seconds: sleep 5000, sleep 5s, or sleep 5000ms
  • Sleep 2.5 seconds: sleep 2.5, sleep 2500, sleep 2.5s or sleep 2500ms

The duration can either be a positive integer or float, and the is either ms or s, which is optional.

When a duration is specified without a unit, it is determined as follows:

  1. ms if the duration is an integer
  2. s if the duration is a float

If specifying ms as the unit, the duration has to be an integer.