Aller au contenu
Afficher dans l'application

Une meilleure façon de naviguer. En savoir plus.

Asterobot

Une application plein écran sur votre écran d'accueil avec notifications push, badges et plus encore.

Pour installer cette application sur iOS et iPadOS
  1. Appuyez sur Icône de partage dans Safari
  2. Faites défiler le menu et appuyez sur Ajouter à l'écran d'accueil.
  3. Appuyez sur Ajouter dans le coin supérieur droit.
Pour installer cette application sur Android
  1. Appuyez sur le menu à trois points (⋮) dans le coin supérieur droit du navigateur.
  2. Appuyez sur Ajouter à l'écran d'accueil ou Installer l'application.
  3. Confirmez en appuyant sur Installer.

Create a package

(0 notes)

Every script lives in a package. You create one in Library Manager, and Asteroboard opens it in the editor with a few lines of starter code that already run.

Create the package

  1. In the sidebar, open Library Manager.
  2. Click New package. The New local package dialog opens.
  3. In Name, type a name for your package, for example my-first-script.
  4. Leave Version at 1.0.0.
  5. Click Create and edit.

The dialog closes and the editor opens on your package, showing index.js. Back in Library Manager, the package has its own row with the Local badge.

Field Default Rules
Name Empty Required. A package you create is local, so its name can't start with @ and can't contain : or @ anywhere.
Version 1.0.0 Required. Names and versions explains how to number versions.

The dialog tells you when something is wrong:

Message What to do
A new package is local, so its name can't start with '@' - those are assigned by the marketplace. Remove the @. Names that start with @ belong to packages installed from the marketplace.
A local package name can't contain ':' or '@'. Remove the : or the @.
my-first-script 1.0.0 already exists and would be replaced. Your library already has a package with that name and version. Create and edit stays disabled until you change one of them.
Couldn't create the package Asterobot didn't create the package. This toast gives no reason.

A tour of the editor

The top bar

Item What it does
Box icon Opens the package's own page, with its details and its manifest.
Name and version The package you're editing, such as my-first-script @1.0.0.
Unsaved Appears while some changes aren't saved.
Incompatible Appears when the Asterobot versions the package says it works with don't include the one you run. See Compatibility.
Error count A badge such as 2 error(s) when the editor finds errors. It counts every file of the package, not only the open one.
IntelliSense Hover it to see how many game messages the editor can complete. If it says Couldn't load the typings - editing works, completion doesn't., you can keep editing, without completion.
Bot picker Chooses the bot that Run starts the package on. It only appears when at least one bot is connected to a game.
Game Opens a panel next to the code with the map viewer (Atlas) and the game data browser (Datacenter).
Save Saves every file of the package. Ctrl+S does the same. The button is disabled while nothing has changed.
Run Saves, then starts the package on the bot in the picker. It's disabled when no bot is connected to a game, with the tooltip No bot is connected to a game.

Files

The Files column lists the package's modules, index.js first. A dot after a file's name means it has unsaved changes, and a number next to it counts its errors.

The plus button adds a file. The Add a file dialog asks for a Path, such as lib/helper.js. The path must end in .js or .mjs, stay inside the package and not be taken already, and the file only exists once you save.

The trash icon, shown when you hover a file, removes it from the list, and saving deletes it from the package. index.js has no trash icon: it's where every script starts.

Saving replaces the package's files with exactly what the editor holds. A bot that's already playing the package keeps running the code it started with until it starts again, which is what Run does.

The starter code

A new package's index.js contains:

import { info } from "asterobot:console";

export default async function behavior(launch) {
  info(`started (${launch.reason})`);
}

Line by line:

import { info } from "asterobot:console"; brings in the info() function from the built-in asterobot:console module. Everything Asterobot gives scripts comes from an asterobot: module imported this way.

export default async function behavior(launch) { declares the function Asterobot calls when a bot starts the script. It has to be the default export of index.js, and it has to be async. Its name doesn't matter.

launch is an object Asterobot passes in. launch.reason says why the script is starting: "initial", "resume" or "reload". The next page explains what each value means for your script.

info(`started (${launch.reason})`); writes a line such as started (initial) to Asterobot's own log. That log is in Server > Console, not in the bot's Console tab, so don't look for it on the bot's page.

The closing } ends the function. Returning from it doesn't stop the script: anything the function set up, such as handlers for game messages, keeps working until the script is stopped. This one sets nothing up, so it has nothing left to do.

The starter code doesn't identify the bot on the game server. On a Full socket bot it runs, but nothing happens in the game. Identify and run fixes that, and moves the output to the bot's page.

Commentaires des utilisateurs

Aucun avis à afficher.

Compte

Navigation

Recherche

Recherche

Configurer les notifications push du navigateur

Chrome (Android)
  1. Appuyez sur l'icône de cadenas à côté de la barre d'adresse.
  2. Tap Autorisations → Notifications.
  3. Ajustez vos préférences.
Chrome (Desktop)
  1. Cliquez sur l'icône représentant un cadenas dans la barre d'adresse..
  2. Select Paramètres du site.
  3. Find Notifications et ajustez vos préférences.