Skip to main content
Version: Current

System Actions

  • configBot: Bot

    Gets the config bot (formerly known as the player bot). This is the bot that represents the player's browser tab.

    It is tempLocal and is used to configure various portals.

    Examples
    Get the config bot and set a username on it.
    configBot.tags.username = "bob";
    Open the sheetPortal to "testDimension".
    configBot.tags.sheetPortal = "testDimension";
  • os.device(): CasualOSDevice

    Gets information about the device that the player is using.

    Examples
    Get the device info and popup a message with it.
    const info = os.device();
    os.toast(info);
  • os.version(): CasualOSVersion

    Gets information about the version of CasualOS.

    Examples
    Get the current version and popup a message with it.
    const info = os.version();
    os.toast(info.version);
    Check whether the current inst is for playing AUXes.
    const info = os.version();
    const isPlayer = info.playerMode === "player";
    os.toast('Is Player: ' + isPlayer);
  • os.openDevConsole(): OpenConsoleAction

    Instructs CasualOS to open the built-in developer console. The dev console provides easy access to error messages and debug logs for formulas and actions.

    Examples
    Open the developer console.
    os.openDevConsole();
  • os.log(...args: any[]): void

    Logs the given data to the developer console.

    Each parameter is a any and are the data that should be logged.

    Examples
    Log "Hello, World!" to the browser developer console.
    os.log("Hello, World!");
  • os.run(script: string): Promise<any>

    Runs the given script. The script will be executed in a separate environment with no bot, tags, this, thisBot, data, and that variables. This means that you need to use the getBot(...filters) or getBots(...filters) functions to read bot data.

    Returns a promise that resolves with the returned script value after it has been executed.

    The first parameter is a string and is the script that should be executed.

    Examples
    Run a script that says "hello".
    os.run("os.toast('hello');");
    Run a script from the #script tag on the current bot.
    os.run(tags.script);
    Run a script and toast the result.
    const result = await os.run("return 594 + 391");
    os.toast(result);
  • os.showAccountInfo(): Promise<void>

    Attempts to show the "Account Info" dialog. Does nothing if the user is not logged in.

    Examples
    Show the "Account Info" dialog.
    await os.showAccountInfo();
  • os.sleep(time: number): Promise<void>

    Waits the amount of time provided, in miliseconds.

    Returns a promise that resolves when the time has been waited.

    The first parameter is a number and is the Time to wait in ms. 1 second is 1000 ms.

    Examples
    Wait 2 seconds before proceeding.
    os.toast("Stop!");
    await os.sleep(2000);
    os.toast("Hammer Time!");