compatibleVersion says which versions of Asterobot your package works with. When someone runs an Asterobot outside that range, the package is marked Incompatible and doesn't start. It's about Asterobot's version, not the game's: a Dofus update changes nothing here. After a game update covers what a game update changes for scripts.
Declare it
On your package's page, type the range in Compatible with, in the Manifest card, then click Save manifest. In the file, it's the compatibleVersion key:
{
"compatibleVersion": ">=1.5.0 <2.0.0"
}
Without a range, the package works with every version of Asterobot and nothing is checked. To find the version you run, see Updating, or run asterobot --version.
Write the range
A range is one or more conditions on the version of Asterobot:
| Range | Matches |
|---|---|
>=1.5.0 |
1.5.0 and every later version |
>=1.5.0 <2.0.0 |
From 1.5.0 up to 2.0.0, without 2.0.0. A space or a comma between two conditions means both must hold. |
^1.5.0 |
The same as >=1.5.0 <2.0.0: this version and the later ones with the same first number |
^0.4.0 |
From 0.4.0 up to 0.5.0, without 0.5.0. When the first number is 0, the second one has to stay the same. |
~1.5.0 |
From 1.5.0 up to 1.6.0, without 1.6.0 |
1.5.x |
Every 1.5 version |
1.5.0 - 1.8.0 |
From 1.5.0 to 1.8.0, both included. The hyphen needs a space on each side. |
<1.6.0 || >=1.7.0 |
Either condition: here, every version except the 1.6 ones |
!=1.6.2 |
Every version except 1.6.2 |
1.5.0 |
Only 1.5.0 |
A version with a suffix after a hyphen, such as 1.6.0-rc.1, only matches a range that has such a suffix itself, as in >=1.6.0-0. Without one, the range leaves those versions out, even when their numbers are inside it.
Where it shows
| Where | What you see |
|---|---|
| Library Manager, Compatibility column | Compatible or Incompatible, only for a package that declares a range |
| The package's page | The same badge next to the provenance badge, and a Compatible with row with the range |
| The top bar of the editor | Incompatible, when the Asterobot you run isn't in the range |
| Package pickers, in Add a bot, Load a behavior selection and the bot's Settings tab | (incompatible) after the package's name and version. The package can still be picked. |
| The bot's header | The package's name in orange, and incompatible versions in orange in its version menu |
| A script | packages.info(name).compatibleVersion, described in asterobot:runtime |
What it blocks
Asterobot checks the range each time it loads the package: at every start, whether from Play, Run or Load a package and play it, and each time it reads the package's settings. When the Asterobot you run isn't in the range:
- The script doesn't start, and the toast gives no reason.
- Package settings, on the bot's Settings tab, and the Add a bot dialog show Couldn't read this package's settings with the reason:
resolve package my-bot@1.0.0: package "my-bot@1.0.0": package "my-bot" requires asterobot >=1.5.0 <2.0.0, running 1.4.2
- A package that depends on an incompatible package doesn't start either, even when its own range is fine. The reason then names the dependency.
Nothing else is blocked. Installing from the marketplace, importing, copying, editing and saving all work on an incompatible package, and it stays in the library. After Asterobot is updated and started again, the badges and the checks follow the new version.
Not checked when you save
Asterobot doesn't check that a range is written correctly when you click Save manifest, nor when it installs a package. A range it can't read is saved as it is, and then:
- The package shows Incompatible everywhere, whatever version you run.
- Every start fails, and Package settings shows a reason containing
has an invalid compatibleVersion constraint, followed by the range and what's wrong with it.
So after saving a range, look at the badge at the top of the package's page. If it says Incompatible while the Asterobot you run should match, read the range again: >=1.5.0 and <2.0.0 or 1.5.0+, for example, aren't ranges Asterobot can read.
When to declare a range
- Declare a lower bound when your package needs something a given Asterobot version brought: a function, a message name, a fix. Use the first version that has it.
- Add an upper bound only when you know a later version breaks your package. A bound that's too tight marks your package Incompatible for people whose Asterobot would have run it fine.
- A new range reaches the people who installed your package only with a new version of it: see Publish an update.
Next, Permissions.
Aucun avis à afficher.