Données de jeu
Lire des textes, des enregistrements et des tables, et exécuter du SQL depuis un script
3 archives dans cette catégorie
-
Messages are full of numbers that stand for something: an item, a monster, a map, a line of text. asterobot:gamedata lets a script look those up in the game data Asterobot extracted from the bot's game version. What a script can read Function What it reads Result text() One game text, by its numeric id or its text key Returned right away record() One row of a table, by its key Returned right away table() The rows of a table, a page at a time A promise find() The rows of a table wh
- 0 commentaires
- 2 vues
-
Five functions of asterobot:gamedata cover most of what a script looks up: a text by its id, a record by its key, a whole table, the rows matching some values, and records by their name. import { text, record, table, find, search } from "asterobot:gamedata"; What a row looks like record(), table() and find() return rows as plain objects: The keys are the table's column names, as the Game data tab shows them, such as name_id. A column with no value is left out of the object, so reading it gi
- 0 commentaires
- 2 vues
-
Some questions need a join, a count or a sort that the lookups can't do. query() runs SQL on the bot's game data and hands back the result. Queries are written in SQLite's dialect of SQL, the same one the game version's SQL tab runs. query() query(sql, params, options) resolves to an object with three properties: Property What it holds columns The name of each column, in the order the query selects them. A name can appear twice, as in SELECT a._id, b._id. rows One array per row, hold
- 0 commentaires
- 4 vues