Everything you need to write scripts is already in Asteroboard, plus one reference on asterobot.net. Here's what each tool is for, so you know where to look when a script doesn't do what you expect.
The package editor
You write code in the package editor. Open it from Library Manager: New package creates a package and opens it, and Edit code, in a package's menu, opens one you already have. Only local packages can be edited: a package downloaded from the marketplace is read-only.
The editor completes the asterobot: functions and the names of game messages as you type, checks the fields you put in a message, and counts errors across every file of the package. Its Game panel shows the map viewer (Atlas) and the game data browser (Datacenter) next to your code.
Create a package gives a tour of it, and The editor covers every feature.
Run
Run, in the editor, saves your package and starts it on a connected bot you pick, replacing whatever that bot was playing. Change a line, click Run, watch the bot: that's the loop you'll repeat most. Identify and run explains it.
The bot's Console and Problems
On a bot's page, the Console tab shows what your script writes with botDebug(), botInfo(), botWarn() and botError(). Those lines are mixed with Asterobot's own messages about the bot and, when Live chat is on, with the game chat. When the console gets busy, keep only Script in Sources.
When a script stops because of an error, The behavior stopped with an error appears at the top of the bot's page, whichever tab is open, with the complete error text and a Copy button.
See Console and Logging and debugging.
Server > Console
What a script writes with asterobot:console doesn't appear on the bot's page. It goes to Asterobot's own log, which you read in Server > Console and in the terminal where Asterobot runs. Those lines don't say which bot wrote them. By default, debug lines are left out: to see them in Server > Console, set Server level to DEBUG. Status and console describes the page.
The Network tool
On a bot's page, Tools > Network shows the messages going through the bot. It's how you find out which messages the game uses for something, and what they contain. It has three tabs:
| Tab | What it's for |
|---|---|
| Traffic | The live list of messages, oldest first. Click a message to see its fields. |
| Send a game message | Sends one message by hand, from a form built from the message's fields, the same way send() sends it from a script. |
| Settings | Chooses which messages Traffic shows. Nothing is shown until you select some and click Apply. |
What you select in Settings only changes what Asteroboard shows. A script receives every message, whatever is selected.
Network traffic, Send messages by hand and Finding messages go further.
Game data and SQL
Messages are full of ids: items, monsters, maps. To find out what an id stands for, open the game version's page from Game Manager and go to its Game data tab. Search finds records by name, Tables lets you browse them, and SQL runs read-only queries, the same kind a script runs with query() from asterobot:gamedata. Try a query there before you put it in a script.
See Game data, SQL and, for scripts, Game data overview.
The Dofus protocol reference
The Dofus protocol reference on asterobot.net describes the game's messages and their fields. Keep it open while you write.
Inline scripts
For a quick test that doesn't deserve a package, a bot can run code you paste:
- On the bot's page, open the menu next to Play.
- Choose Load a new package.
- Select Inline script and paste your code.
- Click Load a new package at the bottom of the dialog, then click Play.
Load a package and play it, in the same menu, opens the same dialog and starts the script as soon as it's loaded.
An inline script is a single file that isn't saved anywhere. It can import the asterobot: modules but no other file, it can't be opened in the editor, and its settings don't appear on the bot's Settings tab. Loading one stops whatever script the bot was running. Run a package covers loading in detail.
Ready to write something? Start with Create a package.
Aucun avis à afficher.