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
tempLocaland 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.version(): AuxVersion
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.configureTypeChecking(options: ConfigureTypeCheckingOptions): Promise<void>
Configures TypeScript type checking in the Monaco editor.
This function allows you to enable or disable TypeScript semantic and syntax validation in the code editor. By default, type checking is disabled to reduce visual noise.
The first parameter is a ConfigureTypeCheckingOptions and is the configuration options for type checking.
Examples
Enable TypeScript type checkingawait os.configureTypeChecking({
editorDiagnosticOptions: {
noSemanticValidation: false,
noSyntaxValidation: false
}
});Disable TypeScript type checkingawait os.configureTypeChecking({
editorDiagnosticOptions: {
noSemanticValidation: true,
noSyntaxValidation: false
}
});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.promptToInstallPWA(): Promise<object>
Prompts the user to install the Progressive Web App (PWA).
Returns a promise that resolves with an object containing the user's choice and platform information when they respond to the prompt. Rejects with an error if the feature is not supported (for example, on iOS devices).
The returned object contains:
outcome: Either "accepted" or "dismissed" based on the user's choiceplatform: The platform identifier (empty string if not provided)
Note that this feature may not be available on all platforms and browsers. In particular:
- iOS Safari does not support the PWA installation prompt
- The prompt can only be triggered in response to user interaction
- The prompt will only be shown if the app meets PWA installability criteria
Examples
Prompt the user to install the PWA.try {
const result = await os.promptToInstallPWA();
if (result.outcome === 'accepted') {
os.toast("Thanks for installing!");
} else {
os.toast("Maybe next time!");
}
} catch (error) {
os.toast("PWA installation is not available: " + error.message);
}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, andthatvariables. This means that you need to use thegetBot(...filters)orgetBots(...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.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!");