Changes

m
→‎World: Fixing some GSQ documentation formatting
Line 1: Line 1: −
{{upcoming|1.6}}
  −
   
← [[Modding:Index|Index]]
 
← [[Modding:Index|Index]]
   Line 23: Line 21:  
Which you use is mainly a performance tradeoff:
 
Which you use is mainly a performance tradeoff:
 
* Content Patcher's <samp>When</samp> conditions are highly optimized and cached, so thousands of patches can check the same condition without impacting performance and the resulting changes are written once to the asset. Then there's no performance impact after the asset edit, since it's just plain unconditional data. However the asset is reloaded when patches are added/removed, which may impact performance if they change often in some cases (like reloading a map or indoor/outdoor NPC appearance).
 
* Content Patcher's <samp>When</samp> conditions are highly optimized and cached, so thousands of patches can check the same condition without impacting performance and the resulting changes are written once to the asset. Then there's no performance impact after the asset edit, since it's just plain unconditional data. However the asset is reloaded when patches are added/removed, which may impact performance if they change often in some cases (like reloading a map or indoor/outdoor NPC appearance).
* A game state query has no caching, so it can significantly affect performance when it's checked often. For example, a thousand game state queries checked each update tick means sixty thousand condition evaluations per second. On the other hand, game state queries are faster in cases where the conditions are checked rarely and doing so avoids reloading textures or maps (like <samp>ChooseAppearance</samp> in <samp>Data/Characters</samp> or <samp>Music</samp> in <samp>Data/Locations</samp>).
+
* A game state query has no caching, so it can significantly affect performance when it's checked often. For example, a thousand game state queries checked each update tick means sixty thousand condition evaluations per second. On the other hand, game state queries are faster in cases where the conditions are checked rarely and doing so avoids reloading textures or maps (like <samp>Appearance</samp> in <samp>Data/Characters</samp> or <samp>Music</samp> in <samp>Data/Locations</samp>).
    
==Built-in queries==
 
==Built-in queries==
Line 40: Line 38:  
Here's an example.
 
Here's an example.
   −
<pre> "ANY \"LOCATION_NAME BathHouse_Pool\" \"LOCATION_NAME BathHouse_MensLocker\" \"LOCATION_NAME BathHouse_WomensLocker\" \"LOCATION_NAME Beach, WEATHER Sun Wind, SEASON Summer\" \"EVENT_ID festival_summer5, {{HasMod|contains=spacechase0.SurfingFestival}}\""</pre>
+
<pre> "ANY \"LOCATION_NAME Here BathHouse_Pool\" \"LOCATION_NAME Here BathHouse_MensLocker\" \"LOCATION_NAME Here BathHouse_WomensLocker\" \"LOCATION_NAME Here Beach, WEATHER Sun Wind, SEASON Summer\" \"IS_EVENT festival_summer5, {{HasMod|contains=spacechase0.SurfingFestival}}\""</pre>
    
Broken down, this means:
 
Broken down, this means:
Line 65: Line 63:  
| 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.
 
| 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>
+
| <samp>IS_FESTIVAL_DAY {{o|location context}} {{o|day offset}}</samp>
 
| Whether there's a festival today, with an optional {{o|day offset}} (e.g. 1 for tomorrow).
 
| Whether there's a festival today, with an optional {{o|day offset}} (e.g. 1 for tomorrow).
 +
 +
The {{o|location context}} (default <samp>Any</samp>) must be one of these values:
 +
{| class="wikitable"
 +
|-
 +
! value
 +
! effect
 +
|-
 +
| <samp>Any</samp>
 +
| Check for a festival anywhere.
 +
|-
 +
| <samp>Here</samp>
 +
| Check for a festival in the location context containing the player.
 +
|-
 +
| <samp>Target</samp>
 +
| Check for a festival in the location context containing [[#Target location|the target location]].
 +
|-
 +
| ''any other''
 +
| Check for a festival in the given location context ID.
 +
|}
 
|-
 
|-
 
| <samp>IS_PASSIVE_FESTIVAL_OPEN {{t|id}}</samp>
 
| <samp>IS_PASSIVE_FESTIVAL_OPEN {{t|id}}</samp>
Line 93: Line 110:  
! effect
 
! effect
 
|-
 
|-
| <samp>EVENT_ID {{t|event ID}}+</samp>
+
| <samp>IS_EVENT</samp>
| Whether one of the given [[Modding:Event data|event]] IDs are currently playing.
+
| Whether the player is viewing any [[Modding:Event data|event]] or attending any active festival. This doesn't cover passive festivals like the [[Night Market]].
 
+
|-
This also works for non-passive festivals, which have IDs in the form <samp>festival_{{t|season}}{{t|day}}</samp>. For example, <samp>festival_spring13</samp> for the [[Egg Festival]].
+
| <samp>IS_EVENT {{t|event ID}}+</samp>
 +
| Whether the player is viewing an [[Modding:Event data|event]] or attending an active festival whose ID matches one of the specified {{t|event ID}} values. Festivals have IDs in the form <samp>festival_{{t|season}}{{t|day}}</samp> (like <samp>festival_spring13</samp> for the [[Egg Festival]]).
 
|}
 
|}
   Line 125: Line 143:  
| Whether there are fewer of the given building constructed than there are cabins.
 
| Whether there are fewer of the given building constructed than there are cabins.
 
|-
 
|-
| <samp>FARM_CAVE {{t|type}}</samp>
+
| <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>).
 
| The current [[The Farm#The Cave|farm cave]] (one of <samp>Bats</samp>, <samp>Mushrooms</samp>, or <samp>None</samp>).
 
|-
 
|-
Line 131: Line 149:  
| The name of the farm.
 
| The name of the farm.
 
|-
 
|-
| <samp>FARM_TYPE {{t|type}}</samp>
+
| <samp>FARM_TYPE {{t|type}}+</samp>
 
| The [[Farm Maps|farm type]]. The {{t|type}} can be one of...
 
| 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 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);
Line 139: Line 157:  
| <samp>FOUND_ALL_LOST_BOOKS</samp>
 
| <samp>FOUND_ALL_LOST_BOOKS</samp>
 
| Whether all the [[Lost Books]] for the [[museum]] have been found.
 
| Whether all the [[Lost Books]] for the [[museum]] have been found.
 +
|-
 +
| <samp>HAS_TARGET_LOCATION</samp>
 +
| Whether the [[#Target location|'<samp>Target</samp>' location]] is explicitly set for the current context (ignoring the fallback to the current player's location).
 
|-
 
|-
 
| <samp>IS_COMMUNITY_CENTER_COMPLETE</samp>
 
| <samp>IS_COMMUNITY_CENTER_COMPLETE</samp>
Line 164: Line 185:  
| 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.
 
| 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>
+
| <samp>LOCATION_CONTEXT {{t|location}} {{t|context ID}}+</samp>
| The location context name for the [[#Target location|given location]].
+
| The location context ID for the [[#Target location|given location]].
 +
|-
 +
| <samp>LOCATION_HAS_CUSTOM_FIELD {{t|location}} {{t|key}} {{o|value}}</samp>
 +
| Checks to see if the location has a given value in its CustomFields. If the value is omitted, checks to see if the key exists at all.
 
|-
 
|-
 
| <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>
 
| <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>
Line 234: Line 258:  
| 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.
 
| 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>
+
| <samp>WORLD_STATE_ID {{t|id}}+</samp>
| Whether any world state flag with the given {{t|id}} is set.
+
| Whether any world state flag matching the given {{t|id}} values is set.
 
|}
 
|}
   Line 264: Line 288:  
| <samp>PLAYER_HAS_ALL_ACHIEVEMENTS {{t|player}}</samp>
 
| <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.
 
| 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_BUFF {{t|player}} {{t|id}}</samp>
 +
| Whether the [[#Target player|specified player(s)]] have a given buff ID currently applied.
 
|-
 
|-
 
| <samp>PLAYER_HAS_CAUGHT_FISH {{t|player}} {{t|id}}</samp>
 
| <samp>PLAYER_HAS_CAUGHT_FISH {{t|player}} {{t|id}}</samp>
Line 271: Line 298:  
| Whether the [[#Target player|specified player(s)]] have a [[Modding:Dialogue#Conversation topics|conversation topic]] with the ID {{t|id}} active.
 
| 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>
+
| <samp>PLAYER_HAS_COOKING_RECIPE {{t|player}} {{t|recipe name}}</samp><br /><samp>PLAYER_HAS_CRAFTING_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>.
 
| 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>.
 
|-
 
|-
Line 277: Line 304:  
| Whether the [[#Target player|specified player(s)]] have chosen the given dialogue answer in a previous dialogue.
 
| 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>
+
| <samp>PLAYER_HAS_HEARD_SONG {{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}}).
+
| Whether the [[#Target player|specified player(s)]] have heard a song track's cue name (e.g. for the [[jukebox]] track selection).
 
|-
 
|-
 
| <samp>PLAYER_HAS_ITEM {{t|player}} {{t|item}} {{o|min}} {{o|max}}</samp>
 
| <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 [[Modding:Migrate to Stardew Valley 1.6#Custom items|qualified or unqualified item ID]].
+
| 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 [[Modding:Common data field types#Item ID|qualified or unqualified item ID]].
 +
|-
 +
| <samp>PLAYER_HAS_MAIL {{t|player}} {{t|mail id}} {{o|type}}</samp>
 +
| Whether the [[#Target player|specified player(s)]] have the given [[Modding:Mail data|mail flag]] set.
 +
 
 +
The {{o|type}} (default <samp>Any</samp>) can be one of:
 +
{| class="wikitable"
 +
|-
 +
! type
 +
! effect
 +
|-
 +
| <samp>Any</samp>
 +
| Mail in [[The Farm#Mailbox|the mailbox]], in the queue for tomorrow's mailbox, or already received.
 +
|-
 +
| <samp>Mailbox</samp>
 +
| Mail in the mailbox.
 +
|-
 +
| <samp>Tomorrow</samp>
 +
| Mail in the queue for tomorrow's mailbox.
 +
|-
 +
| <samp>Received</samp>
 +
| Mail which either:
 +
* was in the mailbox and read by the player;
 +
* or has no letter in <samp>Data/mail</samp>, so it was added to the received list directly.
 +
|}
 
|-
 
|-
 
| <samp>PLAYER_HAS_PROFESSION {{t|player}} {{t|profession id}}</samp>
 
| <samp>PLAYER_HAS_PROFESSION {{t|player}} {{t|profession id}}</samp>
 
| Whether the [[#Target player|specified player(s)]] have the given [[Skills|profession]] ID.
 
| Whether the [[#Target player|specified player(s)]] have the given [[Skills|profession]] ID.
 
|-
 
|-
| <samp>PLAYER_HAS_READ_LETTER {{t|player}} {{t|id}}</samp>
+
| <samp>PLAYER_HAS_RUN_TRIGGER_ACTION {{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>.
+
| Whether the [[#Target player|specified player(s)]] have applied the [[Modding:Trigger actions|trigger action]] with the given {{t|id}}.
 
|-
 
|-
 
| <samp>PLAYER_HAS_SECRET_NOTE {{t|player}} {{t|id}}</samp>
 
| <samp>PLAYER_HAS_SECRET_NOTE {{t|player}} {{t|id}}</samp>
Line 293: Line 344:  
|-
 
|-
 
| <samp>PLAYER_HAS_SEEN_EVENT {{t|player}} {{t|id}}</samp>
 
| <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}}.
+
| Whether the [[#Target player|specified player(s)]] have seen the event with the given {{t|id}}.
 
|-
 
|-
 
| <samp>PLAYER_HAS_TOWN_KEY {{t|player}}</samp>
 
| <samp>PLAYER_HAS_TOWN_KEY {{t|player}}</samp>
Line 304: Line 355:  
| Whether the [[#Target player|specified player(s)]] are in the given [[Modding:Migrate to Stardew Valley 1.6#Custom location contexts|location context]].
 
| Whether the [[#Target player|specified player(s)]] are in the given [[Modding:Migrate to Stardew Valley 1.6#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>
+
| <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>.
 
| 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>.
 
|-
 
|-
Line 312: Line 363:  
| <samp>PLAYER_MONEY_EARNED {{t|player}} {{t|min}} {{o|max}}</samp>
 
| <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.
 
| Whether the [[#Target player|specified player(s)]] have earned between {{t|min}} and {{o|max}} (default unlimited) gold inclusively.
 +
|-
 +
| <samp>PLAYER_MONSTERS_KILLED {{t|player}} {{t|monster name}}+ {{o|min count}} {{o|max count}}</samp>
 +
| Whether the [[#Target player|specified player(s)]] have killed the given monster(s) between {{o|min count}} (default 1) and {{o|max count}} (default unlimited) times inclusively. If you list multiple monsters, it'll check the combined count for all of them.
 +
 +
For example:
 +
<syntaxhighlight lang="js">
 +
// killed 50+ slimes, skeletons, and bugs combined
 +
PLAYER_KILLED_MONSTERS Current "Green Slime" Skeleton Bug 50
 +
</syntaxhighlight>
 
|-
 
|-
 
| <samp>PLAYER_SHIPPED_BASIC_ITEM {{t|player}} {{t|item ID}} {{o|min count}} {{o|max count}}</samp>
 
| <samp>PLAYER_SHIPPED_BASIC_ITEM {{t|player}} {{t|item ID}} {{o|min count}} {{o|max count}}</samp>
Line 387: Line 447:  
* <samp>walnutsFound</samp>;
 
* <samp>walnutsFound</samp>;
 
* <samp>weedsEliminated</samp>.
 
* <samp>weedsEliminated</samp>.
 +
|-
 +
| <samp>PLAYER_VISITED_LOCATION {{t|player}} {{t|location name}}+</samp>
 +
| Whether the [[#Target player|specified player(s)]] have visited one of the given location names. For example, <code>PLAYER_VISITED_LOCATION Current IslandWest</code> checks whether the current player has ever visited [[Ginger Island#Island West|Ginger Island West]].
 +
 +
Notes:
 +
* Some locations have both a common name (like <samp>Barn</samp>) and unique name (like <samp>Barn{unique ID}</samp>). This tracks the common name.
 +
* Generated mine and volcano dungeon levels aren't tracked.
 
|}
 
|}
   Line 394: Line 461:  
! Condition
 
! Condition
 
! effect
 
! effect
 +
|-
 +
| <samp>PLAYER_FRIENDSHIP_POINTS {{t|player}} {{t|npc}} {{t|min points}} {{o|max points}}</samp>
 +
| Whether the [[#Target player|specified player(s)]] have a friend with [[friendship|friendship points]] between {{t|min points}} and {{o|max points}} (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).
 +
 +
For example, this checks if the current player has 750 or more points (i.e. 3+ hearts) with Abigail:
 +
<pre>PLAYER_FRIENDSHIP_POINTS Current Abigail 750</pre>
 
|-
 
|-
 
| <samp>PLAYER_HAS_CHILDREN {{t|player}} {{o|min}} {{o|max}}</samp>
 
| <samp>PLAYER_HAS_CHILDREN {{t|player}} {{o|min}} {{o|max}}</samp>
Line 407: Line 480:  
<pre>PLAYER_HEARTS Current Abigail 3</pre>
 
<pre>PLAYER_HEARTS Current Abigail 3</pre>
 
|-
 
|-
| <samp>PLAYER_HAS_MET {{t|player}} {{t|npc}}</samp>
+
| <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.
+
| Whether the [[#Target player|specified player(s)]] have talked to one of the given NPCs at least once. The {{t|npc}} is an NPC's internal name.
 +
|-
 +
| <samp>PLAYER_NPC_RELATIONSHIP {{t|player}} {{t|npc}} {{t|type}}+</samp>
 +
| Whether the [[#Target player|specified player(s)]] have one of the relationship statuses with an NPC. The {{t|npc}} can be an NPC's internal name or <samp>Any</samp> (match any NPC).
 +
 
 +
{{t|type}} can be any combination of these values:
 +
{| class="wikitable"
 +
|-
 +
! type
 +
! effect
 +
|-
 +
| <samp>Friendly</samp>
 +
| Met the NPC, but no other status applies.
 +
|-
 +
| <samp>Roommate</samp>
 +
| The NPC has moved in with the player as a roommate.
 +
|-
 +
| <samp>Dating</samp>
 +
| The player has given a [[bouquet]] to the NPC, but haven't yet given them a [[Mermaid's Pendant|mermaid's pendant]].
 +
|-
 +
| <samp>Engaged</samp>
 +
| The player has given a [[Mermaid's Pendant|mermaid's pendant]] to the NPC, but the marriage hasn't happened yet.
 +
|-
 +
| <samp>Married</samp>
 +
| The NPC has moved in with the player as a spouse.
 +
|-
 +
| <samp>Divorced</samp>
 +
| The player has dissolved their marriage with the NPC.
 +
|}
 +
|-
 +
| <samp>PLAYER_PLAYER_RELATIONSHIP {{t|player}} {{t|other player}} {{t|type}}+</samp>
 +
| Whether the [[#Target player|specified player(s)]] have one of the relationship types with the other specified player(s). The {{t|other player}} can be a [[#Target player|target player]] or <samp>Any</samp> (match any player).
 +
 
 +
{{t|type}} can be any combination of these values:
 +
{| class="wikitable"
 
|-
 
|-
| <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>
+
! type
| 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).
+
! effect
 
|-
 
|-
| <samp>PLAYER_IS_ROOMMATE {{t|player}} {{t|target}}</samp>
+
| <samp>Friendly</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).
+
| No other status applies.
 +
|-
 +
| <samp>Engaged</samp>
 +
| One of the players has given a [[Wedding Ring|wedding ring]] to the other, but the marriage hasn't happened yet.
 +
|-
 +
| <samp>Married</samp>
 +
| The players are married.
 +
|}
 
|-
 
|-
| <samp>PLAYER_PREFERRED_PET {{t|player}} {{t|pet}}</samp>
+
| <samp>PLAYER_PREFERRED_PET {{t|player}} {{t|pet type}}+</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.
+
| Whether the preferred pet for the [[#Target player|specified player(s)]] is one of the given types. The vanilla pet types are <samp>Cat</samp> and <samp>Dog</samp>.
 
|}
 
|}
   Line 429: Line 543:  
| 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.
 
| 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.
+
If the exact text <samp>@addDailyLuck</samp> is specified, the current player's daily [[luck]] is added to the probability.
 
|-
 
|-
 
| <samp>SYNCED_CHOICE {{t|interval}} {{t|key}} {{t|min}} {{t|max}} {{t|choices}}+</samp>
 
| <samp>SYNCED_CHOICE {{t|interval}} {{t|key}} {{t|min}} {{t|max}} {{t|choices}}+</samp>
Line 443: Line 557:  
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.
 
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.
+
If the exact text <samp>@addDailyLuck</samp> is specified, the current player's daily [[luck]] is added to the probability.
 
|-
 
|-
 
| <samp>SYNCED_SUMMER_RAIN_RANDOM {{t|base chance}} {{t|day multiplier}}</samp>
 
| <samp>SYNCED_SUMMER_RAIN_RANDOM {{t|base chance}} {{t|day multiplier}}</samp>
Line 470: Line 584:  
|-
 
|-
 
| <samp>ITEM_ID {{t|target}} {{t|item ID}}+</samp>
 
| <samp>ITEM_ID {{t|target}} {{t|item ID}}+</samp>
| Whether the item has one of the given [[Modding:Migrate to Stardew Valley 1.6#Custom items|qualified or unqualified item IDs]].
+
| Whether the item has one of the given [[Modding:Common data field types#Item ID|qualified or unqualified item IDs]].
 
|-
 
|-
 
| <samp>ITEM_ID_PREFIX {{t|target}} {{t|prefix}}</samp>
 
| <samp>ITEM_ID_PREFIX {{t|target}} {{t|prefix}}</samp>
| Whether the item's [[Modding:Migrate to Stardew Valley 1.6#Custom items|qualified or unqualified item ID]] starts with the given prefix.
+
| Whether the item's [[Modding:Common data field types#Item ID|qualified or unqualified item ID]] starts with the given prefix.
 
|-
 
|-
 
| <samp>ITEM_NUMERIC_ID {{t|target}} {{o|min}} {{o|max}}</samp>
 
| <samp>ITEM_NUMERIC_ID {{t|target}} {{o|min}} {{o|max}}</samp>
| Whether the item has a numeric [[Modding:Migrate to Stardew Valley 1.6#Custom items|unqualified item ID]] which is between {{o|min}} and {{o|max}} (both defaulting to the lowest and highest possible value).
+
| Whether the item has a numeric [[Modding:Common data field types#Item ID|unqualified item ID]] which is between {{o|min}} and {{o|max}} (both defaulting to the lowest and highest possible value).
 
|-
 
|-
 
| <samp>ITEM_OBJECT_TYPE {{t|target}} {{t|type}}+</samp>
 
| <samp>ITEM_OBJECT_TYPE {{t|target}} {{t|type}}+</samp>
Line 482: Line 596:  
|-
 
|-
 
| <samp>ITEM_PRICE {{t|target}} {{t|min}} {{o|max}}</samp>
 
| <samp>ITEM_PRICE {{t|target}} {{t|min}} {{o|max}}</samp>
| Whether the item has a sell-to-shop price between {{t|min}} and {{o|max}} (default highest possible value).
+
| Whether the item has a purchase-from-shop price between {{t|min}} and {{o|max}} (default highest possible value).
 
|-
 
|-
 
| <samp>ITEM_QUALITY {{t|target}} {{t|min}} {{o|max}}</samp>
 
| <samp>ITEM_QUALITY {{t|target}} {{t|min}} {{o|max}}</samp>
Line 491: Line 605:  
|-
 
|-
 
| <samp>ITEM_TYPE {{t|target}} {{t|type}}+</samp>
 
| <samp>ITEM_TYPE {{t|target}} {{t|type}}+</samp>
| Whether the [[Modding:Migrate to Stardew Valley 1.6#Custom items|item's type definition ID]] matches one of the given values. For example, <samp>ITEM_TYPE Target (BC)</samp> matches bigcraftables.
+
| Whether the [[Modding:Common data field types#Item ID|item's type definition ID]] matches one of the given values. For example, <samp>ITEM_TYPE Target (BC)</samp> matches bigcraftables.
 
|-
 
|-
 
| <samp>ITEM_HAS_EXPLICIT_OBJECT_CATEGORY {{t|target}}</samp>
 
| <samp>ITEM_HAS_EXPLICIT_OBJECT_CATEGORY {{t|target}}</samp>
Line 578: Line 692:  
==For C# mod authors==
 
==For C# mod authors==
 
===Using queries elsewhere===
 
===Using queries elsewhere===
C# code can use the <samp>GameStateQuery</samp> class to work with queries, like <code>GameStateQuery.CheckConditions(query)</code>.
+
C# code can work with queries using the <samp>GameStateQuery</samp> class, which provides utility methods like <code>GameStateQuery.CheckConditions(query)</code> or <code>GameStateQuery.IsImmutablyTrue(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>.
+
You can also use game state queries in [[Modding:Event data|event preconditions]] using the new precondition flag, like <code>some_event_id/gameStateQuery !SEASON Spring, WEATHER Here Sun</code>.
    
===Extensibility===
 
===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, custom query names should apply the [[Modding:Modder Guide/Game Fundamentals#Unique string IDs|unique string ID]] conventions.
+
C# mods can...
 +
* check if a query exists using <code>GameStateQuery.Exists("Example.ModId_ConditionName")</code>;
 +
* define custom queries using <code>GameStateQuery.Register("Example.ModId_ConditionName", handleQueryMethod)</code> (using a [[Modding:Common data field types#Unique string ID|unique string ID]] for the query name);
 +
* and add query aliases using <code>GameStateQuery.RegisterAlias("Example.ModId_AliasName", "Example.ModId_ConditionName")</code> (ideally using a [[Modding:Common data field types#Unique string ID|unique string ID]] for the alias).
    
[[Category:Modding]]
 
[[Category:Modding]]
29

edits