Changes

→‎What's new for everything else: split dialogue & event changes into their own section
Line 3,936: Line 3,936:  
If you're using [[Modding:Content Patcher|Content Patcher]], you can use its tokens anywhere in the string (including within square brackets); they'll be expanded before the game parses the string. For example, <code><nowiki>"{{Spouse}} would love [ArticleFor [SuggestedItem]] [SuggestedItem]!"</nowiki></code> would output something like "''Alexa would love an Apple!''".
 
If you're using [[Modding:Content Patcher|Content Patcher]], you can use its tokens anywhere in the string (including within square brackets); they'll be expanded before the game parses the string. For example, <code><nowiki>"{{Spouse}} would love [ArticleFor [SuggestedItem]] [SuggestedItem]!"</nowiki></code> would output something like "''Alexa would love an Apple!''".
   −
===String event & response IDs===
+
===Dialogue changes===
[[Modding:Event data|Event IDs]] and [[Modding:Dialogue#Response IDs|dialogue response IDs]] are now strings, so mods can use a unique key like <samp>Example.ModId_EventName</samp> (instead of hoping no other mod uses the same number). Prefixing the mod ID is recommended to simplify troubleshooting and avoid conflicts. For best compatibility, custom IDs should only contain alphanumeric/underscore/dot characters.
  −
 
  −
===New C# utility methods===
  −
Stardew Valley 1.6 adds several new methods to the <samp>Utility</samp> class. Here are some of the most useful ones for mods:
  −
 
  −
{| class="wikitable"
  −
|-
  −
! method
  −
! effect
  −
|-
  −
| <samp>GetDataAtIndex</samp><br /><samp>GetIntAtIndex</samp><br /><samp>GetFloatAtIndex</samp><br /><samp>GetStringAtIndex</samp>
  −
| Parse a value from an array with optional field indexes.
  −
 
  −
For example, code like this:
  −
 
  −
<syntaxhighlight lang="c#">
  −
string[] rawEffects = fields.Length > Object.objectInfoBuffTypesIndex && fields[Object.objectInfoBuffTypesIndex].Length > 0
  −
    ? fields[Object.objectInfoBuffTypesIndex].Split(' ')
  −
    : new string[0];
  −
 
  −
int farming = rawEffects.Length > Buffs.farming && int.TryParse(rawEffects[Buffs.farming], out int _farming)
  −
    ? _farming
  −
    : 0;
  −
</syntaxhighlight>
  −
 
  −
Can now be rewritten like this:
  −
 
  −
<syntaxhighlight lang="c#">
  −
string[] rawEffects = Utility.GetDataAtIndex(fields, Object.objectInfoBuffTypesIndex, "").Split(' ');
  −
int farming = Utility.GetIntAtIndex(rawEffects, Buffs.farming);
  −
</syntaxhighlight>
  −
|-
  −
| <samp>GetItemDataForItemID</samp>
  −
| Get metadata about a given [[#Custom items|item ID]] like its display name, description, spritesheet index & source rectangle, etc.
  −
|-
  −
| <samp>GetDescriptionForItemID</samp><br /><samp>GetDisplayNameForItemID</samp><br /><samp>GetSourceRectForItemID</samp><br /><samp>GetTextureForItemID</samp><br /><samp>GetParentSheetIndexForItemID</samp>
  −
| Get specific details about a given [[#Custom items|item ID]] from <samp>GetItemDataForItemID</samp>.
  −
|-
  −
| <samp>StringToDirection</samp>
  −
| Converts a string direction (one of <samp>down</samp>, <samp>left</samp>, <samp>right</samp>, or <samp>up</samp>) into a direction code recognized by various game methods (''i.e.'' <samp>Game1.down</samp>, etc). If the string contains a number, the numeric value is returned (even if it's not a valid direction). If it's any other unrecognized value, the method returns -1.
  −
|}
  −
 
  −
===Other changes===
   
<ul>
 
<ul>
<li>Added new [[Modding:Console commands|debug commands]]:
  −
{| class="wikitable"
  −
|-
  −
! command
  −
! description
  −
|-
  −
| <samp>bsm</samp>
  −
| If the player is standing right under a building, open a menu to change the building appearance.
  −
|-
  −
| <samp>testwedding</samp>
  −
| Immediately play the [[Marriage#The Wedding|wedding]] event.
  −
|-
  −
| <samp>qualifiedid</samp>
  −
| Print the held item's display name and [[#Custom items|qualified item ID]].
  −
|}</li>
   
<li>Added new [[Modding:Dialogue|dialogue]] commands:
 
<li>Added new [[Modding:Dialogue|dialogue]] commands:
 
{| class="wikitable"
 
{| class="wikitable"
Line 4,015: Line 3,957:  
|}
 
|}
 
</li>
 
</li>
 +
<li>[[Modding:Dialogue#Response IDs|Dialogue response IDs]] are now strings, so mods can use a unique key like <samp>Example.ModId_ResponseName</samp> (instead of hoping no other mod uses the same number). Prefixing the mod ID is recommended to simplify troubleshooting and avoid conflicts. For best compatibility, custom IDs should only contain alphanumeric/underscore/dot characters.</li>
 +
<li>Unknown [[Modding:Dialogue|dialogue]] commands starting with <samp>$</samp> are no longer parsed as a portrait number if they're not numeric.</li>
 +
</ul>
 +
 +
===Event changes===
 +
<ul>
 +
<li>[[Modding:Event data|Event IDs]] are now strings, so mods can use a unique key like <samp>Example.ModId_EventName</samp> (instead of hoping no other mod uses the same number). Prefixing the mod ID is recommended to simplify troubleshooting and avoid conflicts. For best compatibility, custom IDs should only contain alphanumeric/underscore/dot characters.</li>
 
<li>Added new [[Modding:Event data|event]] commands:
 
<li>Added new [[Modding:Event data|event]] commands:
 
{| class="wikitable"
 
{| class="wikitable"
Line 4,096: Line 4,045:  
|}
 
|}
 
</li>
 
</li>
<li>Unknown [[Modding:Dialogue|dialogue]] commands starting with <samp>$</samp> are no longer parsed as a portrait number if they're not numeric.</li>
+
</ul>
 +
 
 +
===New C# utility methods===
 +
Stardew Valley 1.6 adds several new methods to the <samp>Utility</samp> class. Here are some of the most useful ones for mods:
 +
 
 +
{| class="wikitable"
 +
|-
 +
! method
 +
! effect
 +
|-
 +
| <samp>GetDataAtIndex</samp><br /><samp>GetIntAtIndex</samp><br /><samp>GetFloatAtIndex</samp><br /><samp>GetStringAtIndex</samp>
 +
| Parse a value from an array with optional field indexes.
 +
 
 +
For example, code like this:
 +
 
 +
<syntaxhighlight lang="c#">
 +
string[] rawEffects = fields.Length > Object.objectInfoBuffTypesIndex && fields[Object.objectInfoBuffTypesIndex].Length > 0
 +
    ? fields[Object.objectInfoBuffTypesIndex].Split(' ')
 +
    : new string[0];
 +
 
 +
int farming = rawEffects.Length > Buffs.farming && int.TryParse(rawEffects[Buffs.farming], out int _farming)
 +
    ? _farming
 +
    : 0;
 +
</syntaxhighlight>
 +
 
 +
Can now be rewritten like this:
 +
 
 +
<syntaxhighlight lang="c#">
 +
string[] rawEffects = Utility.GetDataAtIndex(fields, Object.objectInfoBuffTypesIndex, "").Split(' ');
 +
int farming = Utility.GetIntAtIndex(rawEffects, Buffs.farming);
 +
</syntaxhighlight>
 +
|-
 +
| <samp>GetItemDataForItemID</samp>
 +
| Get metadata about a given [[#Custom items|item ID]] like its display name, description, spritesheet index & source rectangle, etc.
 +
|-
 +
| <samp>GetDescriptionForItemID</samp><br /><samp>GetDisplayNameForItemID</samp><br /><samp>GetSourceRectForItemID</samp><br /><samp>GetTextureForItemID</samp><br /><samp>GetParentSheetIndexForItemID</samp>
 +
| Get specific details about a given [[#Custom items|item ID]] from <samp>GetItemDataForItemID</samp>.
 +
|-
 +
| <samp>StringToDirection</samp>
 +
| Converts a string direction (one of <samp>down</samp>, <samp>left</samp>, <samp>right</samp>, or <samp>up</samp>) into a direction code recognized by various game methods (''i.e.'' <samp>Game1.down</samp>, etc). If the string contains a number, the numeric value is returned (even if it's not a valid direction). If it's any other unrecognized value, the method returns -1.
 +
|}
 +
 
 +
===Other changes===
 +
<ul>
 +
<li>Added new [[Modding:Console commands|debug commands]]:
 +
{| class="wikitable"
 +
|-
 +
! command
 +
! description
 +
|-
 +
| <samp>bsm</samp>
 +
| If the player is standing right under a building, open a menu to change the building appearance.
 +
|-
 +
| <samp>testwedding</samp>
 +
| Immediately play the [[Marriage#The Wedding|wedding]] event.
 +
|-
 +
| <samp>qualifiedid</samp>
 +
| Print the held item's display name and [[#Custom items|qualified item ID]].
 +
|}</li>
 
<li>Fixed <samp>ebi</samp> [[Modding:Console commands|debug command]] not playing events correctly if called from the same location as the event.</li>
 
<li>Fixed <samp>ebi</samp> [[Modding:Console commands|debug command]] not playing events correctly if called from the same location as the event.</li>
 
<li>Added <samp>silence</samp> [[Modding:Audio|audio cue]]. This is different from <samp>none</samp> in that it suppresses both town music and ambient sounds.</li>
 
<li>Added <samp>silence</samp> [[Modding:Audio|audio cue]]. This is different from <samp>none</samp> in that it suppresses both town music and ambient sounds.</li>
translators
8,447

edits