### Get Setting and Setting Value in C# Source: https://vrcosc.com/docs/v2/sdk/settings Use GetSetting to retrieve a setting object and GetSettingValue to retrieve its backing value directly. GetSettingValue is a shorthand for common use cases. ```csharp GetSetting(MyModule.CustomSetting); GetSettingValue(MyModule.ToggleSetting); ``` -------------------------------- ### Control Parameters Source: https://vrcosc.com/docs/v2/metadata These parameters can be sent and received, and are used to control runtime features. They are sent once when modules start running. ```APIDOC ## POST /websites/vrcosc/Controls/ChatBox/Enabled ### Description Enable or disable sending messages to the ChatBox at runtime. This setting defaults to true when modules start running. ### Method POST ### Endpoint /websites/vrcosc/Controls/ChatBox/Enabled ### Parameters #### Request Body - **enabled** (boolean) - Required - Set to true to enable chat box messages, false to disable. ``` ```APIDOC ## POST /websites/vrcosc/Controls/ChatBox/Layer/{layerId} ### Description Enable or disable a specific chat box layer. Replace {layerId} with the actual layer ID. ### Method POST ### Endpoint /websites/vrcosc/Controls/ChatBox/Layer/{layerId} ### Parameters #### Path Parameters - **layerId** (integer) - Required - The ID of the layer to control (0-31). #### Request Body - **enabled** (boolean) - Required - Set to true to enable the layer, false to disable. ``` -------------------------------- ### Create a Setting Group Source: https://vrcosc.com/docs/v2/sdk/settings Groups are used for visual organization of settings. ```csharp CreateGroup("My New Group", MyModule.ToggleSetting, MyModule.SliderIntSetting); ``` -------------------------------- ### Create a Toggle Setting Source: https://vrcosc.com/docs/v2/sdk/settings Toggles require a setting lookup, display title, description, and a default boolean value. ```csharp CreateToggle(MyModule.ToggleSetting, "Toggle Title", "Toggle Description", false); ``` -------------------------------- ### Configure Project csproj File Source: https://vrcosc.com/docs/v2/sdk/getting-started Defines the target framework, WPF usage, and SDK dependencies required for VRCOSC modules. Includes a post-build event to automatically deploy the assembly to the local VRCOSC packages directory. ```xml net10.0-windows10.0.26100.0 true enable 10.0.26100.1 This is a post build event that copies your module assembly to the local package directory for VRCOSC <--> ``` -------------------------------- ### Create a Slider Setting Source: https://vrcosc.com/docs/v2/sdk/settings Sliders require a setting lookup, title, description, default value, minimum, and maximum values. ```csharp CreateSlider(MyModule.SliderIntSetting, "Int Title", "Int Description", 0, 0, 10); CreateSlider(MyModule.SliderFloatSetting, "Float Title", "Float Description", 0f, 0f, 1f); ``` -------------------------------- ### Create a Custom Setting Source: https://vrcosc.com/docs/v2/sdk/settings Custom settings require a WPF UserControl and knowledge of the module structure. The UserControl must accept the Module and CustomModuleSetting in its constructor. ```csharp CreateCustom(MyModule.CustomSetting, new CustomModuleSetting("My Custom Setting", "Custom setting description", typeof(CustomModuleSettingUserControl), "Some Value")); ``` -------------------------------- ### Create a DateTime Setting Source: https://vrcosc.com/docs/v2/sdk/settings DateTime settings automatically handle timezone conversion for shared configurations. ```csharp CreateDateTime(MyModule.DateTimeSetting, "DateTime Title", "DateTime Description", DateTimeOffset.Now); ``` -------------------------------- ### Create a TextBox List Setting Source: https://vrcosc.com/docs/v2/sdk/settings TextBox Lists support collections of strings, ints, or floats. All items in the list must be of the same type. ```csharp CreateTextBoxList(MyModule.TextBoxListStringSetting, "TextBox String List Title", "TextBox String List Description", ["Some", "Default", "Values"]); CreateTextBoxList(MyModule.TextBoxListIntSetting, "TextBox Int List Title", "TextBox Int List Description", [1, 2, 3]); CreateTextBoxList(MyModule.TextBoxListFloatSetting, "TextBox Float List Title", "TextBox Float List Description", [0f, 0.5f, 1f]); ``` -------------------------------- ### Module Update Methods Source: https://vrcosc.com/docs/v2/sdk/flow Details how to implement methods that are called at regular intervals. ```APIDOC ## Module Update Methods ### Description This section explains how to define methods that are executed at regular intervals using the `[ModuleUpdate]` attribute. ### Attribute `[ModuleUpdate(ModuleUpdateMode mode, bool updateImmediately, double deltaMilliseconds)]` ### Parameters * **`mode`** (`ModuleUpdateMode`) * **Description**: Specifies how the method should update. `ChatBox` updates just before the ChatBox evaluates. `Custom` allows setting a custom interval using `deltaMilliseconds`. * **Type**: Enum (`ChatBox`, `Custom`) * **`updateImmediately`** (`bool`) * **Description**: If `true`, the method is called once immediately after `OnModuleStart`. If `false`, it waits for `deltaMilliseconds` before the first call. * **Type**: Boolean * **`deltaMilliseconds`** (`double`) * **Description**: Defines the time interval in milliseconds between calls to the update method. Only used when `mode` is `Custom` or for the initial delay. * **Type**: Double ### Recommendations * It's recommended to set variable values in an update method marked with `ChatBox` mode. ``` -------------------------------- ### vrcosc.json Configuration Template Source: https://vrcosc.com/docs/v2/sdk/getting-started Use this template to create the `vrcosc.json` file in the root of your main branch. Ensure `package_id` is unique and never changes. ```json { "package_id": "my.package.name", "display_name": "My Modules", "cover_image_url": "https://some.image/url" } ``` -------------------------------- ### Log to terminal Source: https://vrcosc.com/docs/v2/sdk/logging Use Log() to output messages to the terminal in the run screen. Avoid logging sensitive information. ```csharp Log() ``` -------------------------------- ### Registering Parameters Source: https://vrcosc.com/docs/v2/sdk/parameters Registers a parameter with a lookup key, name, mode, and metadata to allow user customization. ```APIDOC ## RegisterParameter ### Description Registers a parameter for use in a module, allowing the user to map it to an avatar parameter name. ### Parameters - **T** (type) - Required - The data type of the parameter (int, float, or bool). - **lookup** (Enum) - Required - The internal lookup key for the parameter. - **name** (string) - Required - The default name of the parameter on the avatar. - **mode** (ParameterMode) - Required - The access mode (Read, Write, or ReadWrite). - **displayName** (string) - Required - The UI display name. - **description** (string) - Required - The UI description. - **isLegacy** (bool) - Optional - Marks the parameter as legacy. ``` -------------------------------- ### Create a Dropdown Setting Source: https://vrcosc.com/docs/v2/sdk/settings Dropdowns accept enums or lists of items. The default value determines the enum type or initial selection. ```csharp CreateDropdown(MyModule.DropdownSetting, "Dropdown Title", "Dropdown Description", SomeEnum.SomeValue) CreateDropdown(MyModule.DropdownSetting, "Dropdown Title", "Dropdown Description", items, items[0], nameof(Item.Title), nameof(Item.Id)) ``` -------------------------------- ### Create a TextBox Setting Source: https://vrcosc.com/docs/v2/sdk/settings TextBoxes support string, int, and float types with automatic validation. ```csharp CreateTextBox(MyModule.TextBoxStringSetting, "String Title", "String Description", string.Empty); CreateTextBox(MyModule.TextBoxIntSetting, "Int Title", "Int Description", 0); CreateTextBox(MyModule.TextBoxFloatSetting, "Float Title", "Float Description", 0f); ``` -------------------------------- ### Gesture Definitions Source: https://vrcosc.com/docs/v2/modules/gesture-extensions This section details the mapping between OSC values, gesture names, and the required finger states for each gesture. ```APIDOC ## Gesture Definitions ### Description This table outlines the currently available gestures, their corresponding OSC values, and the required finger states (Index, Middle, Ring, Pinky, Thumb) for each gesture. ### Parameters #### Gesture Table | OSC Value | Gesture Name | Index | Middle | Ring | Pinky | Thumb | |---|---|---|---|---|---|---| | 0 | None | Any | Any | Any | Any | Any | | 1 | Double Gun | Up | Up | Down | Down | Any | | 2 | Middle Finger | Down | Up | Down | Down | Any | | 3 | Pinky Finger | Down | Down | Down | Up | Any | ### Notes - 'Up' indicates the finger is extended. - 'Down' indicates the finger is curled. - 'Any' indicates the state of the finger does not matter for this gesture. ``` -------------------------------- ### Define ChatBox Variables Source: https://vrcosc.com/docs/v2/sdk/chatbox Create variables to be used by states and events, ensuring they are defined before states and events. ```csharp CreateVariable(Enum lookup, string displayName); CreateVariable(string lookup, string displayName); CreateVariable(Enum lookup, string displayName, Type clipVariableType); CreateVariable(string lookup, string displayName, Type clipVariableType); ``` -------------------------------- ### Module Lifecycle Methods Source: https://vrcosc.com/docs/v2/sdk/flow Describes the core methods that govern the lifecycle of an VRC OSC module. ```APIDOC ## Module Lifecycle Methods ### Description This section details the essential methods for defining module settings, parameters, and handling runtime events. ### Methods #### `OnPreLoad()` * **Description**: Called before the module loads user data from disk. Ideal for defining static settings, registering parameters, and setting up unchanging states. * **Purpose**: Initialize static configurations and module structure. #### `OnPostLoad()` * **Description**: Called after the module has loaded user data. Used for setting up dynamic elements that depend on settings, such as events and variables for the ChatBox. * **Purpose**: Initialize dynamic configurations and ChatBox-specific elements. #### `OnModuleStart()` * **Description**: Called when a user starts the module, including automatic starts. Suitable for initial dynamic runtime setup. Returns a `Task` where `false` indicates startup failure. * **Purpose**: Perform one-time dynamic initialization upon module activation. #### `OnModuleStop()` * **Description**: Called when modules are stopped (VRChat closing or manual stop). Used for clearing OSC parameters and resetting local settings. Returns a `Task` to allow asynchronous stopping. * **Purpose**: Clean up resources and reset states upon module deactivation. #### `OnAvatarChange()` * **Description**: Called whenever the user changes their avatar. Useful for re-sending module parameters to ensure the new avatar has correct values. * **Purpose**: Synchronize module parameters with avatar changes. #### `OnPlayerUpdate()` * **Description**: Called when a built-in VRChat parameter changes (e.g., AFK status). * **Purpose**: Respond to changes in VRChat's built-in parameters. ``` -------------------------------- ### Define ChatBox States Source: https://vrcosc.com/docs/v2/sdk/chatbox Use these methods to register states within the OnPostLoad lifecycle method. ```csharp CreateState(Enum lookup, string displayName, string defaultFormat = "", IEnumerable? defaultVariables = null, bool defaultShowTyping = false); CreateState(string lookup, string displayName, string defaultFormat = "", IEnumerable? defaultVariables = null, bool defaultShowTyping = false); ``` -------------------------------- ### Receiving Parameters Source: https://vrcosc.com/docs/v2/sdk/parameters Methods to override for handling incoming parameter updates from VRChat. ```APIDOC ## OnRegisteredParameterReceived ### Description Triggered when a registered parameter is received. ### Parameters - **parameter** (RegisteredParameter) - Required - The parameter object containing the lookup and value. ## OnAnyParameterReceived ### Description Triggered for every parameter received, regardless of registration status. ### Parameters - **parameter** (ReceivedParameter) - Required - The parameter object containing the name and value. ``` -------------------------------- ### Metadata Parameters Source: https://vrcosc.com/docs/v2/metadata These parameters are send-only and are used to query the status of modules. ```APIDOC ## GET /websites/vrcosc/Metadata/Modules/{moduleid} ### Description Checks if a specific module is currently running. ### Method GET ### Endpoint /websites/vrcosc/Metadata/Modules/{moduleid} ### Parameters #### Path Parameters - **moduleid** (string) - Required - The ID of the module to check. ### Response #### Success Response (200) - **status** (boolean) - Indicates whether the module is running. ``` -------------------------------- ### Define a Basic Module Class Source: https://vrcosc.com/docs/v2/sdk/getting-started Implements the minimum required attributes and class inheritance for a functional VRCOSC module. The class name should remain stable to ensure settings are correctly persisted. ```csharp [ModuleTitle("My Test Module")] [ModuleDescription("This is my test module")] [ModuleType(ModuleType.Generic)] public class TestModule : Module { } ``` -------------------------------- ### Define ChatBox Events Source: https://vrcosc.com/docs/v2/sdk/chatbox Register events in OnPostLoad, specifying behavior and duration for how they interact with the ChatBox. ```csharp CreateEvent(Enum lookup, string displayName, string defaultFormat = "", IEnumerable? defaultVariables = null, bool defaultShowTyping = false, float defaultLength = 5, ClipEventBehaviour defaultBehaviour = ClipEventBehaviour.Override); CreateEvent(string lookup, string displayName, string defaultFormat = "", IEnumerable? defaultVariables = null, bool defaultShowTyping = false, float defaultLength = 5, ClipEventBehaviour defaultBehaviour = ClipEventBehaviour.Override); ``` -------------------------------- ### IVRCClientEventHandler Interface Source: https://vrcosc.com/docs/v2/sdk/handlers Interface for reacting to VRChat client log events such as instance changes and user presence updates. ```APIDOC ## IVRCClientEventHandler ### Description Implement this interface to monitor VRChat log events. The system scans logs on startup, allowing for data backfilling. ### Methods - **OnInstanceLeft()**: Triggered when the user leaves an instance. - **OnInstanceJoin()**: Triggered when the user successfully joins an instance. - **OnUserLeft(data)**: Triggered when a remote user leaves the current instance. - **OnUserJoined(data)**: Triggered when a remote user joins the current instance. ### Notes All events include relevant data and the timestamp of the log entry. Developers should filter out historical logs if only real-time data is required. ``` -------------------------------- ### Sending Parameters Source: https://vrcosc.com/docs/v2/sdk/parameters Methods to send data to registered parameters or directly to specific parameter names. ```APIDOC ## SendParameter ### Description Sends a value to a parameter. Can be used via a registered lookup or by direct name. ### Parameters - **lookup/name** (Enum/string) - Required - The registered lookup or the literal parameter name. - **value** (T) - Required - The value to send (int, float, or bool). ``` -------------------------------- ### Retrieve Parameter Information Source: https://vrcosc.com/docs/v2/sdk/parameters Queries the current state and type of a parameter by name or enum. Returns null if the parameter is missing or OSCQuery is unavailable. ```csharp FindParameter(MyParameters.SomeParameter); FindParameter("SomeParameterName"); ``` -------------------------------- ### Add Bool Parameter Source Node Source: https://vrcosc.com/docs/v2/pulse/getting-started Use this to add a node that outputs the value of a boolean parameter from your avatar. ```VRChat OSC Create Node -> Parameters -> Receive -> Parameter Source -> Parameter Source (Bool) ``` -------------------------------- ### Weather Codes Source: https://vrcosc.com/docs/v2/modules/weather This section lists the available weather codes that can be used with the weather module. These codes correspond to different weather conditions and can be used to set a parameter for avatar customization. ```APIDOC ## Weather Codes This module provides a list of weather codes that can be used to change your avatar based on your local weather conditions. The weather module uses a parameter that will be set to one of the following code values. ### Codes * **0**: Unknown * **1**: Sunny/Clear * **2**: Partly Cloudy * **3**: Cloudy * **4**: Overcast * **5**: Mist * **6**: Patchy rain possible * **7**: Patchy snow possible * **8**: Patchy sleet possible * **9**: Patchy freezing drizzle possible * **10**: Thundery outbreaks possible * **11**: Blowing snow * **12**: Blizzard * **13**: Fog * **14**: Freezing fog * **15**: Patchy light drizzle * **16**: Light drizzle * **17**: Freezing drizzle * **18**: Heavy freezing drizzle * **19**: Patchy light rain * **20**: Light rain * **21**: Moderate rain at times * **22**: Moderate rain * **23**: Heavy rain at times * **24**: Heavy rain * **25**: Light freezing rain * **26**: Moderate or heavy freezing rain * **27**: Light sleet * **28**: Moderate or heavy sleet * **29**: Patchy light snow * **30**: Light snow * **31**: Patchy moderate snow * **32**: Moderate snow * **33**: Patchy heavy snow * **34**: Heavy snow * **35**: Ice pellets * **36**: Light rain shower * **37**: Moderate or heavy rain shower * **38**: Torrential rain shower * **39**: Light sleet showers * **40**: Moderate or heavy sleet showers * **41**: Light snow showers * **42**: Moderate or heavy snow showers * **43**: Light showers of ice pellets * **44**: Moderate or heavy showers of ice pellets * **45**: Patching light rain with thunder * **46**: Moderate or heavy rain with thunder * **47**: Patchy light snow with thunder * **48**: Moderate or heavy snow with thunder ``` -------------------------------- ### Add Runtime View with UserControl Source: https://vrcosc.com/docs/v2/sdk/runtime Call SetRuntimeView() inside OnPreLoad to add a WPF UserControl to the Runtime tab. The UserControl must have a constructor that accepts your Module as the sole argument. ```csharp public override void OnPreLoad() { SetRuntimeView(new MyUserControl(this)); } ``` -------------------------------- ### Receive Registered Parameters in VRCOSC Source: https://vrcosc.com/docs/v2/sdk/parameters Override OnRegisteredParameterReceived to listen for specific registered parameters. Use parameter.Lookup to identify the parameter and GetValue() to retrieve its value. Ensure T matches the parameter's type. ```csharp protected override void OnRegisteredParameterReceived(RegisteredParameter parameter) { switch (parameter.Lookup) { case MediaParameter.Volume: MediaProvider.TryChangeVolume(parameter.GetValue()); break; } } ``` -------------------------------- ### Wait for Parameter Response Source: https://vrcosc.com/docs/v2/sdk/parameters Sends an OSC parameter and waits for a response from the avatar. Setting the block events field to true prevents loopbacks in parameter updates. ```csharp SendParameterAndWait(MyParameters.SomeParameter, true, true) SendParameterAndWait("SomeParameterName", true, true) ``` -------------------------------- ### Register Parameters in VRCOSC Source: https://vrcosc.com/docs/v2/sdk/parameters Use RegisterParameter to define parameters with custom lookups, display names, and descriptions. T can be bool, float, or int. The parameter mode can be ReadWrite. Optional legacy flag can be set. ```csharp RegisterParameter(MediaParameter.Play, "VRCOSC/Media/Play", ParameterMode.ReadWrite, "Play/Pause", "True for playing. False for paused"); RegisterParameter(MediaParameter.Volume, "VRCOSC/Media/Volume", ParameterMode.ReadWrite, "Volume", "The volume of the process that is controlling the media"); RegisterParameter(MediaParameter.Repeat, "VRCOSC/Media/Repeat", ParameterMode.ReadWrite, "Repeat", "0 - Disabled\n1 - Single\n2 - List"); ``` -------------------------------- ### Receive Any Parameter in VRCOSC Source: https://vrcosc.com/docs/v2/sdk/parameters Override OnAnyParameterReceived to listen for all incoming parameters, both registered and unregistered. Registered parameters will trigger this method before OnRegisteredParameterReceived. Useful for dynamic parameter handling. ```csharp protected override void OnAnyParameterReceived(ReceivedParameter parameter) { switch (parameter.Name) { case "MyNormalParameter": Log($"MyNormalParameter's value is {parameter.GetValue()}") break; } } ``` -------------------------------- ### ISpeechHandler Interface Source: https://vrcosc.com/docs/v2/sdk/handlers Interface for handling speech recognition results from the global VRCOSC speech engine. ```APIDOC ## ISpeechHandler ### Description Implement this interface to receive speech recognition updates. The engine is global and handles all recognition logic. ### Methods - **OnPartialSpeechResult(string text)**: Triggered every 1.5 seconds while the user is actively speaking. - **OnFinalSpeechResult(string text)**: Triggered once the user stops speaking and a final, accurate recognition is processed. ``` -------------------------------- ### Add Fire On True Node Source: https://vrcosc.com/docs/v2/pulse/getting-started This node triggers a flow when its condition input becomes true. Connect a boolean value to its condition. ```VRChat OSC Create Node -> Flow -> Fire On True ``` -------------------------------- ### Create String Constant for Avatar ID Source: https://vrcosc.com/docs/v2/pulse/getting-started This method creates a constant string value input for the Change Avatar node, allowing you to specify a particular avatar ID. ```VRChat OSC Left click drag from the value input of the Change Avatar node, and while still holding left click, right click. ``` -------------------------------- ### Log debug information Source: https://vrcosc.com/docs/v2/sdk/logging Use LogDebug() to output messages that only appear when debugging is enabled in app settings. ```csharp LogDebug() ``` -------------------------------- ### Send Registered Parameters in VRCOSC Source: https://vrcosc.com/docs/v2/sdk/parameters Send data to registered parameters using their Enum lookup. VRCOSC handles the mapping to the actual parameter name set by the user. ```csharp SendParameter(MediaParameter.Play, true); SendParameter(MediaParameter.Shuffle, false); SendParameter(MediaParameter.Repeat, 0); ``` -------------------------------- ### Send Direct Parameters in VRCOSC Source: https://vrcosc.com/docs/v2/sdk/parameters Send data directly to a parameter using its exact name. This method is not customizable by the user and should be used for parameters that are known to never change their name. ```csharp SendParameter("MyNormalParameter", false); ``` -------------------------------- ### Set Setting Value in C# Source: https://vrcosc.com/docs/v2/sdk/settings Call SetSettingValue to manually update a setting's value. This method is suitable for settings with a single value. For list settings, retrieve the setting first using GetSetting. ```csharp SetSettingValue(lookup, value); ``` -------------------------------- ### Add Change Avatar Node Source: https://vrcosc.com/docs/v2/pulse/getting-started This node allows you to change the avatar. It requires an avatar ID and a flow input to trigger the change. ```VRChat OSC Create Node -> VRChat -> Player -> Actions -> Change Avatar ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.