CasualOS Documentation

website·Indexed 31 days ago

https://docs.casualos.com/

Technical documentation for the CasualOS platform, covering scripting, AUX code, and system APIs. Includes detailed type definitions for OS services (camera, geolocation, clipboard, media), record management (databases, files, events), AI capabilities (chat, image generation), and bot behavior via listen tags.

Tokens
143.5K
Snippets
1K
Records
1.4K
Agent score
52%

What's inside CasualOS

  1. Overview of CasualOS

    CasualOS is a free, open-source platform maintained by the non-profit Casual Simulation. It is designed to simplify the authoring and sharing of AUXes. In the CasualOS ecosystem, the computers running the software are referred to as 'servers', which are used to host 'instances'.
  2. Overview of CasualOS

    CasualOS is a free, open-source platform designed to facilitate the authoring and sharing of AUXes. It is maintained by the non-profit organization Casual Simulation. The software is distributed under the MIT License, allowing it to be copied and reused freely.
  3. Overview of Vector2 in CasualOS

    The Vector2 class represents 2D positions and directions in CasualOS. It is used to handle X and Y coordinates and perform common mathematical operations. When saved to tags, these are stored as vector tags.
  4. Overview of CasualOS

    CasualOS is a tool designed for problem-solving and testing solutions through the use of automation. It provides a framework for creating experiences that leverage automated processes, supported by a conceptual learning series called "The Pillars of Casual Simulation" which introduces core computing and automation concepts used within the platform.
  5. Use the RoomTrackOptions interface for audio/video track properties

    The RoomTrackOptions interface defines the properties of an audio or video track in a room. It includes metadata about the track's source, its remote status, and video-specific attributes like aspect ratio and dimensions.
    interface RoomTrackOptions {
      aspectRatio?: number; // The aspect ratio of the video (if applicable)
      dimensions?: object;   // The dimensions of the video (if applicable)
      isRemote: boolean;     // True if the track is sourced from a remote user
      kind: TrackKind;       // The type of the track
      muted: boolean;        // Whether the track is muted locally
      remoteId: string;      // The ID of the remote user publishing this track
      source: TrackSource;  // The source of the track
      videoQuality?: TrackVideoQuality; // The video quality (if applicable)
    }
  6. Use the Quaternion class for 3D transformations

    The Quaternion class represents 3D rotations and transformations using the formula q = w + xi + yj + zk. In this representation, x, y, and z define the rotation axis vector, and w defines the rotation angle. Quaternions are preferred over Euler angles to avoid gimbal lock.

    Note that quaternions can also represent scale and reflection based on how they are applied to a point:

    • Rotation and Scale: quaternion * point * inverse(quaternion). The point is rotated around the axis and scaled by the quaternion's length.
    • Reflection and Scale: quaternion * point * quaternion. The point is reflected across the axis and scaled by the quaternion's length.

    To represent only rotation without scaling, the quaternion must be normalized (length = 1).

  7. Understand and use Tags in CasualOS

    Tags in CasualOS are name-value pairs associated with a bot, representing specific attributes. They serve two primary purposes: storing data and triggering automations that respond to user actions.

    CasualOS includes 'built-in tags' which provide predefined automations to control bot behavior or appearance. For example:

    • #color: Changes the display color of a bot.
    • #label: Displays a text label on a bot.
  8. Listen for debugger pauses using onPause

    The onPause method registers a handler function that is triggered whenever the debugger is paused by a pause trigger. The handler receives a DebuggerPause object containing details about the pause.
    const debug = await os.createDebugger({
        pausable: true
    });
    debug.onPause(pause => {
        console.log('pause happened!', pause);
    });
  9. Monitor remote user status with RoomRemoteOptions

    The RoomRemoteOptions interface provides information about a remote user's streaming status and connection quality.
    interface RoomRemoteOptions {
      audio: boolean;
      audioLevel: number; // Range 0 to 1
      connectionQuality: "unknown" | "excellent" | "good" | "poor" | "lost";
      screen: boolean;
      video: boolean;
    }
  10. Use the sheetPortal to manage bots in a dimension

    The sheetPortal is a portal interface that allows developers to view and edit bots located within a specific dimension. It organizes bots in a spreadsheet-like layout where each bot is represented as a column and each tag is represented as a row.