Changes

Jump to navigation Jump to search
Line 6,863: Line 6,863:     
===Game state queries===
 
===Game state queries===
A ''game state query'' is a vanilla way to specify conditions for some content like [[#Custom shops|shop data]], inspired by [[Modding:Content Patcher|Content Patcher]]'s conditions. A query consists of a comma-delimited list of conditions in the form {{t|type}} {{o|arguments}}. The type can be prefixed with <code>!</code> to negate it. The query is true if it's null/blank, or if every listed condition exists and is true. For example, <code>!SEASON Spring, WEATHER Here Sun</code> is true on sunny non-[[spring]] days.
+
A ''game state query'' is a new vanilla way to specify conditions for some content like [[#Custom shops|shop data]], inspired by [[Modding:Content Patcher|Content Patcher]]'s conditions.
   −
'''⚠''' Game state queries are partly case-sensitive. While some values are case-insensitive (e.g. both <code>SEASON Spring</code> and <code>SEASON spring</code> will work), this isn't consistent. Using the exact capitalization is recommended to avoid issues.
+
See [[Modding:Game state queries]] for more information.
 
  −
====Argument format====
  −
Game state queries take space-delimited arguments. For example, <code>BUILDINGS_CONSTRUCTED Here Cabins</code> has two arguments: <code>Here</code> and <code>Cabins</code>.
  −
 
  −
You can add quotes to keep spaces within an argument. For example, <code>BUILDINGS_CONSTRUCTED Here "Junimo Hut"</code> passes <code>Junimo Hut</code> as one argument. You can escape inner quotes with backslashes like <code>ANY "BUILDINGS_CONSTRUCTED Here \"Junimo Hut\""</code>. Remember that quotes and backslashes inside JSON strings need to be escaped too, like <code>"Condition": "BUILDINGS_CONSTRUCTED Here \"Junimo Hut\""</code>.
  −
 
  −
====Conditions====
  −
<dl>
  −
<dt>Meta</dt>
  −
<dd>
  −
{| class="wikitable"
  −
|-
  −
! Condition
  −
! effect
  −
|-
  −
| <samp>ANY {{t|query}}+</samp>
  −
| Get whether at least one of the listed game state queries match, where each argument is a query. For example, <code>ANY "SEASON Winter" "SEASON Spring, DAY_OF_WEEK Friday"</code> is true if (a) it's winter or (b) it's a spring Friday. You can list any number of queries to check.
  −
|}
  −
</dd>
  −
 
  −
<dt>Date & time</dt>
  −
<dd>
  −
{| class="wikitable"
  −
|-
  −
! Condition
  −
! effect
  −
|-
  −
| <samp>DAY_OF_MONTH {{t|day}}+</samp>
  −
| The day of month. This can be an integer between 1 and 28, or <samp>even</samp>/<samp>odd</samp> to match on any even/odd day. You can specify multiple values to match any of them.
  −
|-
  −
| <samp>DAY_OF_WEEK {{t|day}}+</samp>
  −
| The day of week. This can be an integer between 0 (Sunday) and 6 (Saturday), three-letter English name (like <samp>Fri</samp>), or full English name (like <samp>Friday</samp>). You can specify multiple values to match any of them (like <samp>DAY_OF_WEEK Monday Tuesday</samp> for Monday ''or'' Tuesday).
  −
|-
  −
| <samp>DAYS_PLAYED {{t|min}} {{o|max}}</samp>
  −
| Whether {{t|min}} to {{o|max}} (default unlimited) days have been played in the current save (including the current one). This always increments in sync with the date in the base game, but when mods change the in-game date, they may or may not update this value.
  −
|-
  −
| <samp>IS_FESTIVAL_DAY {{o|day offset}}</samp>
  −
| Whether there's a festival today, with an optional {{o|day offset}} (e.g. 1 for tomorrow).
  −
|-
  −
| <samp>IS_PASSIVE_FESTIVAL_OPEN {{t|id}}</samp>
  −
| Whether a [[#Custom passive festivals|passive festival]] with the given ID is active today, and the current time is within its opening hours.
  −
|-
  −
| <samp>IS_PASSIVE_FESTIVAL_TODAY {{t|id}}</samp>
  −
| Whether a [[#Custom passive festivals|passive festival]] with the given ID is active today.
  −
|-
  −
| <samp>SEASON {{t|season}}+</samp>
  −
| The season (one of <samp>spring</samp>, <samp>summer</samp>, <samp>fall</samp>, or <samp>winter</samp>). You can specify multiple values to match any of them (like <samp>SEASON spring summer</samp> for spring ''or'' summer).
  −
|-
  −
| <samp>SEASON_DAY [{{t|season}} {{t|day}}]+</samp>
  −
| The season (in the same format as <samp>SEASON</samp>) and day (an integer between 1 and 28). You can specify multiple values to match any of them (like <samp>SEASON_DAY fall 15 winter 20</samp> for fall 15 ''or'' winter 20).
  −
|-
  −
| <samp>TIME {{t|min}} {{o|max}}</samp>
  −
| Whether the current time is between {{t|min}} and {{o|max}} (default unlimited) inclusively, specified in [[Modding:Modder Guide/Game Fundamentals#Time format|26-hour time]].
  −
|-
  −
| <samp>YEAR {{t|min}} {{o|max}}</samp>
  −
| Whether the current year is between {{t|min}} and {{o|max}} (default unlimited) inclusively.
  −
|}
  −
</dd>
  −
 
  −
<dt>Events</dt>
  −
<dd>
  −
{| class="wikitable"
  −
|-
  −
! Condition
  −
! effect
  −
|-
  −
| <samp>EVENT_ID {{t|event ID}}+</samp>
  −
| Whether one of the the given [[Modding:Event data|event]] IDs are currently playing.
  −
|}
  −
</dd>
  −
 
  −
<dt>World</dt>
  −
<dd>
  −
{| class="wikitable"
  −
|-
  −
! Condition
  −
! effect
  −
|-
  −
| <samp>BUILDINGS_CONSTRUCTED {{t|locations}} {{o|building type}} {{o|min}} {{o|max}} {{o|count unbuilt}}</samp>
  −
| Whether the number of matching buildings is within a range.
  −
 
  −
For example:
  −
* <code>BUILDINGS_CONSTRUCTED Here</code> checks if any buildings were constructed in the player's current location.
  −
* <code>BUILDINGS_CONSTRUCTED Target Cabin</code> checks if there's at least one cabin in the [[#Target location|target location]].
  −
* <code>BUILDINGS_CONSTRUCTED All "Junimo Hut" 3 5</code> checks if there's between 3 and 5 Junimo huts (inclusively) anywhere in the world.
  −
 
  −
Arguments:
  −
* {{t|locations}}: a [[#Target location|target location]], or <samp>All</samp> to count buildings in all locations.
  −
* {{o|building type}}: the building ID in <samp>Data/Buildings</samp> to count, or <samp>All</samp> to count all building types. Note that <samp>All</samp> includes default buildings like the farmhouse.
  −
* {{o|min}}/{{o|max}}: the minimum (default 1) and maximum (default unlimited) count to require.
  −
* {{o|count unbuilt}}: whether to count buildings that haven't been fully constructed yet.
  −
|-
  −
| <samp>CAN_BUILD_CABIN</samp>
  −
| Whether players can build more [[cabin]]s (i.e. they haven't reached the maximum number of player slots yet).
  −
|-
  −
| <samp>CAN_BUILD_FOR_CABINS {{t|building ID}}</samp>
  −
| Whether there are fewer of the given building constructed than there are cabins.
  −
|-
  −
| <samp>FARM_CAVE {{t|type}}</samp>
  −
| The current [[The Farm#The Cave|farm cave]] (one of <samp>Bats</samp>, <samp>Mushrooms</samp>, or <samp>None</samp>).
  −
|-
  −
| <samp>FARM_NAME {{t|name}}</samp>
  −
| The name of the farm.
  −
|-
  −
| <samp>FARM_TYPE {{t|type}}</samp>
  −
| The [[Farm Maps|farm type]]. The {{t|type}} can be one of...
  −
* a numeric ID for a vanilla farm type: <samp>1</samp> (standard), <samp>2</samp> (riverland), <samp>3</samp> (forest), <samp>4</samp> (hilltop), <samp>5</samp> (combat), <samp>6</samp> (four corners), or <samp>7</samp> (beach);
  −
* a readable key for a vanilla farm type: <samp>Standard</samp>, <samp>Beach</samp>, <samp>Forest</samp>, <samp>FourCorners</samp>, <samp>Hilltop</samp>, <samp>Riverland</samp>, or <samp>Wilderness</samp>;
  −
* or the ID for a custom farm type.
  −
|-
  −
| <samp>FOUND_ALL_LOST_BOOKS</samp>
  −
| Whether all the [[Lost Books]] for the [[museum]] have been found.
  −
|-
  −
| <samp>IS_COMMUNITY_CENTER_COMPLETE</samp>
  −
| Whether the [[Community Center|community center]] has been repaired.
  −
|-
  −
| <samp>IS_CUSTOM_FARM_TYPE</samp>
  −
| Whether the [[Farm Maps|farm type]] is a custom one created by a mod. (This returns false for mods which edit/replace a vanilla farm type.)
  −
|-
  −
| <samp>IS_HOST</samp>
  −
| Whether the current player is the main/host player.
  −
|-
  −
| <samp>IS_ISLAND_NORTH_BRIDGE_FIXED</samp>
  −
| Whether the [[Ginger Island#Island North|North Ginger Island]] bridge to the dig site has been repaired.
  −
|-
  −
| <samp>IS_JOJA_MART_COMPLETE</samp>
  −
| Whether the [[Joja Warehouse|Joja warehouse]] has been built.
  −
|-
  −
| <samp>IS_MULTIPLAYER</samp>
  −
| Whether the game is currently in multiplayer mode (regardless of whether there's multiple players connected).
  −
|-
  −
| <samp>IS_VISITING_ISLAND {{t|name}}</samp>
  −
| Whether the named NPC is visiting [[Ginger Island]] today.
  −
|-
  −
| <samp>LOCATION_ACCESSIBLE {{t|name}}</samp>
  −
| Whether the [[#Target location|given location]] is accessible. For vanilla locations, this is relevant to <samp>CommunityCenter</samp>, <samp>JojaMart</samp>, or <samp>Railroad</samp>; any other location will return true unless a mod customizes the query.
  −
|-
  −
| <samp>LOCATION_CONTEXT {{t|location}}</samp>
  −
| The location context name for the [[#Target location|given location]].
  −
|-
  −
| <samp>LOCATION_IS_INDOORS {{t|location}}</samp><br /><samp>LOCATION_IS_OUTDOORS {{t|location}}</samp><br /><samp>LOCATION_IS_MINES {{t|location}}</samp><br /><samp>LOCATION_IS_SKULL_CAVE {{t|location}}</samp>
  −
| Whether the [[#Target location|given location]] is indoors, outdoors, in [[The Mines|the mines]], or in the [[Skull Cavern]].
  −
|-
  −
| <samp>LOCATION_NAME {{t|location}} {{t|name}}</samp><br /><samp>LOCATION_UNIQUE_NAME {{t|location}} {{t|name}}</samp>
  −
| Whether the [[#Target location|given location]] has the specified name or unique instanced name (you can see both names in-game using the {{nexus mod|679|Debug Mode}} mod).
  −
|-
  −
| <samp>LOCATION_SEASON {{t|location}} [{{t|season}}]+</samp>
  −
| Whether the [[#Target location|given location]] is in one of the given seasons (which can be <samp>spring</samp>, <samp>summer</samp>, <samp>fall</samp>, or <samp>winter</samp>). This accounts for the <samp>SeasonOverride</samp> field in the [[#Custom location contexts|location's context data]].
  −
 
  −
For example, this is valid in spring ''or'' summer: <code>LOCATION_SEASON Here spring summer</code>.
  −
|-
  −
| <samp>MUSEUM_DONATIONS {{t|min count}} {{o|max count}} {{o|object type}}+</samp>
  −
| Whether all players have donated a total of {{t|min count}} to {{o|max count}} (default unlimited) inclusively to the [[museum]]. This can optionally be filtered by the object type field, like <samp>MUSEUM_DONATIONS 40 Arch Minerals</samp> to require at least 40 artifacts and minerals combined. You can omit the max count and still specify a filter.
  −
|-
  −
| <samp>WEATHER {{t|location}} {{t|weather}}</samp>
  −
| The weather ID in the [[#Target location|given location]]. The weather can be one of <samp>Festival</samp>, <samp>Rain</samp>, <samp>Snow</samp>, <samp>Storm</samp>, <samp>Sun</samp>, <samp>Wind</samp>, or a [[#Custom weather|custom weather ID]].
  −
|-
  −
| <samp>WORLD_STATE_FIELD {{t|name}} {{t|value}}</samp>
  −
| Whether a property on <samp>Game1.netWorldState</samp> has the given value. If the property is numeric, this is the ''minimum'' value. Some useful values not covered by their own query:
  −
 
  −
{| class="wikitable"
  −
|-
  −
! name
  −
! effect
  −
|-
  −
| <samp>GoldenCoconutCracked</samp>
  −
| Whether the player has cracked open any [[Golden Coconut]]s (<samp>true</samp> or <samp>false</samp>).
  −
|-
  −
| <samp>GoldenWalnutsFound</samp><br /><samp>GoldenWalnuts</samp>
  −
| The total number of [[Golden Walnut]]s found or held by any player. To check how many one player currently holds, see the <samp>PLAYER_HAS_ITEM</samp> query.
  −
|-
  −
| <samp>IsGoblinRemoved</samp>
  −
| Whether the [[Henchman]] has been removed, so the player can access [[Witch's Hut]] (<samp>true</samp> or <samp>false</samp>).
  −
|-
  −
| <samp>IsSubmarineLocked</samp>
  −
| Whether the [[Night Market]] submarine is currently in use by a player (<samp>true</samp> or <samp>false</samp>).
  −
|-
  −
| <samp>LostBooksFound</samp>
  −
| The total number of [[Lost Book]]s found or held by any player.
  −
|-
  −
| <samp>MinesDifficulty</samp><br /><samp>SkullCavesDifficulty</samp>
  −
| The current [[The Mines#Shrine of Challenge|Shrine of Challenge]] difficulty level for the [[The Mines|mine]] or [[Skull Cavern]] (a numeric value, where <samp>0</samp> is the default level when the shrine is deactivated).
  −
|-
  −
| <samp>MiniShippingBinsObtained</samp>
  −
| The number of times the player has obtained a [[Mini-Shipping Bin]].
  −
|-
  −
| <samp>ParrotPlatformsUnlocked</samp>
  −
| Whether the player has unlocked [[Ginger Island]] parrot platforms, regardless of whether they've completed them (<samp>true</samp> or <samp>false</samp>).
  −
|-
  −
| <samp>ServerPrivacy</samp>
  −
| The [[multiplayer]] connection privacy mode (<samp>InviteOnly</samp> or <samp>FriendsOnly</samp>).
  −
|-
  −
| <samp>ShuffleMineChests</samp>
  −
| The value of the 'mine rewards' [[Options|game option]] (<samp>Default</samp> or <samp>Remixed</samp>).
  −
|-
  −
| <samp>WeatherForTomorrow</samp>
  −
| The weather ID for tomorrow in the main valley area.
  −
|-
  −
| <samp>VisitsUntilY1Guarantee</samp>
  −
| The number of times the [[Traveling Cart]] will visit before [[Red Cabbage]] is guaranteed to drop.
  −
|}
  −
 
  −
For example, the [[Traveling Cart]] shop uses a <code>WORLD_STATE_FIELD VisitsUntilY1Guarantee 0</code> condition to check if it should guarantee a [[Red Cabbage]] item.
  −
|-
  −
| <samp>WORLD_STATE_FIELD {{t|name}} {{t|min}} {{o|max}}</samp>
  −
| For numeric properties only, whether a property on <samp>Game1.netWorldState</samp> has a value between {{t|min}} and {{o|max}} (default unlimited). If {{o|max}} is omitted or the properties isn't numeric, the previous form is used. See the previous entry for a list of useful properties.
  −
|-
  −
| <samp>WORLD_STATE_ID {{t|id}}</samp>
  −
| Whether any world state flag with the given {{t|id}} is set.
  −
|}
  −
</dd>
  −
 
  −
<dt>Player info & progress</dt>
  −
<dd>
  −
{| class="wikitable"
  −
|-
  −
! Condition
  −
! effect
  −
|-
  −
| <samp>MINE_LOWEST_LEVEL_REACHED {{t|min}} {{o|max}}</samp>
  −
| Whether any player has reached a level between {{t|min}} and {{o|max}} (default unlimited) inclusively in [[The Mines|the mines]].
  −
|-
  −
| <samp>PLAYER_COMBAT_LEVEL {{t|player}} {{t|min}} {{o|max}}</samp><br /><samp>PLAYER_FARMING_LEVEL {{t|player}} {{t|min}} {{o|max}}</samp><br /><samp>PLAYER_FISHING_LEVEL {{t|player}} {{t|min}} {{o|max}}</samp><br /><samp>PLAYER_FORAGING_LEVEL {{t|player}} {{t|min}} {{o|max}}</samp><br /><samp>PLAYER_LUCK_LEVEL {{t|player}} {{t|min}} {{o|max}}</samp><br /><samp>PLAYER_MINING_LEVEL {{t|player}} {{t|min}} {{o|max}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have a [[skills|skill level]] between {{t|min}} and {{o|max}} (default unlimited) inclusively, including the effects of buffs which raise them.
  −
|-
  −
| <samp>PLAYER_CURRENT_MONEY {{t|player}} {{t|min}} {{o|max}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have between {{t|min}} and {{o|max}} (default unlimited) gold inclusively.
  −
|-
  −
| <samp>PLAYER_FARMHOUSE_UPGRADE {{t|player}} {{t|min}} {{o|max}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have upgraded their [[farmhouse]] or [[cabin]] to a level between {{t|min}} and {{o|max}} (default unlimited) inclusively. See [https://github.com/Pathoschild/StardewMods/blob/develop/ContentPatcher/docs/author-guide/tokens.md#FarmhouseUpgrade possible levels].
  −
|-
  −
| <samp>PLAYER_GENDER {{t|player}} {{t|gender}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] are <samp>Male</samp> or <samp>Female</samp>.
  −
|-
  −
| <samp>PLAYER_HAS_ACHIEVEMENT {{t|player}} {{t|achievement id}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have unlocked a specific achievement ID. The valid IDs are listed in [[Modding:Achievement data|<samp>Data/Achievements</samp>]], plus a few Steam achievement IDs that aren't listed.
  −
|-
  −
| <samp>PLAYER_HAS_ALL_ACHIEVEMENTS {{t|player}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have unlocked every achievement listed in [[Modding:Achievement data|<samp>Data/Achievements</samp>]]. This doesn't count the extra Steam achievement IDs that aren't listed in that file.
  −
|-
  −
| <samp>PLAYER_HAS_CAUGHT_FISH {{t|player}} {{t|id}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have caught at least one fish with the given ID.
  −
|-
  −
| <samp>PLAYER_HAS_CONVERSATION_TOPIC {{t|player}} {{t|id}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have a [[Modding:Dialogue#Conversation topics|conversation topic]] with the ID {{t|id}} active.
  −
|-
  −
| <samp>PLAYER_HAS_CRAFTING_RECIPE {{t|player}} {{t|recipe name}}</samp><br /><samp>PLAYER_HAS_COOKING_RECIPE {{t|player}} {{t|recipe name}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] know the crafting/cooking recipe identified by its internal name (spaces allowed). For example, <code>PLAYER_HAS_CRAFTING_RECIPE Current Field Snack</code>.
  −
|-
  −
| <samp>PLAYER_HAS_DIALOGUE_ANSWER {{t|player}} {{t|id}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have chosen the given dialogue answer in a previous dialogue.
  −
|-
  −
| <samp>PLAYER_HAS_FLAG {{t|player}} {{t|id}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have the given [[Modding:Mail data|mail flag]] set (with spaces allowed in the {{t|id}}).
  −
|-
  −
| <samp>PLAYER_HAS_ITEM {{t|player}} {{t|item}} {{o|min}} {{o|max}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have between {{o|min}} and {{o|max}} (default unlimited) matching items in their inventory, inclusively. The {{t|item}} can be <samp>858</samp> or <samp>(O)858</samp> (Qi Gems), <samp>73</samp> or <samp>(O)73</samp> (Walnuts), or the [[#Custom items|qualified or unqualified item ID]].
  −
|-
  −
| <samp>PLAYER_HAS_PROFESSION {{t|player}} {{t|profession id}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have the given [[Skills|profession]] ID.
  −
|-
  −
| <samp>PLAYER_HAS_READ_LETTER {{t|player}} {{t|id}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have read a letter, where {{t|id}} is the internal mail ID (spaces allowed). For example, <code>PLAYER_HAS_READ_LETTER Any Visited_Island</code>.
  −
|-
  −
| <samp>PLAYER_HAS_SECRET_NOTE {{t|player}} {{t|id}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have read a secret note, where {{t|id}} is the secret note's integer ID.
  −
|-
  −
| <samp>PLAYER_HAS_SEEN_EVENT {{t|player}} {{t|id}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have seen the event with given {{t|id}}.
  −
|-
  −
| <samp>PLAYER_HAS_TOWN_KEY {{t|player}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have the [[Key To The Town|town key]].
  −
|-
  −
| <samp>PLAYER_HAS_TRASH_CAN_LEVEL {{t|player}} {{t|min}} {{o|max}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have a [[Trash Cans|trash can upgrade level]] between {{t|min}} and {{o|max}} (default unlimited) inclusively. The {{t|level}} can be <samp>0</samp> (base), <samp>1</samp> (copper), <samp>2</samp> (steel), <samp>3</samp> (gold), or <samp>4</samp> (iridium).
  −
|-
  −
| <samp>PLAYER_LOCATION_CONTEXT {{t|player}} {{t|location context}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] are in the given [[#Custom location contexts|location context]].
  −
|-
  −
| <samp>PLAYER_LOCATION_NAME {{t|player}} {{t|location name}}</samp><br /><samp>PLAYER_LOCATION_UNIQUE_NAME {{t|player}} {{t|location name}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] are in the given location, using the name or unique instanced name (you can see both names in-game using the {{nexus mod|679|Debug Mode}} mod). The {{t|location name}} value doesn't recognize [[#Target location|target location keywords]] like <samp>Here</samp>.
  −
|-
  −
| <samp>PLAYER_MOD_DATA {{t|player}} {{t|key}} {{t|value}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have a <samp>player.modData</samp> entry added by a mod with the given {{t|key}} and {{t|value}}.
  −
|-
  −
| <samp>PLAYER_MONEY_EARNED {{t|player}} {{t|min}} {{o|max}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have earned between {{t|min}} and {{o|max}} (default unlimited) gold inclusively.
  −
|-
  −
| <samp>PLAYER_SHIPPED_BASIC_ITEM {{t|player}} {{t|item ID}} {{o|min count}} {{o|max count}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have shipped the given item between {{o|min count}} (default 1) and {{o|max count}} (default unlimited) times inclusively. This only works for the items tracked by the game for shipping stats (shown in the [[Shipping#Collection|shipping collections menu]]).
  −
|-
  −
| <samp>PLAYER_SPECIAL_ORDER_ACTIVE {{t|player}} {{t|order id}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have the given [[Special Orders|special order]] active.
  −
|-
  −
| <samp>PLAYER_SPECIAL_ORDER_RULE_ACTIVE {{t|player}} {{t|rule id}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have a special rule active for a [[Special Orders|special order]]. Some vanilla rules are...
  −
 
  −
{| class="wikitable"
  −
|-
  −
! rule ID
  −
! effect
  −
|-
  −
| <samp>DROP_QI_BEANS</samp>
  −
| The player can find [[Qi Beans]] for the ''Qi's Crop'' order.
  −
|-
  −
| <samp>LEGENDARY_FAMILY</samp>
  −
| The player catch the new legendary fish for the ''Extended Family'' order.
  −
|-
  −
| <samp>MINE_HARD</samp><br /><samp>SC_HARD</samp>
  −
| Raises the difficulty level of the mines or [[Skull Cavern]].
  −
|-
  −
| <samp>SC_NO_FOOD</samp>
  −
| The player can't eat food in the [[Skull Cavern]].
  −
|}
  −
|-
  −
| <samp>PLAYER_STAT {{t|player}} {{t|stat name}} {{t|min value}} {{o|max value}}</samp>
  −
| Whether a stat counter for the [[#Target player|specified player(s)]] has a value between {{t|min value}} and {{o|max value}} (default unlimited) inclusively. The available stat names are...
  −
* <samp>averageBedtime</samp>;
  −
* <samp>beachFarmSpawns</samp>;
  −
* <samp>beveragesMade</samp>;
  −
* <samp>boatRidesToIsland</samp>;
  −
* <samp>bouldersCracked</samp>;
  −
* <samp>caveCarrotsFound</samp>;
  −
* <samp>cheeseMade</samp>;
  −
* <samp>chickenEggsLayed</samp>;
  −
* <samp>childrenTurnedToDoves</samp>;
  −
* <samp>coalFound</samp>;
  −
* <samp>coinsFound</samp>;
  −
* <samp>copperFound</samp>;
  −
* <samp>cowMilkProduced</samp>;
  −
* <samp>cropsShipped</samp>;
  −
* <samp>daysPlayed</samp>;
  −
* <samp>diamondsFound</samp>;
  −
* <samp>dirtHoed</samp>;
  −
* <samp>duckEggsLayed</samp>;
  −
* <samp>exMemoriesWiped</samp>;
  −
* <samp>fishCaught</samp>;
  −
* <samp>geodesCracked</samp>;
  −
* <samp>giftsGiven</samp>;
  −
* <samp>goatCheeseMade</samp>;
  −
* <samp>goatMilkProduced</samp>;
  −
* <samp>goldFound</samp>;
  −
* <samp>goodFriends</samp>;
  −
* <samp>hardModeMonstersKilled</samp>;
  −
* <samp>individualMoneyEarned</samp>;
  −
* <samp>iridiumFound</samp>;
  −
* <samp>ironFound</samp>;
  −
* <samp>itemsCooked</samp>;
  −
* <samp>itemsCrafted</samp>;
  −
* <samp>itemsForaged</samp>;
  −
* <samp>itemsShipped</samp>;
  −
* <samp>monstersKilled</samp>;
  −
* <samp>mysticStonesCrushed</samp>;
  −
* <samp>notesFound</samp>;
  −
* <samp>otherPreciousGemsFound</samp>;
  −
* <samp>piecesOfTrashRecycled</samp>;
  −
* <samp>preservesMade</samp>;
  −
* <samp>prismaticShardsFound</samp>;
  −
* <samp>questsCompleted</samp>;
  −
* <samp>rabbitWoolProduced</samp>;
  −
* <samp>rocksCrushed</samp>;
  −
* <samp>seedsSown</samp>;
  −
* <samp>sheepWoolProduced</samp>;
  −
* <samp>slimesKilled</samp>;
  −
* <samp>starLevelCropsShipped</samp>;
  −
* <samp>stepsTaken</samp>;
  −
* <samp>sticksChopped</samp>;
  −
* <samp>stoneGathered</samp>;
  −
* <samp>stumpsChopped</samp>;
  −
* <samp>timesEnchanted</samp>;
  −
* <samp>timesFished</samp>;
  −
* <samp>timesUnconscious</samp>;
  −
* <samp>totalMoneyGifted</samp>;
  −
* <samp>trashCansChecked</samp>;
  −
* <samp>trufflesFound</samp>;
  −
* <samp>walnutsFound</samp>;
  −
* <samp>weedsEliminated</samp>.
  −
|}
  −
</dd>
  −
 
  −
<dt>Player relationships</dt>
  −
<dd>
  −
{| class="wikitable"
  −
|-
  −
! Condition
  −
! effect
  −
|-
  −
| <samp>PLAYER_HAS_CHILDREN {{t|player}} {{o|min}} {{o|max}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have a number of children between {{o|min}} (default 1) and {{o|max}} (default unlimited) inclusively.
  −
|-
  −
| <samp>PLAYER_HAS_PET {{t|player}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have a [[Animals#Cat or Dog|pet]].
  −
|-
  −
| <samp>PLAYER_HEARTS {{t|player}} {{t|npc}} {{t|min hearts}} {{o|max hearts}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have a friend with a [[friendship]] level between {{t|min hearts}} and {{o|max hearts}} (default unlimited) inclusively. The {{t|npc}} can be an NPC's internal name, <samp>Any</samp> (check every NPC), or <samp>AnyDateable</samp> (check every romanceable NPC).
  −
|-
  −
| <samp>PLAYER_HAS_MET {{t|player}} {{t|npc}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have talked to an NPC at least once. The {{t|npc}} is an NPC's internal name.
  −
|-
  −
| <samp>PLAYER_IS_DATING {{t|player}} {{t|npc}}</samp><br /><samp>PLAYER_IS_ENGAGED {{t|player}} {{t|target}}</samp><br /><samp>PLAYER_IS_MARRIED {{t|player}} {{t|target}}</samp><br /><samp>PLAYER_IS_DIVORCED {{t|player}} {{t|npc}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have this relationship status with an NPC. The player is dating after giving the NPC a [[bouquet]], and engaged after giving a [[Mermaid's Pendant]] but before the marriage. The {{t|npc}} can be an NPC's internal name, or <samp>Any</samp> (check every romanceable NPC).
  −
|-
  −
| <samp>PLAYER_IS_ROOMMATE {{t|player}} {{t|target}}</samp>
  −
| Whether the [[#Target player|specified player(s)]] have a roommate. The {{t|target}} can be an NPC's internal name, <samp>Any</samp> (with any NPC), or <samp>Player</samp> (always false).
  −
|-
  −
| <samp>PLAYER_PREFERRED_PET {{t|player}} {{t|pet}}</samp>
  −
| Whether the preferred pet for the [[#Target player|specified player(s)]] is <samp>Cat</samp>, <samp>Dog</samp>, or a specified custom pet type.
  −
|}
  −
</dd>
  −
 
  −
<dt>Randomization</dt>
  −
<dd>
  −
{| class="wikitable"
  −
|-
  −
! Condition
  −
! effect
  −
|-
  −
| <samp>RANDOM {{t|chance}} {{o|@addDailyLuck}}</samp>
  −
| A random probability check which is re-rolled each time it's called. For example, <code>RANDOM 0.4</code> is true 40% of the time.
  −
 
  −
If the exact text <samp>@addDailyLuck</samp> is specified, the current player's [[Daily Luck|daily luck]] is added to the probability.
  −
|-
  −
| <samp>SYNCED_CHOICE {{t|interval}} {{t|key}} {{t|min}} {{t|max}} {{t|choices}}+</samp>
  −
| Choose a random integer between {{t|min}} and {{t|max}} inclusively, and check whether it matches one of the {{t|choices}}. The result will be identical for all queries with the same {{t|key}} value during the given {{t|interval}} (one of <samp>tick</samp>, <samp>day</samp>, <samp>season</samp>, or <samp>year</samp>), including between players in multiplayer mode.
  −
 
  −
For example, <samp>SYNCED_CHOICE day example_key 1 5 1 2</samp> chooses a random value between 1 and 5, and checks if it's either 1 or 2.
  −
 
  −
This is mainly useful in cases where you need to pick between a number of discrete cases. For regular probability checks, see <samp>SYNCED_RANDOM</samp> instead.
  −
|-
  −
| <samp>SYNCED_RANDOM {{t|interval}} {{t|key}} {{t|chance}} {{o|@addDailyLuck}}</samp>
  −
| A random probability check. The result will be identical for all queries with the same {{t|key}} value during the given {{t|interval}} (one of <samp>tick</samp>, <samp>day</samp>, <samp>season</samp>, or <samp>year</samp>), including between players in multiplayer mode.
  −
 
  −
For example, <samp>SYNCED_RANDOM day cart_rare_seed 0.4</samp> has a 40% chance to be true the first time it's called that day, and will always be the same value if called again with the same key on the same day.
  −
 
  −
If the exact text <samp>@addDailyLuck</samp> is specified, the current player's [[Daily Luck|daily luck]] is added to the probability.
  −
|-
  −
| <samp>SYNCED_SUMMER_RAIN_RANDOM {{t|base chance}} {{t|day multiplier}}</samp>
  −
| A specialized variant of <samp>SYNCED_DAY_RANDOM</samp> used to calculate the chance of rain in summer, which increases with the day number.
  −
|}
  −
</dd>
  −
 
  −
<dt>For items only</dt>
  −
<dd>
  −
These queries apply in cases where there's an item (e.g. machine recipes, shops, etc); they'll return false if not applicable. They take a {{t|type}} argument which can be <samp>Input</samp> (the machine input item) or <samp>Target</samp> (the machine output, tree fruit, shop item, etc).
  −
 
  −
{| class="wikitable"
  −
|-
  −
! Condition
  −
! effect
  −
|-
  −
| <samp>ITEM_HAS_EDIBILITY {{t|target}} {{o|min}} {{o|max}}</samp>
  −
| Whether the item's edibility is between {{o|min}} (default -299) and {{o|max}} (default unlimited) inclusively. A value of -300 is inedible, so <samp>ITEM_HAS_EDIBILITY {{t|target}}</samp> without min/max values checks if the item is edible.
  −
|-
  −
| <samp>ITEM_HAS_TAG {{t|target}} {{t|tags}}</samp>
  −
| Whether the item has all of the given space-delimited tags. For example, <code>ITEM_HAS_TAG Target bone_item marine_item</code> will only match items with both tags.
  −
|-
  −
| <samp>ITEM_ID {{t|target}} {{t|item ID}}</samp>
  −
| Whether the item has the given [[#Custom items|qualified or unqualified item ID]]. The item ID is qualified before checking, so <samp>128</samp> will match pufferfish (<samp>(O)128</samp>) but not mushroom boxes (<samp>(BC)128</samp>).
  −
|-
  −
| <samp>ITEM_QUALITY {{t|target}} {{t|min}} {{o|max}}</samp>
  −
| Whether the item's quality is between {{t|min}} and {{o|max}} (default unlimited) inclusively. The possible values are <samp>0</samp> (normal), <samp>1</samp> (silver), <samp>2</samp> (gold), or <samp>4</samp> (iridium).
  −
|-
  −
| <samp>ITEM_STACK {{t|target}} {{t|min}} {{o|max}}</samp>
  −
| Whether the item stack size is between {{t|min}} and {{o|max}} (default unlimited) inclusively. Note that this only applies to the target item, it doesn't include other stacks in the inventory.
  −
|-
  −
| <samp>ITEM_TYPE {{t|target}} {{t|type}}</samp>
  −
| Whether the [[#Custom items|item's type definition ID]] matches the given value. For example, <samp>ITEM_TYPE Target (BC)</samp> matches bigcraftables.
  −
|}
  −
</dd>
  −
 
  −
<dt>Immutable</dt>
  −
<dd>
  −
{| class="wikitable"
  −
|-
  −
! Condition
  −
! effect
  −
|-
  −
| <samp>TRUE</samp>
  −
| A condition which always matches.
  −
|-
  −
| <samp>FALSE</samp>
  −
| A condition which never matches.
  −
|}
  −
</dd>
  −
</dl>
  −
 
  −
====Target location====
  −
Some conditions have a {{t|location}} argument. This can be one of...
  −
{| class="wikitable"
  −
|-
  −
! value
  −
! result
  −
|-
  −
| <samp>Here</samp>
  −
| The location containing the current player (regardless of the [[#Target player|target player]]).
  −
|-
  −
| <samp>Target</samp>
  −
| The location containing the in-game entity being edited (e.g. the machine for <samp>Data/Machines</samp> or fruit tree for <samp>Data/FruitTrees</samp>).
  −
 
  −
If the asset being edited isn't tied to a location, this is the location of the [[#Target player|target player]] (if set), else equivalent to <samp>Here</samp>.
  −
|-
  −
| ''any other''
  −
| The [[#Custom locations|location ID]] (i.e. internal name) for the location to check.
  −
|}
  −
 
  −
====Target player====
  −
Some conditions have a {{t|player}} argument. This can be one of...
  −
{| class="wikitable"
  −
|-
  −
! value
  −
! result
  −
|-
  −
| <samp>Any</samp>
  −
| At least one player must match the condition, regardless of whether they're online.
  −
|-
  −
| <samp>All</samp>
  −
| Every player must match the condition, regardless of whether they're online.
  −
|-
  −
| <samp>Current</samp>
  −
| The local player.
  −
|-
  −
| <samp>Host</samp>
  −
| The main player.
  −
|-
  −
| <samp>Target</samp>
  −
| This value depends on the context:
  −
{| class="wikitable"
  −
|-
  −
! context
  −
! effect
  −
|-
  −
| <samp>Data/LocationContexts</samp>
  −
| For the <samp>PassOutLocations</samp> field only, the player whose pass-out location to get.
  −
|-
  −
| <samp>Data/Weddings</samp>
  −
| For the <samp>Attendees</samp> field only, the attendee player (if the attendee is a player).
  −
|-
  −
| <samp>Data/WildTrees</samp>
  −
| For the <samp>AdditionalChopDrops</samp> field only, the last player who chopped the tree.
  −
|-
  −
| ''custom queries''
  −
| C# mods may specify a <samp>target_farmer</samp> parameter when calling <samp>GameStateQuery.CheckConditions</samp>.
  −
|-
  −
| ''any other''
  −
| Equivalent to <samp>Current</samp>.
  −
|}
  −
|-
  −
| ''any other''
  −
| The unique multiplayer ID for the player to check.
  −
|}
  −
 
  −
====Using queries elsewhere====
  −
C# code can use the <samp>GameStateQuery</samp> class to work with queries, like <code>GameStateQuery.CheckConditions(query)</code>.
  −
 
  −
You can also use game state queries in [[Modding:Event data|event preconditions]] using the new <samp>G</samp> condition flag, like <code>some_event_id/G !SEASON Spring, WEATHER Here Sun</code>.
  −
 
  −
====Extensibility====
  −
C# mods can check if a query exists using <code>GameStateQuery.Exists("Example.ModId_ConditionName")</code>, and define custom conditions using <code>GameStateQuery.Register("Example.ModId_ConditionName", handleQueryMethod)</code>. To avoid conflicts, prefixing custom condition names with your mod ID is strongly recommended.
      
===Item queries===
 
===Item queries===
translators
8,445

edits

Navigation menu