### Set BONELAB_DIR environment variable via PowerShell
Source: https://github.com/yowchap/bonelib/blob/main/COMPILATION.md
Sets the BONELAB_DIR environment variable for the current user. Ensure the path matches your specific Bonelab installation directory.
```powershell
[System.Environment]::SetEnvironmentVariable('BONELAB_DIR', 'C:\Program Files (x86)\Steam\steamapps\common\BONELAB', 'User')
```
--------------------------------
### Create a Basic Page
Source: https://github.com/yowchap/bonelib/wiki/BoneMenu
Initializes a new page under the root menu.
```cs
Page myPage = Page.Root.CreatePage("My Page", Color.white);
```
--------------------------------
### Create a Dialog
Source: https://github.com/yowchap/bonelib/wiki/BoneMenu
Displays a confirmation window before executing a specific action.
```cs
private void DeleteData()
{
// ...
}
private void DeleteDataDialog()
{
Menu.DisplayDialog(
"WARNING",
"You are about to delete your data. Are you sure you want to do this?",
icon: null,
DeleteData
);
}
myPage.CreateFunction("Delete Data", Color.red, DeleteDataDialog);
```
--------------------------------
### Compile BoneLib using dotnet CLI
Source: https://github.com/yowchap/bonelib/blob/main/COMPILATION.md
Clones the repository and builds the project using the dotnet CLI. This method automatically copies compiled files to the Bonelab directory.
```bash
git clone https://github.com/yowchap/BoneLib.git
cd Bonelib/Bonelib
dotnet build
```
--------------------------------
### Create a String Element
Source: https://github.com/yowchap/bonelib/wiki/BoneMenu
Adds an input field that opens a VR keyboard for string entry.
```cs
myPage.CreateString("Name", Color.white, startValue: "Your Name Here", (value) => MyMod.Player.Name = value);
```
--------------------------------
### Load an embedded asset bundle
Source: https://github.com/yowchap/bonelib/wiki/Bundles
Use this to load binary data baked directly into your mod assembly.
```csharp
Assembly assembly = Assembly.GetExecutingAssembly();
AssetBundle bundle = BoneLib.HelperMethods.LoadEmbeddedAssetBundle(assembly, "MyMod.CustomBundle");
```
--------------------------------
### Create a Function Element
Source: https://github.com/yowchap/bonelib/wiki/BoneMenu
Adds a button that executes a callback action when pressed.
```cs
myPage.CreateFunction("My Function", Color.white, () => { Main.Logger.Log("Hello from My Function!"); });
```
--------------------------------
### Use Rich Text
Source: https://github.com/yowchap/bonelib/wiki/BoneMenu
Applies TextMeshPro rich text tags to menu labels.
```cs
// Make a page and set its rich text color to red
Page myPage = Page.Root.CreatePage("My Page", Color.white);
// Similarly, do more crazy rich text stuff
myPage.CreateFunction("Rotated text!", Color.white, null);
```
--------------------------------
### Load a persistent asset from a bundle
Source: https://github.com/yowchap/bonelib/wiki/Bundles
Use LoadPersistentAsset to prevent assets from being cleaned up when changing scenes.
```csharp
Assembly assembly = Assembly.GetExecutingAssembly();
AssetBundle bundle = BoneLib.HelperMethods.LoadEmbeddedAssetBundle(assembly, "MyMod.CustomBundle");
// Load a texture from the bundle and make it persistent
Texture2D myTexture = bundle.LoadPersistentAsset("MyTexture");
```
--------------------------------
### Create an Indexed Page
Source: https://github.com/yowchap/bonelib/wiki/BoneMenu
Defines a page with a maximum element capacity, enabling automatic pagination.
```cs
Page myPage = Page.Root.CreatePage("My Page", Color.white, maxElements: 8);
```
--------------------------------
### Create a Boolean Element
Source: https://github.com/yowchap/bonelib/wiki/BoneMenu
Adds a toggle switch for boolean settings.
```cs
myPage.CreateBool("Enabled", Color.white, startValue: false, (value) => MyMod.Settings.Enabled = value);
```
--------------------------------
### Set Page Logo
Source: https://github.com/yowchap/bonelib/wiki/BoneMenu
Assigns a custom texture from an asset bundle as the page logo.
```cs
Texture2D logo = MyMod.Assets.Logo;
Page myPage = Page.Root.CreatePage("My Page", Color.white);
myPage.Logo = logo;
```
--------------------------------
### Create Integer Elements
Source: https://github.com/yowchap/bonelib/wiki/BoneMenu
Adds sliders to control integer values within a specified range.
```cs
myPage.CreateInt("X", Color.red, startValue: 0, increment: 5, minValue: 0, maxValue: 255, (value) => { Main.Logger.Log($"X = {value}"); }
myPage.CreateInt("Y", Color.green, startValue: 0, increment: 5, minValue: 0, maxValue: 255, (value) => { Main.Logger.Log($"Y = {value}"); }
myPage.CreateInt("Z", Color.blue, startValue: 0, increment: 5, minValue: 0, maxValue: 255, (value) => { Main.Logger.Log($"Y = {value}"); }
```
--------------------------------
### Set Page Background
Source: https://github.com/yowchap/bonelib/wiki/BoneMenu
Assigns a custom texture from an asset bundle as the page background.
```cs
Texture2D background = MyMod.Assets.Background;
Page myPage = Page.Root.CreatePage("My Page", Color.white);
myPage.Background = background;
```
--------------------------------
### Create an Enum Element
Source: https://github.com/yowchap/bonelib/wiki/BoneMenu
Adds a selector to control enum-based states.
```cs
// Assume we're getting an NPC reference here
BehaviourPowerLegs npc = ...
// Control the agro state of the NPC with this element
myPage.CreateEnum("Agro State", Color.white, npc.AgroType, (value) => npc.AgroType = value);
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.