#making-mods-general
1 messages ยท Page 202 of 1
Yeah it's fine
I've actually been meaning to ask Pathos how things like MEEP, MMAP etc. could be counted in the mod stats... because as far as I understand it, they won't be counted currently because they don't technically have content packs for them?
My thought was an extra dependency field sort of.
But i was hoping to add dependencies to logs
So that when u get someone's log it's clear which mods r use ur framework and dying
Perhaps it would be a thing a C# mod opt in to having
Hey imma just bounce this since youre here now, I'm trying to separate the game logic from your mod's features
Oh i didn't see the ping
yeah... I'm not sure what to do about this
If you take a look at Chest.cs you can see that the game normally passes a different highlight function to itemgrabmenu
I am pass a custom one
But u can use the game built-in one if u want
Not sure if this is what u r asking
Well I pretty much just need vanilla chest or maybe like fishing treasure behavior so yeah, I didn't think about looking how the game handles it for some reason I am having major brain lags lately
Do you want just a dropped item kind of chest? Can take out but not put in
Yeah that's actually exactly what I want
The point being that an npc can accumulate items that then the player can get from them
So you can continue to keep items in global inventory, but then to give them to player you can use Farmer.addItemsByMenuIfNecessary
In summary
- generate and store inventoryId somewhere
- Game1.player.team.GetOrCreateGlobalInventory(inventoryId)
- When interact to get items, use Farmer.addItemsByMenuIfNecessary
You can opt to use a ItemGrabMenu (don't need the custom subclass i had) with a highlight function that always return false but u need to then implement add item receive item
alright thanks 
do any of you people who know things about the game know why a relatively small subclass of DialogueBox might be eating the mouse cursor
mouseCursorTransparency is 1f which I think means opaque 
if i were in charge, 1f in Transparency would be fully transparent, and 1f in Opacity would be opaque. but it's stardew so who knows /lh
try 0f or 0.5f and see what happens?
I think if u don't restore prev menu properly u lose hud and mouse
hud is still there though 
everything but mouse is fine
wait improvement, okay, we have a mouse it's just under the dialoguebox now
now I need to figure out why it came back when I did the hacky thing I did
if it's this simple I'm going to be as annoyed as I am relieved,,,
god dammit 
if anybody from the future is searching for answers and finds this, I fixed it by adding the this.drawMouse(b) call I was missing from the end of the original draw method 
oh, that would do it, yeah
works perfectly now!
hmmm I just tested sending myself a letter item and it just disappeared when opening and doesn't appear in collections.
do you want a letter (with text) or a flag?
if you want a letter you need to have the entry in data/mails too
Yeah so I just realized I moved my data\mail stuff to an include file, but then didn't actually, you know, include it
is the pronunciation guide part of the joke, or
Dedugging
pretty sure the person who made that didn't notice
bleak
No, it's adding thr word "duh" in the middle
deging?
No, I believe the joke is as atra said - debugging, with duh in the middle, for when you find the bug that makes you go "oh, duh!"
maybe it's a mix of debugging and deducing
ik, I was also making a joke, albeit a bad one ๐
Which sites did you want update keys for?
can anyone tell me why i18n is only targeting the default.json for allowedValues in my config (GMCM)?
https://postimg.cc/gxtcq8xk
https://github.com/notsemisu/VibrantPastoral.C/blob/master/VibrantPastoral/ModEntry.cs
allowedValues: new string[] { i18n.Get("config.Water.values.transparent"), i18n.Get("config.Water.values.semi"), i18n.Get("config.Water.values.opaque") }one of the two lines in question
maybe I messed up the config setup, could be, I don't know what I'm doing half the time
allowedValues has the actual values that will be saved to the config.json file. You should use the formatAllowedValue argument instead to convert the saved values to translated display text.
oh
Does any event fire when quitting the game, as opposed to returning to title screen?
You can implement IDisposable on your mod entry class, and SMAPI will call it when exiting normally. That won't always be called though, depending on how the exit happens.
Yes, I imagine killing the process directly or Ctrl-C from console might not run any disposes/finalizers. Less clear on exiting from the game's main menu (exit tab), or Alt-F4.
It's the latter two "normie exits" I'm interested in.
I just want to keep some HUD state persistent between game runs and would rather not have to write to a file every time it's changed.
it looks like you could monitor Game1.quit or possibly TitleMenu.quitTimer for the exit button press, but I doubt that covers alt-f4 exits
the title menu counts down there, sets Game1.quit to true, and then the next update method call shuts it down, from the look of it
Surprisingly, overriding Dispose actually does seem to work for Alt+F4.
Does it work if you just hit the power button on your PC?
Very funny.
I think if you just press it and don't cut power instantly, it should 
it's been ages since I tested all that, though
windows at least used to try and shut stuff down normally before force-closing after a delay
Yeah, ACPI and all. I only press the power button to turn on my PC, not off.
advancedMove is the bane of my existence. I don't understand how the command differentiates between durations and x y coordinates.
advancedMove farmer false 0 -3 0 1000
-- this is supposed to move the farmer 3 tiles up, have them facing up when they get there and pause for 1000 ms. But the game interprets the 1000 as another y coordinate.
You mean you don't just pull the power cord to shut off your PC?
I can't even reach the power cord, it's all in various enclosures and conduits.
I could power off the UPS, maybe. But I won't.
Pour water on it. That will absolutely shut it off
Nah, it's water cooled, so pouring water on would actually make it run better.
(not really)
The code can tell the difference between a move command and a pause command because a move command must have 0 for either x or y. A pause command must have non-zero numbers for both numbers in the pair.
https://stardewvalleywiki.com/Modding:Event_data
The 0 is what causes it to interpret the last pair as x y
what matt said. for facing you have to use 4 to face up instead of 0
Incidentally, does anyone else see the "sweat sip" emoji as pufferchick flipping you the bird? I try not to, but that's what it looks like to me every single time.
Ooooooohhhhhhh
xD
I read it as fear
I feel like there's an explanation for this that relates to each of our psyches.
Alright, going back to debug this blasted event again. Thanks all
Please at this point I'm already paranoid
Flip bird
Thumbs up would need to have the thumb pixels moved outwards slightly
They can't be exactly in the middle

If I don't notice the sleeve/arm or whatever. This looks like flipping off to me every time.
Don't get me wrong, gramps in sunglasses, flipping the bird as he ascends back to the heavens is a vibe
Gramps Out!
"So long, muthafuckas!"
Btw, does the "breathing" flag in addTemporaryActor actually do anything if the sprite sheet doesn't support it? Will the sprite bounce up and down a little or something?
Or does "breathing" mean something else entirely?
Hah, I never actually noticed either one of those in the game, but looking at the sprite itself, definitely a birdie.
Can I use this to have a Special Order where you have to deliver a Big Craftable, among other non-Object items?
o/ 6480 good afternoon
A rectangle on the spritesheet gets inflated and deflated
NPCs have some data fields to determine how the breathing rectangle is selected but i don't know if temporary actors have access to that
since addTemporaryActor uses the internal NPC/monster/animal name to assign the character, I'd assume it uses the breathrect field associated with that internal NPC name for a character (or the default if unset), but I could absolutely be wrong about that.
hey guys i cant find it right now, so how would i add a fruit tree to a custom map?
https://stardewvalleywiki.com/Modding:Fruit_trees scroll to bottom for how to do the map tiles
Thanks for the "breathing" info. I might test to see if I can do something funky with it now, like make a custom critter sprite jitter around
Also, I got my advancedMoves working correctly! ๐
hii I have been going down a rabbit hole of trying to add a buff to an artisan good that removes all debuffs. I've looked into buff frameworks and it might be an option but I came across the odd squid ink ravioli buff and i see that it temporarily prevents debuffs for like a few minutes. I think this would work just fine for my purposes, but i am still not sure how to add this buff to the food item because as far as i know i can only play with the "custom attributes" field when adding buffs to an artisan good
Can you define "artisan good"
it has the category of -26 designating it as an artisan good, but is also edible
All cooking is object so you can put the squid in ravioli buff on something else
I don't recall the type mattering here
my item isn't considered a cooking item is my problem
well
im looking at the wiki and
Machines can produce cooking item
thanks
can I add it by using BuffId?
the buffs section of the object modding wiki is only showing me stuff like buffid and custom attributes
I don't have it open but unpack the game content and check squid ink ravioli's entry in Data/Objects
I guess i am able to add immunity with custom attributes it just wasnt specified in the modding objects wiki page
well that makes everything easier
I'm checking out this page https://stardewmodding.wiki.gg/wiki/Tutorial:_Sending_a_Letter_(Content_Patcher) for sending letters but I'm a bit confused on the conditions. I want to use ccVault for one of my letters but it looks like each condition needs a letter indicating it but I'm not sure what that would be for flags. Does anyone know of a list or anything that'll tell me all those?
It's really, really, really easy to send a letter in Stardew Valley thanks to Content Patcher. In fact, it's so easy it's usually just bundled into the information about events, and it's hard to find a mod that just sends mail - usually the letters are part of a mod for more dialog, events, getting recipes, new NPCs, etc. But today, we're going ...
Run that by us again?
I followed what you were saying up until after the c c vault thing
Sorry itd probably help if I knew the names for these things lol. Basically, the line for choosing when to send a letter seems to look like this
"012344667/r .3/d Mon Tue Wed Thu Fri/x junk_mail_1": "null",
The r and d seem to indicate what kind of condition you are defining. I want to use the flag ccVault to send this mail, but I don't know what letter should come before it to indicate a flag condition. Does that make more sense?
I could assume f but I feel like that's a bad way to go about it lol
So I have a hilarious (to me) idea that I may implement in a future version of my jail mod, which is to define some crimes the farmer may be guilty of (such as giving beer to children, etc) flag those crimes, and use NPCVisibleHere to make it so the farmer gets thrown in jail for the day if they enter a location where either of my cops are in their current schedule.
I would probably disable that by default though since it could mess up your day if you didn't feel like playing cops and robbers
GTA Star system where they're just hilariously chasing you around the map more and more aggressively ๐
I probably would also want to think about crimes that could actually benefit the farmer if they manage not to get caught. Let them steal seeds from Pierre or something lols
Oh fr??? Okay so you just do the conditions delimited by slashes then?
No, mail should be sent by triggeractions now
And event conditions should be something like LocalMail - full precondition names
Yep. Mind linking the old guide you were using so we know what to fix/avoid?
Yeah its the one I linked above: https://stardewmodding.wiki.gg/wiki/Tutorial:_Sending_a_Letter_(Content_Patcher)
It's really, really, really easy to send a letter in Stardew Valley thanks to Content Patcher. In fact, it's so easy it's usually just bundled into the information about events, and it's hard to find a mod that just sends mail - usually the letters are part of a mod for more dialog, events, getting recipes, new NPCs, etc. But today, we're going ...
Do you have a link to something up to date for mail?
Everything else I found was using Mail Framework mod which id prefer to avoid since I need like 2 mails total
Oh boy. Guide wise I don't know, example wise see Part of a Saloon Breakfast
Tia, others, if you're around
1.6 triggers for mail guide?
Gotcha, I'll download some stuff and see if I can figure it out. Thanks for the help!
This isn't a comprehensive guide, but an example from my mod:
//If player has 3+ hearts with Sebastian the day before Maru's birthday, Seb will send the player a letter with a gift for Maru
"{{ModId}}_MaruBday": {
"Id": "{{ModId}}_MaruBday",
"Trigger": "DayStarted",
"Condition": "!PLAYER_HAS_MAIL Current {{ModId}}_SebInvisible, PLAYER_FRIENDSHIP_POINTS Current Sebastian 750, !PLAYER_NPC_RELATIONSHIP Current Sebastian Married, SEASON_DAY Summer 9",
"Actions": [
"AddMail Current {{ModId}}_Letter_MaruGift Now",
]
},
```
You can see how I'm chaining conditions together in the trigger action "Condition" field, then sending an actual letter. The naming convention {{ModId}}_Letter_whatever is just something I'm following in my own mod
{
"Action": "EditData",
"Target": "Data/mail",
"Entries": {
"{{ModId}}_Letter_MaruGift": "Your text here[#]Maru's Birthday Surprise",
},
},```
That's the actual letter entry
Thank you so much! Is there a list somewhere for the conditions? Finding the name of the condition type has been a challenge for me. Like what would be the PLAYER_FRIENDSHIP_POINTS equivalent for checking a Community Center bundle?
Wait, wrong link. Let me look
That's actually a game state query
Yay! I'm gonna go dive into that! Thanks @tribal ore and @wanton pebble!
Good luck! TriggerActions are now one of my favorite tools. Feel free to ping me if you have other questions about them, and I'll answer if I'm online
Not an expert, but I can answer a lot of the basic questions now
Appreciate it โค๏ธ
I think you'd be looking for "PLAYER_HAS_MAIL Any ccVault Any" for your condition?
Since ccVault is considered a mailflag, last I checked, and for multiplayer compatibility, you'd need to use Host or Any for the player, since farmhands don't get Community Center flags.
Ohh okay good to know. What does the PLAYER_HAS_MAIL actually accomplish in these? I would assume it checks if you already have mail but why would that be a condition to receive it?
"Having mail" is a bit of a misnomer. It checks for a boolean that is set somewhere else. This can actually be a letter received, or can just be the presence of a flag without an actual letter
If that makes sense
The term "mail flag" is rather confusing
I get the conept of using the mail system for flags for the most part now but I'm not getting what this flag is actually checking I guess
Whether that flag is present in the save file
Not that it really matters for the record, I trust you guys that its right, just curious really
If you set a flag, it gets put onto the save. You can actually see them if you open the save in a text editor
Well I guess rather what sets it in the first palce?
Lots of things can set the flags. If you're setting them yourself, you'll probably be doing it with an event or with a trigger action. But there are flags that the game uses itself internally
like the ccvault stuff
I mean specifically PLAYER_HAS_MAIL
The flag will stay until you remove it
Ummmm.... if you look at the example I posted, it's this line in the trigger action:
"AddMail Current {{ModId}}_Letter_MaruGift Now",
]```
If you set that flag to "Received" instead of "Now", it will just set a flag and not actually trigger the mailbox
Ohhhh so its controlling the "Has mail" indicator. That makes sense
"AddMail Current {{ModId}}_Flag_ThingToCheck Received",
]```
Yes!
You remove the flag later with "RemoveMail"
I'm assuming that can be leveraged to set flags without the player knowing?
Yes
or more specifically without attaching it to an actual mail
Exactly. The mailbox icon won't trigger. It will be set silently
If you use "Received" instead of "Now"
Neat!
If you send an actual letter with "now", then the flag will NOT be set until the player has opened the mailbox and read the letter
That's tripped me up before
and the second "Any" in the condition for the type in my example just means it'll count the flag in any of these states: if it's in queue, if it's already in the mailbox, if it's been read, or if it skipped the mailbox (which the CC flags do)
ok im fiddling around with the idea of using "remove buff" trigger action but I'm wondering if there's even a point because i also plan on granting 11 immunity which is supposed to make you immune to all debuffs. my question is, will all previously applied debuffs be removed solely by eating something that provides 11 immunity, or would they stay and just prevent new debuffs?
Easy way to test is probably to give yourself a debuff and then equip the basilisk paw trinket?
I'd assume since it specifically calls out changing the probability of being debuffed that it would not clear pre-existing debuffs, though.
alright ill try that when i get in game
can't figure it out, unless "get the display text for a value" means exactly one
Something like this:
configMenu.AddTextOption(
mod: this.ModManifest,
name: () => i18n.Get("config.PetBowlShadow.name"),
tooltip: () => i18n.Get("config.PetBowlShadow.description"),
getValue: () => this.Config.PetBowlShadow,
setValue: value => this.Config.PetBowlShadow = value,
allowedValues: [ "", "beach", "standard" ],
formatAllowedValue: value => i18n.Get($"config.PetBowlShadow.values.{value}").UsePlaceholder(false) ?? ""
);
Or if you prefer more explicit values:
configMenu.AddTextOption(
mod: this.ModManifest,
name: () => i18n.Get("config.PetBowlShadow.name"),
tooltip: () => i18n.Get("config.PetBowlShadow.description"),
getValue: () => this.Config.PetBowlShadow,
setValue: value => this.Config.PetBowlShadow = value,
allowedValues: [ "", "beach", "standard" ],
formatAllowedValue: value => value switch
{
"" => "",
"beach" => i18n.Get("config.PetBowlShadow.values.beach"),
"standard" => i18n.Get("config.PetBowlShadow.values.standard"),
_ => value // unknown value
}
);
that bottom one looks very similar to what I tried at some point but it always screamed about syntax errors when I put my delimiters... ๐คท
trying to output descriptions and other strings in game but i get these types of strings i'm unfamiliar with (assuming i18n)
[LocalizedText Strings\\Objects:Weeds_Description]
how do i convert these to real strings (other than manually parsing and loading and stuff), i.e. is there a helper function for this?
Those need TokenParser to evaluate
From what I understand, it's so that things like object names aren't permanently associated with their instances so that they're able to change more easily
where's that ?
TokenParser.ParseText in the game code, and you can see the values in the unpacked content Data Strings folder
Strings/Objects.json
thank you!!!!!!!
If you use TokenParser.ParseText("[LocalizedText Strings\\Objects:Weeds_Description]") it'll return "A bunch of obnoxious weeds."
Can I put a token inside of an i18n token?
Hey guys, I'm having a hard time trying to understand the relation between Tailored items (pants, shirts, hats). The IDs for objects and their relation to Craft/BigMachines is much clearer, but the same logic does not seem to apply to tailoring(which seem to be based on tags I haven't seen anywhere else in the json data). You guys have any tips on how to manipulate it in C#? (I'm trying to make something like a recipe book, but for tailoring)
you did unpack Data/TailoringRecipes yes
the context tags used are mainly dynamic ones generated automatically from the item name/id
https://stardewvalleywiki.com/Modding:Context_tags#Added_automatically
Yep, but there's one little extra step. See Can I use Content Patcher tokens in i18n files? in the translation docs.
Central Station release candidate 1 is now available!
If you want to give feedback before it releases, you're almost out of time. It'll be much harder to change the format once it's released.
See the [pinned message](#making-mods-general message) and [alpha thread](#1336049684950683810 message) for more info.
So I'm still struggling to figure out why my fence isn't pulling from the tilesheet, and instead just placing the sprite object. The object conditions for seasonal/recolor changes aren't working either. If I could get a pair of eyes on the jsons #making-mods-general message
to see if maybe I have an extra and or missing load action/some other thing im overlooking, and if there are any errors on the changes for sprite recolors
thank you all for your help, it has been tremendous, and I apologize for being such a slow learner
can u show us ur file structure
one weirdness i see is that your loads used {{Seasonal}} which would be true or false depending on config
rather than the content patcher token {{Season}}
here is example of using season token in load, along with corresponding file structure
{
"Action": "Load",
"Target": "{{ModId}}\\Flooring1",
"FromFile": "assets/floors/1_{{season}}.png",
},
Seasonal is just config token, and further in on the content json I do suffix them with {{season}} let me go turn on my pc
perhaps I should change the token to be seasonal/non seasonal like my file structure instead of true/false?
are the two paths splitting between seasonal/non
but at the very least, I am using the {{season}} token for those
"LogName": "Starblue Light Seasonal",
"Action": "EditImage",
"Target": "ShilohAreles.CuterPicketFence/object",
"FromFile": "assets/{{Seasonal}}/{{Tone}}/{{Recolor}}/fenceobject_{{season}}.png",
"When": {
"Recolor": "Starblue",
"Tone": "Alt",
"Seasonal": "True",
}```
as chu points out your config tokens are only ever going to be true or false
{{Seasonal}} will become, for example, just true
meaning you are trying to load an asset from assets/true/{{Tone}}/etc etc
yep
"NonSeasonal" isnt a thing in your content.json
(nor is Seasonal outside of the name of a token)
hmm ok, so I should change it to maybe having it be seasonal, nonseasonal instead of true, false?
somehow I've skirted through on seasonal true false for replacers through dumb luck lol
up to you how you want to reorganize or change it. it just needs to end up matching a file path
you just need to think about what the tokens will look like when content patcher fills them in
you already got seasonal in the When
i'd just use assets/Seasonal/{{Tone}}/{{Recolor}}/fenceobject_{{season}}.png (and assets/NonSeasonal/{{Tone}}/{{Recolor}}/fenceobject_{{season}}.png behind a when not seasonal)
mmk! thats what I was just about to ask
thanks friends. as for the fence not pulling from the tilesheet and instead placing the object sprite, do you see anything glaringly obvious there? I feel like I might have too many load actions? or maybe something missing
you can have as many load actions as you want so long as they arent loading to the same target and with the same exclusive priority. im not familiar enough with fences to comment on anything else
(Yay!!!! Congratulations!!!!)
they might be? I have a load for the assets/object in both the content and the object json, but I have to check if the object was loading correctly without the load in the content... if that makes sense
content patcher would yell at you in the log if they were
o7 well there is no yelling from CP so I guess its fine
maybe these hiccups with the {{Seasonal}} token is the problem
can someone explain {{TargetWithoutPath}} ?
it becomes everything after the last / in your Target
(or last \ or \\ etc)
your Target is not a file path. but pretend it was. TargetWithoutPath would be the name of the file, but without all the folders its inside
so it would be better here to split the seasonal true/false up so I can name the folder instead of something like
"LogName": "Vanilla Dark",
"Action": "EditImage",
"Target": "ShilohAreles.CuterPicketFence/object",
"FromFile": "assets/{{TargetWithoutPath}}/{{Tone}}/{{Recolor}}/fenceobject.png",
"When": {
"Recolor": "Vanilla",
"Tone": "Alt",
"Seasonal": "True, False",
}
},```
this wouldnt work, correct? or could I add a `\\Seasonal, NonSeasonal` somewhere?
that would become assets/object/{{Tone}}/{{Recolor}}/fenceobject.png
bah, still placing the object instead of the actual fence tilesheet
but, the object sprite changes seem to work
hmm except for the default fence's variation
ok fixed that
now just to tackle the problem with it not placing from the tilesheet
hey guys, new to modding so I apologize if this is a stupid question. Is there a way to make it so that the first thing an NPC says to you is something like "hello farmer, we haven't met yet" (would be something else ofc but I'm just brainstorming). I don't mean on the first day of spring in the first year, I mean like even if you don't talk to the NPC at all until fall in year three or whatever there's a way to guarentee that "hello farmer, we haven't met yet" is the first thing they say?
you can just make that their entire dialogue file until they have not been unmet
I think you'd have to patch to all dialogue keys if relationship is unmet
oh button's way is easier, lmao
fill in all the default, necessary keys with the same thing
i was typing up a whole thing with trigger actions and mail flags
use the Relationship token to swap em out the next day onward
(In fact, there are no necessary dialogue keys)
another way to do it is to make an unconditional event in an area the player can't bypass before meeting them, and do the mandatory introduction dialogue there instead of in character dialogue
I had a way to do it in 1.5.6 with thr $1 dialogue token
i found that if i didnt have a dialogue key for the day i was talking to them on at least, they were uninteractable
rrrgh. This is incredibly niche, but does anyone know why NVIDIA's recording feature no longer plays well with SMAPI?
if it's really critical that that be the first thing they say, then it's probably better suited for an event anyway, imo
okay, thank you! I'm extremly new so that'll be something I have to research and probaby tackle at a later date (no idea what dialogue keys are xD) but thanks for letting me know it's possible. And yeah, it sounds easier to make it, say, an event that triggers with whatever relationship points you get with talking to them for the first time lmao.
Can't you just use spring
and it's not really that important, I'm really new so I am more testing the waters as I learn
iirc i had a spring one, but, its been a while
half-making a mod half-using it as a learning device xD
(also, would that not make spring the necessary key)
my memory is telling me the minimum dialogue file is seven lines, one for each weekday, but don't trust that guy he's unreliable
that's... genius. Seriously, thank you! I'm looking at making an event for Elliott and I can easily just use the beach there.
well the player can definitely meet elliott before going to the beach
ah, well, that's true...
hm
a schedule edit conditioned on that relationship token could fix that though
Oh, yeah, that's smart. In that case it could trigger anywhere, just make Elliott a hermit who hides in his cabin until the event triggers.
If it could be anywhere, then that opens up a lot of story possibilities actually.
Similar to meeting Willy kind of thing
it wouldnt account for other modded schedules for him, though
Yeah, but right now I'm not really looking at making something that's going to be available elsewhere. This would just be for personal use. If I ever got to the point where I'd want to publish the mod, I could look into alternatives then.
I'm also extremely new (never modded Stardew or anything else, and I have no coding experience) so it's probably better I look at simpler solutions until I get the hang of it.
Thank you so much again, very kind of you to help. I really appreciate it.
!startmodding in case it helps you start your search for how to do things
Making mods can be broadly divided into two categories:
- Content packs are formatted text files, and don't need any programming knowledge. They can add/edit NPCs, maps, new items, shops, and more. To get started, see the list of framework mods, the wiki tutorial for Content Patcher, and there might be relevant guides on the tutorial wiki.
- C# mods use programming code to change fundamental game mechanics. See getting started with C# modding.
Usually itโs easier to start with making content packs, since you don't need to learn programming.
(you can ignore the second bullet point)
Has anyone ever tried using [InstancedStatic] on user code? I'm wondering if I can slap it on a Harmony patch, or if it's only applicable to the internal game code.
Well, I've got mods on ModDB, ModLand, GameFront and the Stardew Valley Forum, not sure if all of them are possible. But maybe one or two more would be good?
(I wouldn't use InstancedStatic personally; I do know that the game does scan every loaded assembly but it feels like an unstable api.)
Yeah, that's a good point and I realized after I asked the question that it was probably a better idea. Even though I'm using it several times already, it sort of slipped my mind that it could actually be used from a static context as opposed to just the mod entry.
(The reason why I asked "honest question" was because I wanted to know if you were avoiding perscreen for performance reasons, etc)
CurseForge, ModDrop, and Nexus have a custom export API which lets SMAPI fetch mod data in a very efficient way, and GitHub is big enough that it's worth the performance impact of supporting it even without a special API.
ModDB/ModLand/GameFront don't seem to have an API though, and Stardew Valley mods probably aren't big enough on those sites for them to consider creating an API just for SMAPI.
Not as far as I know. Somewhat surprisingly, didPlayerJustLeftClick doesn't actually get called that often.
(I've got almost everything working here, the one hold out is - surprise! - the fishing rod)
Would've been so nice if there was a method like, oh, I don't know, IsToolButtonHeld(), but noooo, it has to be hardcoded Buttons.X everywhere.
Ah okay, well it was worth asking.
Just popping in to say I'm not dead or anything, just been going through a lot the past 2-3 months. (I have been keeping in touch with a few people around here though, so feel free to check in if I've talked to you a couple times before - as long as it isn't mod related ๐ .) Going to stay focused on my mental health for a while longer, but if there's something super critical (spacecore causing a crash outside of weird obscure circumstances, for example) feel free to ping me here on discord and I'll try to get a hotfix out. (I've stopped even checking Nexus new mods and comments the past couple of weeks (not that I was responding much lately before that))
(There is a chance some stuff will come up soon where I won't have access to modding for a while, but I'll try to remember to let Pathos know if that's the case though so he can release critical fixes since he has access to my github repo + Nexus mod pages.)
Once I'm in a better place mentally I'll try to take care of my backlog of not critical bugs and stuff (and potentially resume work on some of my WIPs), though it will likely be a bit still considering I haven't opened a game since November or done hardly any programming for almost the same amount of time.
i hope you're taking care of yourself! i did want to drop and say your work with smapi so far (localtoken chaos, i18n folders) has proved a great boon to me and has increased my mod speed tenfold
as well as the innovation for spacecore's guidebooks
have a cat!! my cat specifically
ive owed you a cat picture for a while
Glad you are ok casey 
You've already done so much for us casey, take all the time you need 
awww, cute cat
Hey, I'm looking for the code that lets the player grab the Junimo Plush at 12h sharp on the last day of the season. Does anyone know where that code is? I tried to go through GameLocation, Town, Game1, Utility, Farmer, Event and even Object and Furniture. Couldn't find anything 
I also was unable to find any reference to it in the Town.xnb data file
i would search around for the ID number of the furniture
That was part of my search
huh
my first guesses would all be town, gamelocation, etc
so I'm pretty much out of good ideas
I doubt the secret note would matter, right?
I searched for keywords Junimo, Plush, 1733, and also references to Game1.timeOfDay == to find potential conditions about the time
The wiki seems to claim you can find it even before reading the note
Yeah, and I can't think that it would be linked to the call anyway
oh nice, that's exactly it
it's Bush! ahhh that makes so much sense!
Thank you very much 
I rarely need bush lmao. I think I only needed them for walnuts so far. I forgot they even have code
btw, I found it by setting ILSpy to Constant
I did find in files across the full decompile
for 1733
dang I should set that up
it's kind of a pain because to this day I still need to sometimes switch to the 1.5 branch
but that sounds massively valuable
I can almost always find the code I need, after so many years making this mod I feel like I know the code base pretty well, but sometimes I still get stumped haha
thanks all 
at this point in my life I should use my skills for good use lol, I've stopped modding lol
i have several folders with full decompiles lying around
mostly from during the alpha
which term is feels more right
- SMAPI Mod
- C# Mod
I tink I found a bug with the ObjectColor field on the machine rules output, how do we report those?
(specifically, if I'm following this correctly, it will always overwrite the stack size to 1 when it calls coloredItem.CopyfieldsFrom if it is converting a normal non coloredobject into a coloredobject)
!officialbug
If you've checked that it's not a mod bug:
- Report gameplay bugs to the Stardew Valley developers here: https://forums.stardewvalley.net/forums/12/ (do a quick search first so you don't report something they're already looking into).
- Report typos or translation errors here: https://forums.stardewvalley.net/forums/32/
Alternatively, you can emailsupport@stardewvalley.net
in your case make sure to do a repro with some minimal C# mod
to rule out other mod doing weird stuff
in this case I can do it with just a CP mod by itself (and found the line of code I'm fairly sure is the culprit)
we have no idea when next fix though
yep sure, but still make sure u have no other C# mods in ur test
(y) can do
Pathos actually knows about that bug actually already
but good to report it officially too
(i know bc i reported it to Pathos bc i also found CopyFieldsFrom was weird in doing that)
yeah, if we just added another "coloredItem.Stack.Value = input.Stack on line 215 in ColoredObject that would resolve it
(at least i think i did? i might actually not have directly pinged pathos bc i cant find my messages)
or on line 809 on Item.cs
but i don't know if the "remove stack" behavior is expected in other cases when CopyFieldsFrom is called
apparently is already changed for 1.6.16, whenever that will come out
no timeline on it
CopyFieldsFrom was added in 1.6.9 so i dont think anything actually uses it besides that ColoredObject thing
ah ok
and whatever mods mightve started using it
but yeah its not unique to colouredobjects its just a bug in CopyFieldsFrom itself
makes sense, so either swap to use CopyColor instead and make sure input items always have the colors I want, retool recipes to always expect a single output or harmony patch a fix in temporarily is how it sounds
yeah pretty much
actually, CopyColor might have the same issue, I'll test really quick
CopyColor calls ColoredObject.TrySetColor so yeah, it will
(didnt notice til you said it)
(and by "calls it" i mean "the code that checks CopyColor then calls TrySetColor")
(and TrySetColor calls CopyFieldsFrom
)
yeah, and I don't see anything after that to restore the stack
yup, same problem, ok, so that leaves retool recipes or harmony patch
for now does stack modifiers work as a workaround
that should be after the item is created
I doubt it since the colored object conversion stuff happens after the stack size determination, but let me confirm really quick
oh, no you're probably right, stack size modifier is right after the copy color block
I'll give it the ol' college try
actually no you might be righr
it is before
darn
it's the machine price modifier that is after
oh, this is quality modifier
it just uses the "Quantitymodifier" object
i misread
actually, I'm not seeing where it applies the stack size modifier at all in this method, I only see price and quality
must be in the item query resolver
originally I was looking at GetOutputItem on MachineDataUtility, but the stack moidifer is in itemquery resolver on the applyitemfields, yeah
GitHub on phone is a pain lol
Consider: github on laptop
I can't talk I'm looking at a very teensy knitting chart on my phone
Docs: Use ILSpy
anyway as a last last workaround if you're willing to use EMC I think this should work probably
https://github.com/zombifier/My_Stardew_Mods/tree/master/ExtraMachineConfig#generate-nearby-flower-flavored-modded-items-or-generate-flavored-items-outside-of-machines
Please
use apple for red color, orange for orange, banana for yellow etc etc
egf
Docs: githuv link
id still probably use ilspy first
my inline comments say /// <summary>Does absolutely nothing.</summary>
I'd rather not add a mod dependency to this mod, I'll probably retool the recipes for now and look at a harmony patch as a stand alone fix for the problem and use my original recipes if that's being used
I hate FishingRod so much right now, along with this ridiculous netcode. All the debugger can tell me about why it's firing is [Lightweight Function]. Thanks.
but EMC is fun and cool
I'm certain that is true! but I've been trying to keep Dwarven Expansion to only Content Patcher itself and whatever we can do with the 1.6 changes
its also fairly common now, since cornucopia uses it
I still dont see any mod use the "extra junimo food" feature and I am sad
ooh, I'll jot that down and see if I can make it fit
I've been adding random things just for the sake of trying the new features ๐
I actually need to add some new potions with the additional food buffs that got added with 1.6.9 (or I think I saw new food buffs listed anyway!)
nice
I swear combat level was already on the list before, but I see it listed in the update so /shrug
I dont think so, cuz I think extra combat level doesnt actually do anything
the hp bonuses are actually given on the level up screen
the only use case for a hypothetical combat level up is
idk
for some reason I always assumed it was used in the damage calculation
I'm about 2% sure it's used in the calculation for which version of certain monsters to spawn
at least for the infested farm or whatever it's called
Oh yeah that2nd point is true
granted, a "buff" that just spawns harder monsters with no other benefit isn't much of a buff ๐
but imagine a boss that only spawns for level 12 combat with rare loot
... but you can also condition it on just having the buff itself
ehh
it might be interesting when mixed with mods like Deep Woods
huzzah, harmony patch made
So, as the Shops documentation on the wiki states, putting an NPCs name in the "Name" option should restrict that shop to only that NPC if they're nearby the shop.
But I found out that it works regardless if they're nearby or not.
How large is your owner tile area in the Action OpenShop property?
Are you supposed to define tiles with Action OpenShop?
Well, the wiki implies that you have to have specified an owner tile area in the Action OpenShop tile property in order to require an owner be present to open the shop.
I'm curious how you're opening your shop if not using Action OpenShop (because I haven't made a shop so I don't know if there's multiple ways).
I just didAction: OpenShop whatever
I used to use Shop: whatever, but that was back in STF and STF is mostly deprecated now.
Then try setting the owner tile area and see if that fixes the issue?
Yeah, I'll try that.
Yeah nah, it's still available even if the NPC is not in the tiles I defined.
And even if the shop is supposed to be closed for some reason.
you may have something wrong in the way you set things, which can be easier to spot with you providing what you set
(once you ensured you did copy your map changes properly into the mod)
I did, I deleted the folder and pasted in the new copy.
If it opens even when it's supposed to be closed, then either something is off with the OpenShop tile property, or something is off with the Owners conditional. Can you share what you set?
Yeah, here you go: https://smapi.io/json/content-patcher/7f20cc8266d34c50b98e8f2de83cc54b
When I open the shop Hekate doesn't show up as the owner, but the shop is still open after closing time, which I set as a condition.
Aah, this part { "Name": "None", "Id": "{{ModId}}_Artisanry_Closed", "ClosedMessage": "{{i18n:Shops.GV.Artisanry.Closed}}", "Condition": "!TIME 900 1700" }
Means that the shop will open when regardless if there's no owner or not.
Oh, but I designated ClosedMessage, so I thought that would override it?
Do I just set name to null?
Ridgeside does the same thing for their shops, I assume theirs work?
Okay, turns out I didn't fill out OpenShop properly.
But yeah, I guess the Shops data doing that is just an oversight?
Oh, it's working now? What didn't you fill, for future reference?
Height and Width for the owner tile.
Oh, even though the wiki said it doesn't need them huh.
Wiki page has been updated to make it clear width and height are mandatory now ^_^
remind me in 8 hours to finish tape commission
hey peebrain, you teleport? (#6515039) (8h | <t:1738858530>)
Does anyone know if HasMod works in Condition?
STF allowed you to do "When" conditions for ItemStocks, and I wanna replicate that without having duplicate shop entries for each supported mod item entry.
It should work, CP evaluates it to true or false so by the time the game gets it, it would just be true or false depending on if you have it installed
there's a HasMod example here: https://stardewvalleywiki.com/Modding:Game_state_queries#Built-in_queries
basically, the GSQ system doesn't have a HasMod or anything, but it accepts true and false, so CP edits can use tokens like that
Oh, cool.
Yeah tokens in gsq are one of my favorite tricks
Today I learned: how to make cooking and crafting recipes, how to make two different cooking/crafting recipes that produce the same item, and how to make a shop. Do I need any of this for my own mod? No, no I do not xD
yet
Is there an easy way to count how many mods use my mod on Nexus? Counting manually through the list is annoying.
ok, seems like setting an id in the inspector and asking document.getElementById("table_id").rows.length in the console gives the answer
Not Inherently, But you can Copy Paste it into Google Sheets or excel and See how many rows it takes up, in the case of your Furniture Framework, 54.
Is there any way I can get an tile/sprite ID? I tried the Debug Info mod but it doesnt show that much info and I havent found any info in debug commands for SMAPI. I want to get an custom connector to work in Automate mod and that connector is a floor in greenhouse ๐
I know Farm Type Manager has a "Whereami" command in smapi to tell you the tile you're standing on's numerical ID
The coords or ID? I dont need X, Y ๐
both I believe
Will check, thanks
You can also open it in tiled and hover over that tile on the correct layer, and it will show both. in the bottom left
Lookup Anything will tell you a tile coord, so does Debug Mode mod, and I think there's a debug command for it too
If all else fails you could stand on the tile, warp an NPC to you, then use the whereis debug command for them lol
Lookup Anything doesnt recognize static sprites, only the ones player can interact with and Debug Mode doesnt recognize the sprites, Farm Type Manager might do the trick
LA does actually you just need to enable it in the config :) I use it for tile info all the time for mod-making
Static sprites being map tiles? Yeah, you want the tile lookups option on for that!
You right!
But if you're referring to an object sprite rather than a map tile then no, Debug Mode won't work for that
I used that option a while ago but for the gameplay purpose doesnt wanted the obvious debug clutter and now I forgot about that option there. Thanks man
No worries :) I love LA haha
Its mandatory ๐ Like a little wiki build-in
FTM uses it to identify Id's for people, so they can specify specific tiles for spawning stuff on, so you can make your own "grouping"
I'm not 100% sure the game can Differentiate ID values from varying Tilesheets. Like if the index is 135 it might use that tile across all the maps tilesheet tiles.
I know I saw a warning about it somewhere, but that was also pre-1.6 so I don't know its current state? Just a heads up.
Now I can work with debug tile info for custom connector for Automate ๐
I've seen the feature mentioned for tile recognition but Lookup Anything is all I need, thank you anyway ๐
That reminds me I need to find a way to enable chat cheats for all my saves
/debug enableCheats? or something like that
Perhaps if I mention an inefficient way of doing that it will summon Atra and they will tell me how to do it properly...
what do you mean by cheats?
probably to apply debug in game instead of smapi console
I mean using the chat for debug/mod commands instead of SMAPI console
I tried to debug command ingame and ConcernedApe replied xD
Since Atra told me about it being part of vanilla now and I tried it and was instantly sold
But it involves having to edit every save file which is extremely unwieldy when I'm creating several new save files each time i am testing mod stuff
It's a good thing I'm not CA, because if I were him, I would have also spawned a mega bomb that does no damage when that message is displayed. 
Hmm Tedi has a more recent mod than CattyCatCat's Chat Commands mod
Can you write a mod that just like, if you do !"Stuff" it basically just tells smapi to run the "Stuff" command? I don't know how hard that is cuz i dont really code, but it seems like the biggest hurdle would be whether a mod can access the Smapi Console in that way. And read the ingame chat of course is a basic requirement.
Fair Enough, I know enough about code to get the gist of moderate to simple code is trying to do, but not really enough to write it, and enough to know what is likely going to be the problem areas, or just enough to get myself into trouble. Its kinda a broad spectrum.
Well someone had a go at updating Chat Commands for 1.6 so I will try that I guess!
It's not like it's necessary it's just fun to use warp commands and stuff without having to alt-tab
Well then, Done with EMP and FTM Setup for these maps, All thats left for this Mod's TODO list is Debris, Tiledata, rewriting internal descriptors, Make a new Icon, Design a new House interior (Or yoink one of my old ones), Make the Modpage, And take a bunch of Pictures of the map. Like.... 8 Hours of Work maybe?
(Most of that will be debris across the 5 maps)
I think Most People just use CJB Cheats To Be Honest.
That is fair but I find CJB too slow lol
Yeeeees 
It does all the CP commands too, perfect!
Just for the record. If you're only doing the regular ones you can just debug togglecheats
Hey, im very much new to making mods for Stardew Valley and making mods in general. When u guys test out your mods, debugging and such, do you always go through the whole process of waiting for the game to get to the home screen, click load, select your testing save or making a new one and loading it manually? I kinda wanna skip that whole process and just load a save directly on launch when i need to. Any ideas? The way i approached it doesnt really do anything ๐ด I was using the GameLoop GameLaunched Event and StardewValley.SaveGame.Load(targetSaveFile);
I have nothing to contribute about loading directly into a game save, but are you hot reloading your mod changes (C#) or using patch reload (CP)? Because usually you shouldn't have to be opening and closing your game very frequently anyway.
Use Skip Intro
Oh yeah using Skip Intro and Fast Animations is also helpful
Ill look into that thanks! Sounds like a good alternative to speed things up a bit
i try to use hotload for the most part but its not always possible or even crashes the game for me when done too often
Hello! I'm really new to sdv modding and I have a question regarding using visual studio code for my IDE of choice. I've gotten everything to work fairly well so far, but when launching the game and debugging, the terminal messages go through the built-in vscode debug console (which can't accept commands and is in a different encoding for some reason??) instead of a separate terminal window (like it would when you would launch a normal sdv modded instance). I assume it's something with my launch.json file in my '.vscode' folder, but I haven't been able to crack it properly.
Sorry for the word soup ahahahaaa. I am running on 3 hours of sleep
...oh my. That, uhh... this has not happened previously when I've tested it out.
Ah crap. That's exactly what my viewport looks like as well orz
I think I'm gonna have nightmares about this tonight
It's almost certainly what SMAPI's doing to colour the text, so I wonder if there's a SMAPI setting to disable that...
Eek
It looks like "console": "externalTerminal" is a thing for some project types in VSCode's launch.json, but... annoyingly not the C# dev kit one.
ikr? it's pretty infuriating
Ooh, we might have something.
csharp.debug.console - When launching console projects, indicates which console the target program should be launched into. Note: This option is only used for the 'dotnet' debug configuration type.
internalConsole [Default] - VS Code's Debug Console. This mode allows you to see messages from both the debugger and the target program in one place. Refer to full documentation for more details.
integratedTerminal - VS Code's integrated terminal.
externalTerminal - External terminal that can be configured via user settings.
Event tester
/smapicommand patch export <blah>
It... doesn't seem to use an external terminal for me still. 
ahahaaahahaaaa CRAP;; same here
https://github.com/microsoft/vscode-dotnettools/issues/82
There's this issue where it apparently was fixed, but then broke again, but apparently fixed again... in 2024. So I suppose it's possible it broke again.
Of course, I should've guessed!
Jeez, that's really really odd. If that's the case, it almost feels like insanity
.NET in VSCode has always felt sort of... half baked, and this sure isn't helping that impression. 
Yeah, this is my first foray into .NET via VSC and I can honestly see why people say the integration is full of jank now ahahaaa
I'll just hop on to VS2022 in that case. This was a fun look nonetheless
Thank you for the help ๐ . I really appreciate it
I think the only thing that works 100% in vs code is the language server
Even that crashes randomly tho and i gotta restart
JetBrains Fleet has C# support now it seems... since I'm poking around, let's see how terribly that does. 
What is fleet
oh god, vscode why have you forsaken us???
What about rider
I wish rider had working hot reload. vs sucks so much
It does for me now on Windows!
Found a fix that works for me, but not Matt, sadly.
for sdv? I read its only +.NET8, and it didnt work for sdv forme
For Stardew! I had hot reload working with Stardew in Rider back when .NET 6 was the newest, but it kinda broke at some point between then and now.
I need to try again I guess
For my system at least, the problem was apparently SMAPI switching to embedding the PDBs.
And a simple: #making-mods-general message
Fixed that. Make it conditional on being in debug only, and we have PDBs generated for working on it, and SMAPI embedding the PDBs for release.
how neat, Ill try ty :3
Huh, well Fleet works quite nicely it seems. No hot reload, but...
Just keep in mind this fix didn't seem to work for Matt, so it might not for you!
damn it actually works, neat ๐
if anyone needs it, I made a small harmony patch mod to fix the colored object stack size issue:
https://www.nexusmods.com/stardewvalley/mods/31499/ it just adds a postfix on the TrySetColor method for ColoredObject to reassert the stack size on the resulting colored object.
Yeah that's because CopyFieldsFrom uses GetOneCopyFrom internally, which has Stack hardcoded to 1
In my opinion if it's going to use that internally, it should fix the stack size back to match that of the given item before it returns, but after GetOneCopyFrom
Otherwise there's no point in it existing since it literally just wraps GetOneCopyFrom (ignoring GetOneCopyFrom being virtual for subclasses to override, of course)
Ya, I know, I patched it ๐
Pathos took note that add a fix in 1.6.16 but that doesn't have a release date
I did patch at the colored object level just to avoid any potential side effects
I am looking an CP and it looks like a mod to add an option to buy 1000 casino coins at time would not be possible. Is that correct is that another mod I need to learn c# for?
Hi, im mostly wondering how to actually add custom events into the game with my custom npcs, ive made the text but i don't actually know how to add it in, can anyone help?
[[Modding:Event_data]]
I don't remember how you buy casino coints in vanilla, is it a shop? if so, search Data/Shops for it
The casino is a shop, the menu that let's you buy coins does not seem to be in the shop list.
hmmm, maybe its data is in the map data? I don't know much about maps and I don't remember much about the casino
The map data is this
oh yeah, that looks very hardcoded
I don't even know where to search in the code to see what it does exactly, it might be good to wait for someone who actually knows what it does
Looks like it's hardcoded in StardewValley.GameLocation.answerDialogueAction:
case "BuyQiCoins_Yes":
if (Game1.player.Money >= 1000)
{
Game1.player.Money -= 1000;
localSound("Pickup_Coin15");
Game1.player.clubCoins += 100;
}
else
{
Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\StringsFromCSFiles:GameLocation.cs.8715"));
}
break;
here you go
I have looked through this code over and over and I cannot find the reason as to why its not using the tilesheet for this fence
and its not adding it as a crafting recipe, despite having it set to both default or none for no requirements/auto unlock, and I can spawn it with cjb
So no CP mode for it? I dont know C#. So i guess I am out of luck
I imagine it could be done with some of the more advanced CP methods
I think you can add new dialogue and events with it
And patch the map tile to redirect it away from the vanilla dialogue
Dunno if CP can modify the club coin count tho
I thought you could replace this thing with an actual shop but it seems like casino money isn't an actual item.
Yup, It looks beyond me. I will just have to live with clicking a hundred times
@astral prism: finish tape commission (8h ago)
(It's very hardcoded but not that hard to change.)
I would say easily in baby's first c# zone
If u just make an action that calls the one line of code u can do it
Maybe ask button nicely for the feature
StardewXnbHack doesn't seem to find the audio files? The wiki says that there should be a Content/XACT folder, but it doesn't exist
Is there a different way to extract the audio files from the game? I just want to mess with the ambient loops for an event
If you just want to play music i have a mod for this
I want to source files actually so that I can mix them in audacity. I don't think I can get the effect I want otherwise
I want to play two ambient tracks over the top of each other, and then mix in music later
With reverb
So...
Then you need unxwb
i can add an AddCurrency action but i cannot make a menu for casino coins specifically
I mean, just AddCurrency would do it with the Shops and creative use of ActionOnPurchase
[[modding:audio]]
I grabbed unxwb, but I thought I was supposed to point it at the Content/XACT folder
But that folder doenst' exist
Unless I'm misunderstanding something
audio coding ร_ร
...getting along but there alot of audio (left songs right is soundeffects) some doubles here and there
You need to point it at the one in your game file
Stardewxnbhack just doesn't extract music at all
This is a whole other thing
If ur still having problems remind me in 6hrs to find command i used
Ummmm. Ok, so I point it at Stardew Valley.exe?
i used unxwb that does work realy good!
Ok, found it! That's basically what i needed. Didn't know that I had to go up a couple of levels in the directory structure to find it
Thank you
Is it possible to i18n dynamic tokens
.... depends on what you mean
I guess what are you attempting to do? Two different scenarios come to mind
You can dynamic token i18ns
Shrimply one thing you can do (if this is what you mean) is set a dynamic token equal to the value of an i18n string, and conditionally change it to a different i18n string if needed
So like poasb or dnr or uws can use BreakfastDate.2.{{ModKey}} to point to two separate i18ns depending on value of modkey
Hence why I need to know if you mean i18n dynamic Tokens and if so what the use case is since dynamic token values are generally not visible to the user
This is a collection of various tips & tricks for using Content Patcher's dynamic tokens for increased coding versatility. At their core, dynamic tokens are used for creating a token that changes its value depending on various conditions, which with a little creative thinking can be used for all sorts of situations!
This page assumes that you're...
It is possible, but the usage of Dynamic Tokens may be different to the one you want, so...
I wanted to know if i could dynamic token like, a character's name based on event shenanigans
(display name, ofc)
Yeah, that's easy
Oh easy
Yeah, possible indeed, I'm doing that.
Have it be i18n:DisplayName.{{Eventchecktoken}}
That section of the tips & tricks page I sent has examples of how to do pretty much that
Oh cool, ill check back once im actually up for Doing The Thing, i just wanted to ask ahead of time so i don't convince myself something is possible when it is in fact, not
Example of one of many (at least 2, the other one is on the link above) using i18n & dynamic token:
DT (in content.json):
"Name": "DT_dialogues",
"Value": "${Mr.^Ms.^Mx.}$ {{PlayerName}}",
"Condition": "MarkEventSeen Current StrojvedouciDenis.Eleanor_4hearts false"
},
{
"Name": "DT_dialogues",
"Value": "{{Hana.GNMTokens/Title}} {{PlayerName}}",
"When": {
"Condition": "MarkEventSeen Current StrojvedouciDenis.Eleanor_4hearts false",
"HasMod": "Hana.GNMTokens"
}
},
{
"Name": "DT_dialogues",
"Value": "{{PlayerName}}",
"When": {
"Condition": "MarkEventSeen Current StrojvedouciDenis.Eleanor_4hearts"
}
},```
Dialogue.json:
``` "spring_1": "{{i18n:Dialogues.spring_1 |DT_dialogues={{DT_dialogues}}}}",```
default.json (i18n):
``` "Dialogues.spring_1": "Time for you to start working on your farm, {{DT_dialogues}}.#$b#I don't say you weren't working on %farm, I just wanted to tell you that it has got some powerfull magical properties.#$e#How do I know, you're asking?#$b#I can sense the magic in it.",
How does one do the link thing where the mod is posted in #mod-showcase
As in you want to showcase your mod?
Yes :D
You just right-click the post you want to showcase, go to Apps, and then click Publish ๐
By the way, if you do want to add a custom catalogue via Calcifer later, it's actually super easy
help...i tryed some stuff but it says something is wrong with multiply paths songs (for "springsongs" for example) and i dont know how to write that part
https://smapi.io/json/content-patcher/376609e974d049cba89d181e6e1c2c5f
!log
Important note: Your computer username may appear in the log. If your username is your full name, please be aware of this before uploading it.
Please share your SMAPI log file. To do so:
- Open this page: smapi.io/log.
- Follow the instructions at the top of the page to upload the log file. (Don't copy & paste from the console window!)
- After uploading, it will show a green box with a URL to share. Post that URL here.
Please do it even if you don't see any errors. This has useful info like what mods and versions you have, what the mods are doing, etc. If the issue didnโt occur in your last session, please load the game to the point where the issue occurs, then upload the log.
"FilePaths": [
"{{AbsoluteFilePath: assets/Zelda_sounds/Songs/0000005b_hyrule2.wav, assets/Zelda_sounds/Songs/0000005b_hyrule.wav, assets/Zelda_sounds/Songs/0000005b_hyruleagain.wav}}"
],
this needs to be changed to multiple different AbsoluteFilePath entries
(good practice in general to send a log always tho at least)
Log Info: SMAPI 4.1.10 with SDV 1.6.15 build 24356 on Microsoft Windows 10 Home, with 10 C# mods and 1 content packs.
Suggested fixes: One or more mods are out of date, consider updating them
oh thats a much different error
.... suddenly I feel accidentally brilliant XD
ok what is wron with it i dont see a diffrence XD
Alright where's the bad }}
(AbsoluteFilePath still only does one file though)
Ouu I couldn't find any documentation on it so I just didn't but I definitely could try :O
I have several furniture mods that could use it, really
oh ร-ร
Line 106!
as for the difference before, thats bc i didnt fix it, i was pointing out what part is broken
Yeah, soph's been on modding hiatus so she hasn't got around to writing the docs for it, but I'll see about adding a tutorial for it to the modding wiki at some point ๐ For now though, I can show you the code you'd need if you like?
"FilePaths": [
"{{AbsoluteFilePath: assets/Zelda_sounds/Songs/0000005b_hyrule2.wav}}",
"{{AbsoluteFilePath: assets/Zelda_sounds/Songs/0000005b_hyrule.wav}}",
"{{AbsoluteFilePath: assets/Zelda_sounds/Songs/0000005b_hyruleagain.wav}}"
],
I would really appreciate that!
Basically how Calcifer works is that it lets you assign a tile action via CP to a particular furniture item, and then when you interact with that item, it opens a CP shop where you sell all your furniture for 0 gold
(Gentle reminder to put your music as .ogg and stream it)
(Your sound effects should be wav and unstreamed)
yeah i know just wanted to code it first for my own use since im still testing alot of stuff
No worries, give me a couple of minutes to type up an example
funny enough i did that one already but though it was cousing problems Q-Q
Okay, so since you've already got context tags added for your furniture, this is all the code you need: https://smapi.io/json/content-patcher/0ccaceb907ef467088aa4ed2578bd1f8
For this example, I've used the red book as a catalogue item and put all the code in an Include file, and I'd add a code block like so:
{
"Action": "Include",
"FromFile": "CatalogueCode.json",
"When": {
"HasMod": "sophie.Calcifer"
}
},
``` to the content.json so that it can be optional if people don't have Calcifer installed
You can use whatever item you want as a catalogue, as long as it's something the player will be able to reach to interact with
With this furniture pack in particular, what you could also do is add context tags for each colour set (eg. {{ModId}}\\ValentinesFurniture ValentinesLightPink, {{ModId}}\\ValentinesFurniture ValentinesPeach, etc) and turn each book into a catalogue for the specific colour set by just duplicating the code for each colour and changing the PerItemCondition context tag to use ValentinesLightPink etc., like so: https://smapi.io/json/content-patcher/d843ce3819ec49d287a2083ba776f6ce
(I'm heading off to bed, but feel free to ping me if you have questions about this and I'll catch up in the morning)
Log Info: SMAPI 4.1.10 with SDV 1.6.15 build 24356 on Microsoft Windows 10 Home, with 10 C# mods and 1 content packs.
Suggested fixes: One or more mods are out of date, consider updating them
๐ฅน
always send json when sending a log and always send a log when troubleshooting json
that so confusing in visuel studio this is line 195 Q-Q..no wonder i dont find my errors
well the error in the log doesnt point to any relevant line so that wouldnt make a difference
oh ok
i was just pointing it out to you in the smapi parser to find it easier
damn thats so hard to see for me
ok now he just dont wont to load one song thats progress XD
ok more then one but he loads the json
afaik when multiple FilePaths are present the game just picks one at random to play whenever it should play it
yeah that was my goel at least i hope he does it XD
well it works thank you ๐ฎ โค๏ธ (i have some naming stuff with the song names to do since the numbers doesn make i easier to see if i wrote them wrong via copy paste....
:3
Hmm... I found a bug but I can't tell if it's my fault. Setting the quality of an object produced by a tapper (via tapper.heldObject.Value.Quality, with the tapper accessed by prefixing DataBasedObjectMachine.OnOutputCollected) is causing Automate to put them in the chest without stacking them.
Looking deeper I'm starting to wonder why the prefix is even working to set the quality at all ๐ค
And why I didn't notice that there was a GetOutput function that I was looking for
Is there a reason why a harmony patch is necessary at all for something which could probably be handled by an edit to the machine's data model?
Just wondering because data edits are likely to be more compatible with any mod in general, rather than injecting unexpected behaviors
Are tappers in machine data
I thought they werent
Wild trees sure
Hi matt!
What cool mods are you dreaming up?
Wait, seriously. Were those not dehardcoded in the 1.6 update.
More focused on directly updating something someone else wrote than rewriting it
Since it broke during the dehardcoding
I'm debating if I want to revive any of my dead mods. There's been recent interest in a couple of them.
Well shoot. (BC)105 in Machines is just an empty slate.
Best of both worlds, configurable and hardcoded!
Yeah, most of tapper logic is implemented in Tree.
No, they actually look at data/wildtrees
A surprisingly large number of people every month try to download one of my dead mods
....still not worth reviving any of mine, but hey
Yours are probably worth reviving!!!!!!
maybe they're not trying to download your mods but instead succeeding in donating to that malaria charity
Donation platform for the very cheap and very lazy donors.
Congratulations, your download resulted in a donation of: 0.05 cents
Brb downloading more of atraโs mods
I get DMd every few weeks to update Helpful Spouses
LIke that's been dead since 1.5 I think
can confirm, 100% my fault
Atra, i loved your mods.
hasDoneFucntionYet hurts my eyes. Should be a P0 for SDV 1.7.
Spelling mistakes and typos in APIs are the absolute worst thing.
(I'm looking at you, HTTP Referer header.)
Fucn
What does that mod do?
Well, I fixed my fishing rod problem with tool is not FishingRod.
YOLO
Atra how can you be so smart and yet so wrong ๐
Can anybody explain to me how to add a custom location? I'm trying to make a mod for the first time and I just can't add the location
There's a tutorial for that on the modding wiki!
Well, I looked through that already but I just can't get it to work.
Rokugin here with a quick tutorial on adding a custom location to Data/Locations using Content Patcher.
Github repo can be found here, with the download for the whole mod here.
This tutorial assumes you have SMAPI and Content Patcher installed.
I suggest using VSCode for automatic formatting and real...
Hell yeah, FF rework debugging start! https://smapi.io/log/9dc25fecf40f4792b2194356e4792acc
Log Info: SMAPI 4.1.10 with SDV 1.6.15 build 24356 on Unix 6.12.11.204, with 6 C# mods and 2 content packs.
Suggested fixes: One or more mods are out of date, consider updating them
(No need for help (for now), I just want to flex my errors)
.Choose Debris, Tiledata, Internal Descriptors, Icon, Design new Farmhouse Interior, Make Modpage.
Choose result: Internal Descriptors
... And now I've added custom audio. This is truly the mod that never ends
Well. I've created the audio. Haven't actually added it in or gotten it working yet. But it's a start!
Huh, this map has more features than I though now that i stop to list them all out.
New map?
The Farm Map I've been working on, I was stopping to list out all the features for the Nexus Page, and its longer than I thought.
Oh, cool. Also, how many "MathPerson"s are there? For awhile, I thought it was just one updating their name based on the mood
Ichor
Huh. Ok xD Thanks
Yup, four!
I stand Corrected
This was more confusing than it should have been to me, but I'm not good at remembering faces or usericons apparently
Four MathPersons of the apocalypse ๐
.Choose Debris, Tiledata, Icon, Farmhouse Interior.
Choose result: Icon
What does this mean and how can I fix it?
JSON error on line 60
Important note: Your computer username may appear in the log. If your username is your full name, please be aware of this before uploading it.
Please share your SMAPI log file. To do so:
- Open this page: smapi.io/log.
- Follow the instructions at the top of the page to upload the log file. (Don't copy & paste from the console window!)
- After uploading, it will show a green box with a URL to share. Post that URL here.
Please do it even if you don't see any errors. This has useful info like what mods and versions you have, what the mods are doing, etc. If the issue didnโt occur in your last session, please load the game to the point where the issue occurs, then upload the log.
probably a missing comma or something. You'll have to post the actual json to smapi if you want detailed help
!json
JSON is a standard format for machine-readable text files that's used by Stardew Valley mods.
If you need help with a JSON file, you can upload it to smapi.io/json to see automatic validation and share the link here.
When making mods, it's recommended to edit your files in a text editor with JSON support, such as VS Code, Notepad++, or Sublime Text. These programs will check for syntax errors.
What do you mean Stack.Append isn't in-place? What do you mean I have to use Stack.Push? Why aren't these the same method? Clown language ๐คก
(I know it's because IEnumerable has Append already)
Oops, couldn't parse that file. Make sure you share a valid SMAPI log.
you need to use the json uploader for JSONs for future reference
but your issue is in your Load tmx into Maps patch
you used a [ instead of a { before it
That's how it was before but it still didn't work
you absolutely need a { instead of a [
if it didnt work, it was a different error
things can "not work" in a ton of different ways when it comes to modding
good old missing } line 60
your Entries on line 56 is not properly closed
You didn't close the Entries block on line 56. You need a } between lines 58 and 59, yeah.
Oh okay
also at the end
That too!
ta the end where?
every { must have a matching } somewhere (same for [] and ()) unless its in a string (text inside quotes "like this")
so the one at the very bottom of your file will match the one at the very top
you should use a proper json editor to avoid this, there's probably a command here to direct you
the json command recommends them
Help? I added this key to my NPC's dialogue file but he has no reaction. Copied the key from Willy who does have a reaction. "fishCaught_163":"{{i18n:Russell_CaughtLegend}}",
I have notepad++
did you talk to them within 4 days of catching the legend for the first time that save file?
Yes I talked to him immediately after, no reaction, talk to Willy, he has one. Restarted the game, same result.
patch summary full may get you an idea of whether the patch has applied, what CTs are active, what mail flags are recorded, etc
!patchsummary
Can you do these steps to provide more info?
- Load your save and view the content that should be patched.
- Type
patch summarydirectly into the SMAPI window and press enter. - Upload your SMAPI log to https://smapi.io/log (see instructions on that page).
- Post the log link here.
patch summary full is the same thing but longer and more complete
if that doesn't give you an idea of CTs, then I know at least my More Conversation Topics mod has some commands that let you look at the CTs active
(I know patch summary definitely works for mail flags, which is what controls whether the CT dialogue is said more than once or not)
This is on the assumption it's CT-driven
If it's some other mechanism then idk
(CT is short for conversation topic)
pastDialogueEvents is separate from the mail box
so mail flags dont affect them at all unless a CT is only started according to a mail flag
but in a lot of cases its an autogenerated active dialogue event
which only checks that its new
at least pre-1.6, it would record a mail flag every time a specific NPC said their CT line
ran a patch summary on my fish response question and by all accounts it should be there
and check that mail flag to decide if it should say the CT line or not
nope, I was thinking that if Willy said it but not the NPC, then perhaps this is related to the mail flags recording the NPC as having already said it
have you also checked a) has Russell already said the line (per mail flags) and b) does Russell definitely have the dialogue line (patch export can verify this or you can check if the patch adding it applied)
other random things I can think of: is the capitalization correct?
wait I just may be a huge idiot
I don't think I "SAVED" the dialogue file before testing / restarting etc : /

and now I have to go catch legend for the 3rd time to be sure that's it
I hate to bother again but I'm having issues with swapping my edited map with the ingame one in the code.
are you trying to replace an entire map, or part of one?
The original joke was me and Elizabeth intentionally trying to confuse
oh and thank you by the way this was good advice
I just added a house to the forest map
This is part of my code for editing the town map if that's helpful { "Action": "EditMap", "Target": "Maps/Town", "FromFile": "assets/Locations/SheriffClosed.tmx", "ToArea": { "X": 70, "Y": 0, "Width": 8, "Height": 9 } },
otherwise try to be more specific about the problem you're having instead of just saying "having issues"
#twinning
She is the smarter mathperson
I was a math person, but then most of it left my brain
there are so many mathpersons 
"one of the mathperson always tells the truth, the other always lies"?
They kind of lost me after I started doing Fourier Series problems
I think I could call myself a mathperson as well, but I don't think Complex Analysis will help a lot here. Also doesn't fit in my username.
Former Math People Unite!
Hey, do any of you know what is worst than having your item show up with the error sprite?
Crash game by draw loop error
no texture at all ๐
at least you get somewhere to look into in this case
that's gonna be fun to debug
I have no drawing error, that's the worst case scenario
Apparently, stardew is the haven of mathpeople and former mathpeople
I mean, That still gives you info, less than you like, but info.
Another audio question: track length. For a music/ambient loop, how much is really too much? I've got an 14 minute clip that I'm going to cut down and loop before using, but I kinda want to know what my target should be
Ironically I was also heading to bed (for very few hours apparently) but thank you! Let me see if I can do this with what you've given (it's very comprehensive so I think I should be okay... I think)
Well anything more than like 20seconds is likely going to be streamed vorbis as an .ogg, so as long as your heart desires! (If you were worried about size) I'd say keep every part of the track that you find good ๐
Ok, thank you. Size is definitely the concern here, so it's good to know that I can let the .ogg files be a little longer
ok, so at least I know the mod actually gets its grubby hand on the correct Texture, they are not 0x0.
No but I'm messing with so many draw stuff that I'm not sure the menu is spared
Also I checked and the asset is properly requested
Oh shit I have a transpiler for drawInMenu
didn't even remember
Extremely new to coding. Is there a good resource for adding recipes?
but it's supposed to just override the source rect
!CP I guess
Content Patcher (https://www.nexusmods.com/stardewvalley/mods/1915) is a mod which loads content packs to change the game's images and data without replacing XNB files. If you want to make mods using Content Patcher, start at https://stardewvalleywiki.com/Modding:Content_Patcher.
Iโm just not sure if the one Iโm using is totally correct. It doesnโt specify the health + energy boost of the item
Determining health+energy would be on the item's data itself, not the recipe.
Edibility is the thing you need to update
These should be the relevant pages:
https://stardewvalleywiki.com/Modding:Recipe_data
https://stardewvalleywiki.com/Modding:Objects
It's probably picking a source rectangle that's transparent pixels, then. Or a source rectangle that's (0, 0, 0, 0).
huh, so since the new furniture items are defined by stuff like "DecorativeBarrel" instead of a Numerical ID, the game doesnt recognize them for placement using FarmhouseFurniture for starting Furniture, since it only takes int index.
yep, looks like the source rect of the layer it's supposed to read from is empty too
oh ok, so my parser shat the bed
every rectangle is empty
Wait.. are you reimplementing what the game already has built in?
Objects, as they appear in the menu, should automatically be parsed from Data/Objects, Data/BigCraftables, and Data/Furniture
FF violates Data/Furniture to work
What is added to Data/Furniture is parsed from Furniture Packs
Ah, I see so it's kind of like it's own abstraction of Data/Furniture
yup
ok, so I fixed that for now, now I have to figure out how bad I messed up the drawing coordinates
I wonder if u would have a easier time if u did write real furniture too
Realise it's too late to ask this question ofc
When you parse your custom model
Do you create a regular Data/Furniture entry as well
That's populated to best of ur ability
yep
Then it is just the mistek in rect i see 
I think I'm setting the rectangle size twice for drawinmenu, but I'll deal with that later
Does FF add different sizes than the ones supported by vanilla furniture types?
once when I write in Data/Furniture and another time via a transpiler in drawInMenu where I set the size instead of the ItemRegistry.GetDataOrErrorItem(furniture.QualifiedItemId).GetSourceRect()
For trinkets i require people to actually just go and make a regular old Data/Trinkets entry before they get to use my thing
So that i don't have to deal with this
It's too bad Furniture didn't switch to a proper data model or we'd have CustomFields for a lot of this stuff now
yeah, that's the point of FF
It's not too bad. I have a semi-decent/repeatable workflow that let's me convert it into a data model.
I think so, since the size in FF is defined by pixel but the size in Data/Furniture is by tile
But hey we can just open new custom asset with same key
well, you can fit a whole json in it 
This is how I'm dealing with CustomFields
https://github.com/LeFauxMatt/FauxCore/blob/708006982a2c373ead6db808867083d4bc16b194/FauxCommon/Integrations/ExpandedStorage/StorageData.cs
Then anything goes
I get what's usable as a proper data model, but with a backing string dictionary
And the nice part is this can be applied to mod data or custom fields without me having to do anything extra
This is a complex enough model for me to go custom asset time 
You did bush as custom asset i thought, was that just cus there's no Data/Bushes at all
It's mostly determined by whether I can do everything in a flat structure or not
I wouldn't do bushes using this because I need ItemDrops to be a thing
And in 2.0 I have a custom model for growth stages
im obligated to mention PowersData whenever someone says this
I would not touch something like Dialogue with a ten foot pole because the sub syntax in the string scares me
At least splitting on / is still easy for me to parse out just by looking at it
quick question for y'all, is there a way to slow down the farmer's walking speed in events? i see the "speed farmer <modifier>" command but it only takes integers, so i can't do 0.5 to move half as fast. anything above 1 speeds the farmer up.
join me in the Mod Authors Against Content and Content Packs group /lh
It just all seems like magic to me
I dunno what I'd actually want to do for dialogue though
Helpful Spouses is a dialogue heavy mod. The only way I can possibly imagine reviving it is if I could get help in that area.
People seem appeased/indentured by how it works rn
Same with event script, another great mystery
ok, enough FF debugging for today tonight
Indentured? I'm sure that's not the word you meant to use to describe it...
do all heart event scripts get cached in C# vars or do i need to .Load them all manually
locked in?
wdym by "cached in C# vars"?
Does -1 work
i'll check, brb
like Game1.objectData and stuff like that
ok setting the farmer speed for the event to -1 seems to do the same as setting it to 1
no heart event scripts are directly stored in variables afaik, you have to LoadString them, and also I'm pretty sure there's nothing explicitly marking an event as a "heart event" other than that one of its preconditions is a heart threshold
I know you can get the preconditions without loading the assets
wait, maybe i can do this?
foreach (var glocation in Game1.locations)
{
if (!glocation.TryGetLocationEvents(out _, out Dictionary<string, string> events))
continue;
foreach (var eventPair in events)```
`
What's a glocation? Glowing location?
oh i only meant events ๐ i call them all heart events because i'm silly, sorry!
I wonder if you could do something that's effectively like the slimed debuff to slow the player down temporarily
oh, yeah that works for all events
similar to what I do in map event markers if you want to have a look at that
i don't know how to apply a debuff using event scripting though
and just from my limited experience i don't think it would apply during the event anyway?
In Buffs at least you can set a negative speed which slows the player down
oh god I made the mistake of reopening the map event markers source code
why did I do it like that,,,
time for a rewrite

only thing i can think of to apply debuffs is having the farmer eat some food item that would slow them down
...well it works for the most part so I'm going to leave it as it is
I have some updates/tweaks I still haven't gotten around to adding anyway
I don't know if this is the best way, but it might work:
Custom buff to reduce speed here:
https://stardewvalleywiki.com/Modding:Buffs
Built in action to add/remove buffs:
https://stardewvalleywiki.com/Modding:Trigger_actions#Built-in_actions
AddBuff <buff ID> [milliseconds duration]
RemoveBuff <buff ID>
Combined with this perhaps

