Modding:Item queries
← Index
This page documents item queries, a built-in way to create one or more items based on a string command.
Item queries choose one or more items dynamically, instead of specifying a single item ID. These are used in various places like machine data and shop data.
Available queries
General use
query | effect | ||||||
---|---|---|---|---|---|---|---|
ALL_ITEMS [type ID] [flags]
|
Every item provided by the item data definitions. If [type ID] is set to an item type identifier (like (O) for object), only returns items from the matching item data definition.
The
For example:
| ||||||
FLAVORED_ITEM <type> <ingredient ID> [ingredient flavor ID]
|
A flavored item like Apple Wine. The <type> can be one of AgedRoe, Honey, Jelly, Juice, Pickle, Roe, or Wine. The <ingredient ID> is the qualified or unqualified item ID which provides the flavor (like Apple in Apple Wine). For Honey, you can set the <flavor ID> to -1 for Wild Honey.
For aged roe only, the | ||||||
RANDOM_ITEMS <type definition ID> [min ID] [max ID] [flags]
|
All items from the given type definition ID in randomized order, optionally filtered to those with a numeric ID in the given [min ID] and [max ID] range (inclusive).
The The flags can be any combination of:
For example, you can sell a random wallpaper for 200g in Data/Shops: {
"ItemId": "RANDOM_ITEMS (WP)",
"MaxItems": 1,
"Price": 200
}
Or a random house plant: {
"ItemId": "RANDOM_ITEMS (F) 1376 1390",
"MaxItems": 1
}
Or a random custom item added by a mod by its item ID prefix: {
"ItemId": "RANDOM_ITEMS (O)",
"MaxItems": 1,
"PerItemCondition": "ITEM_ID_PREFIX Target AuthorName_ModName_"
}
Or 10 random objects with any category except -13 or -14: {
"ItemId": "RANDOM_ITEMS (O)",
"MaxItems": 10,
"PerItemCondition": "ITEM_CATEGORY, !ITEM_CATEGORY Target -13 -14"
}
|
Specific items
query | effect |
---|---|
DISH_OF_THE_DAY | The Saloon's dish of the day. |
LOST_BOOK_OR_ITEM [alternate query]
|
A lost book if the player hasn't found them all yet, else the result of the [alternate query] if specified, else nothing.
For example, |
RANDOM_BASE_SEASON_ITEM | A random seasonal vanilla item which can be found by searching garbage cans, breaking containers in the mines, etc. |
SECRET_NOTE_OR_ITEM [alternate query]
|
A secret note (or journal scrap on the island) if the player hasn't found them all yet, else the result of the [alternate query] if specified, else nothing.
For example, |
SHOP_TOWN_KEY | The special town key item. This is only valid in shops. |
Specialized
query | effect |
---|---|
ITEMS_SOLD_BY_PLAYER <shop location>
|
Random items the player has recently sold to the <shop location> , which can be one of SeedShop (Pierre's store) or FishShop (Willy's fish shop).
|
LOCATION_FISH <location> <bobber tile> <depth>
|
A random item that can be found by fishing in the given location. The <location> should be the internal name of the location, <bobber tile> is the position of the fishing rod's bobber in the water (in the form <x> <y> ), and <depth> is the bobber's distance from the nearest shore measured in tiles (where 0 is directly adjacent to the shore).
Careful: since the target location might use LOCATION_FISH queries in its list, it's easy to cause a circular reference by mistake (e.g. location A gets fish from B, which gets fish from A). If this happens, the game will log an error and return no item. |
RANDOM_ARTIFACT_FOR_DIG_SPOT | A random item which is defined in Data/Objects with the Arch (artifact) type, and whose spawn rules in the Miscellaneous field match the current location and whose random probability passes. This is mainly used by artifact spots. |
TOOL_UPGRADES [tool ID]
|
The tool upgrades listed in Data/Shops whose conditions match the player's inventory (i.e. the same rules as Clint's tool upgrade shop). If [tool ID] is specified, only upgrades which consume that tool ID are shown.
|