#making-mods-general
1 messages Β· Page 37 of 1
they've been doing the "chat in modded-farmers" strat, you gotta step up your speedrun tactics smh
i have spoken outside of this channel like 5 times ever and im not about to change that
Hmm this could be useful; I already have a custom asset of string to item queries to EMC
is the 30min xp cd actually per channel then
not as far as i know
it would probably take you more than a minute to even send a non-spammy message in more than a few channels anyway
"unhandled exception"
it's in a try catch ???
why is it saying stackoverflow exception is another thing that's confusing me
I feel like I don't see that in VS warnings
it's a runtime thing
but i also dont know how bc thats just how vanilla does it
how is the number 4 overflowing an int32
OH
that does actually call base
and not the instance itself
Hey @loud ice, I just want to let you know that there's a feature on nexus that allows you to temporarily hide a mod page while updating. I am aware that you responded to my comment, but since the posts tab no longer exists, I have no idea what you said
Thanks for understanding ^^
hmmm
guess this might have to be gpl licensed
i have never been more annoyed that code I stole worked
Some exceptions cannot be caught
Stack overflows
Ave
Also oom
ah
Your homework for the week is to find out why
im guessing bc theyre low level?
i may have stolen other code that isnt gpl
it goes for hundreds of lines.. the same three stack trace lines..
oh the person was saying that didnt work
Mod load order question: I know SMAPI loads mods in alohabetical order, but is that using the mod ID or the folder name?
Trying to figure out what loads last between the various Seb mods
the order that mods are loaded is also going to depend on the dependencies of those mods
which one loads last can be altered by changing the dependencies or if its a CP mod then they can also alter patch priority
if there are no dependencies and no patch priorities then i believe smapi does use folder name
In the logs parser you can turn on trace
but even false/optional dependencies affect load order and altering the folder name of your mod is absolutely not the way to go about determining load priority
Not trying to alter it, just trying to get a read on what the current compat status is
Thanks!
you'll have to check each individual mod you're looking at compatibility for, then, to see if they affect the load order
Yep, that's what I'm doing
What prompted the question was trying to figure out which loads first between Xander's Seb Rework and mine, since their mod ID and foldername start with different letters and our mods are the same in terms of dependencies and priority otherwise
is this just for personal curiosity or for you to understand priority for a mod you're uploading, bc if its the latter its still not possible to reliably determine order bc a user installing your mod can just put their mods in different folders or rename them
It's so I can update the compat section of my mod description telling people what to expect if they have both downloaded
Is it not possible to make your mod compatible
So possibly the latter, though currently Im working with the assumption they keep the folders in the same place and don't rename them
Currently they can be compatible, but a couple of the dialogue lines are set for the same day so the question is 'will my dialogue be seen or theirs'
You can make sure another mod loads before yours with a false dependency if you want
I'm happy with not forcing my mod to load first, just want to know what the default order is in this case
If it's folder name, then I've got my answer
just to be clear, you checked more than just the other sebastian mod's dependencies right, and checked the patch priority for that specific dialogue patch
The dialogue patch itself doesn't have a priority set. Is there another way to check its current priority status?
if it doesnt have a priority then its just the default priority and i believe (but dont quote me on this) content patcher will use the smapi priorities as a tiebreaker i think. probably.
so you're fine then
Cool. Thanks!
why does this error on GameLocationUpdate(__instance); with
[ModifiableFruitRegion] Failed in DayUpdate_Prefix:
System.InvalidProgramException: Common Language Runtime detected an invalid program.
at GameLocationUpdate(FarmCave )
at ModifiableFruitRegion.ModEntry.DayUpdate_Prefix(Int32 dayOfMonth, FarmCave __instance
```?
```cs
var method = typeof(GameLocation).GetMethod("DayUpdate", AccessTools.all);
if (method is null)
{
_monitor.Log($"Failed to find base method in {nameof(DayUpdate_Prefix)}. Falling back to original code.", LogLevel.Error);
return true;
}
var dm = new DynamicMethod("GameLocationUpdate", null, new Type[] { typeof(FarmCave) }, typeof(FarmCave));
var gen = dm.GetILGenerator();
gen.Emit(OpCodes.Ldarg_0);
gen.Emit(OpCodes.Call, method);
gen.Emit(OpCodes.Ret);
var GameLocationUpdate = (Action<FarmCave>)dm.CreateDelegate(typeof(Action<FarmCave>));
GameLocationUpdate(__instance);
if (Game1.MasterPlayer.caveChoice.Value == 1)
im confused about what you are attempting and may need more information. also where does the Emit emit things by default, at the end or at the start?
(also im assuming that the if statement at the end is just cut off in your copy paste but is actually finished in your actual code?)
good question, the code is adapted from https://github.com/janxious/BT-WeaponRealizer/blob/89defeb47e9d45f144dc9013d98f31f879ae76ba/NumberOfShotsEnabler.cs#L24 / https://github.com/pardeike/Harmony/issues/83#issuecomment-414731064
the if is finished, yes
internal static bool DayUpdate_Prefix(int dayOfMonth, StardewValley.Locations.FarmCave __instance)
{
try
{
var method = typeof(GameLocation).GetMethod("DayUpdate", AccessTools.all);
if (method is null)
{
_monitor.Log($"Failed to find base method in {nameof(DayUpdate_Prefix)}. Falling back to original code.", LogLevel.Error);
return true;
}
var dm = new DynamicMethod("GameLocationUpdate", null, new Type[] { typeof(FarmCave) }, typeof(FarmCave));
var gen = dm.GetILGenerator();
gen.Emit(OpCodes.Ldarg_0);
gen.Emit(OpCodes.Call, method);
gen.Emit(OpCodes.Ret);
var GameLocationUpdate = (Action<FarmCave>)dm.CreateDelegate(typeof(Action<FarmCave>));
GameLocationUpdate(__instance);
if (Game1.MasterPlayer.caveChoice.Value == 1)
{
while (Game1.random.NextDouble() < 0.66)
{
string fruitId = Game1.random.Next(5) switch
{
0 => "296",
1 => "396",
2 => "406",
3 => "410",
_ => (Game1.random.NextDouble() < 0.1) ? "613" : Game1.random.Next(634, 639).ToString(),
};
PropertyValue customLocation = null!;
__instance.map.Properties.TryGetValue("FruitSpawningRegion", out customLocation!);
Vector2 v = new Vector2(
Game1.random.Next(1, // random between 1 & map width minus 1 - so theres 1 tile gap on each side
__instance.map.Layers[0].LayerWidth - 1),
Game1.random.Next(1, //random between 1 & map height minus 4 - so theres a 1 tile gap on the top and a 4 tile gap on the bottom
__instance.map.Layers[0].LayerHeight - 4));
if (customLocation != null)
{
_monitor.Log(customLocation.ToString(), LogLevel.Info);
}
SObject fruit = ItemRegistry.Create<SObject>("(O)" + fruitId);
fruit.IsSpawnedObject = true;
if (__instance.CanItemBePlacedHere(v)) // Confirm the area is placeable
{
__instance.setObject(v, fruit);
}
}
}
__instance.UpdateReadyFlag();
return false;
}
catch (Exception ex)
{
_monitor.Log($"Failed in {nameof(DayUpdate_Prefix)}:\n{ex}", LogLevel.Error);
return true;
}
}
so the IL is so you can call base.update()?
correct
does DynamicMethod's constructor actually allow null as the return type?
given that the code it's borrowed from seems to work I imagine so
DayUpdate accepts an argument, it doesnt look like you passed it
You only passed this (as ldarg0)
it does say it allows null if the method has no return type, but... i dont know what not having a return type means vs typeof(void), but i guess its fine anyway
Probably needs a ldarg1 before the call
it might need to be a Callvirt instead too
if this is just a prefix then could you just cast __instance to GameLocation?
would recursively call the prefix though
that doesn't work for whatever reason
sad
i'm patching FarmCave's DayUpdate
adding a ldarg1 and made it callvirt, but GameLocationUpdate only accepts the one argument - where would I define it to take more?
Add to the type array where you're defining it
oh the oid), new Type[] { typeof(FarmCave) }, t?
yeh
ahh
var dm = new DynamicMethod("GameLocationUpdate", typeof(void), new Type[] { typeof(FarmCave), typeof(int) }, typeof(FarmCave));
var gen = dm.GetILGenerator();
gen.Emit(OpCodes.Ldarg_0);
gen.Emit(OpCodes.Ldarg_1);
gen.Emit(OpCodes.Callvirt, method);
gen.Emit(OpCodes.Ret);
var GameLocationUpdate = (Action<FarmCave>)dm.CreateDelegate(typeof(Action<FarmCave>));
GameLocationUpdate(__instance, dayOfMonth);
still only takes 1 argument error
dynamicmethods still kind of confuse me even though ive been using them a bunch but
your GameLocationUpdate function's ldarg_0 might be itself, like it is for other non static functions
and ldarg_1 would be the __instance youre passing in
so you might need ldarg_1 and ldarg_2?
Actually the problem might be you need to update the Action type to Action<FarmCave, int>
it probably doesnt help that
Encapsulates a method that has a single parameter and does not retum a value.
yep, ty
Goes up to 16 apparently, not sure what happens if you need a function with 17 params
probably change it to accept an array of parameters instead
var method = typeof(GameLocation).GetMethod("DayUpdate", AccessTools.all);
if (method is null)
{
_monitor.Log($"Failed to find base method in {nameof(DayUpdate_Prefix)}. Falling back to original code.", LogLevel.Error);
return true;
}
var dm = new DynamicMethod("GameLocationUpdate", typeof(void), new Type[] { typeof(FarmCave), typeof(int) }, typeof(FarmCave));
var gen = dm.GetILGenerator();
gen.Emit(OpCodes.Ldarg_0);
gen.Emit(OpCodes.Ldarg_1);
gen.Emit(OpCodes.Ldarg_2);
gen.Emit(OpCodes.Callvirt, method);
gen.Emit(OpCodes.Ret);
var GameLocationUpdate = (Action<FarmCave, int>)dm.CreateDelegate(typeof(Action<FarmCave, int>));
GameLocationUpdate(__instance, dayOfMonth);
same runtime error
[ModifiableFruitRegion] Failed in DayUpdate_Prefix:
System.InvalidProgramException: Common Language Runtime detected an invalid program.
at GameLocationUpdate(FarmCave , Int32 )
at ModifiableFruitRegion.ModEntry.DayUpdate_Prefix(Int32 dayOfMonth, FarmCave __instance)
too many params
if its a method on an instance then the ldarg_0 isnt being passed as a parameter
it should be calling the callvirt with ldarg 1 and 2 on the method found on ldarg 0
that said i dont know what the error is bc i still struggle to understand whats going on
wait maybe you need to define the parameters? i dont know if thats actually necessary or not
the code was based on the GitHub link though, which seems to do stuff like that
Try just removing the ldarg2 line
removing ldarg 2 is just a recursive stackoverflow
SMAPI just tried to do Synchronizing 'NewDay' task...
Stack overflow.
at MonoMod.RuntimeDetour.Platforms.DetourRuntimeNETCore30Platform.CompileMethodHook(IntPtr, IntPtr, CORINFO_METHOD_INFO ByRef, UInt32, Byte* ByRef, UInt64 ByRef)
at DynamicClass.GameLocationUpdate(StardewValley.Locations.FarmCave, Int32)
at ModifiableFruitRegion.ModEntry.DayUpdate_Prefix(Int32, StardewValley.Locations.FarmCave)
at DynamicClass.StardewValley.Locations.FarmCave.DayUpdate_PatchedBy<Pillow.ModifiableFruitRegion>(StardewValley.Locations.FarmCave, Int32)
at ModifiableFruitRegion.ModEntry.DayUpdate_Prefix(Int32, StardewValley.Locations.FarmCave)
at DynamicClass.StardewValley.Locations.FarmCave.DayUpdate_PatchedBy<Pillow.ModifiableFruitRegion>(StardewValley.Locations.FarmCave, Int32)
at ModifiableFruitRegion.ModEntry.DayUpdate_Prefix(Int32, StardewValley.Locations.FarmCave)
at DynamicClass.StardewValley.Locations.FarmCave.DayUpdate_PatchedBy<Pillow.ModifiableFruitRegion>(StardewValley.Locations.FarmCave, Int32)
well we're getting somewhere at least
now try changing callvirt back to call
i did that just before you sent it
and i get through the night at least
it works!!
tysm!!
great! that was useful for me as well, getting a reliable method of calling base functions in prefixes in inherited class
still kinda sucks the only good way to do so in Harmony is to use a Reverse Patch or handrolling IL
but handrolling il is fun! 
anybody know if theres a knockback limit for weapons?
I have some lava logic code need help with I think
SVE has a sword with like 999 knockback that basically teleports hit enemies to the other side of the map
hmm ok
Why
A mod that lets you add trade items to the pet adoption shop:
https://www.nexusmods.com/stardewvalley/mods/28000
Why the fuck would you not cache the fucking method
oh do you mean the ```cs
var method = typeof(GameLocation).GetMethod("DayUpdate", AccessTools.all);
if (method is null)
{
_monitor.Log($"Failed to find base method in {nameof(DayUpdate_Prefix)}. Falling back to original code.", LogLevel.Error);
return true;
}
var dm = new DynamicMethod("GameLocationUpdate", typeof(void), new Type[] { typeof(FarmCave), typeof(int) }, typeof(FarmCave));
var gen = dm.GetILGenerator();
gen.Emit(OpCodes.Ldarg_0);
gen.Emit(OpCodes.Ldarg_1);
gen.Emit(OpCodes.Call, method);
gen.Emit(OpCodes.Ret);
var GameLocationUpdate = (Action<FarmCave, int>)dm.CreateDelegate(typeof(Action<FarmCave, int>));
I guess it published at some point while I was away from my computer finally lmao
Nice round number
Yeah lol, got lucky
i just stalk newly uploaded mods waiting for a nice number opportunity
then it turns out the number you wanted was taken long ago by a WIP mod
(but i get a number even if it's private...)
i just stalk newly uploaded mods
and not necessarily look for a nice number
how would this happen when looking ahead of newly created mods
you dont have to publish to get a number
If someone were to create like 3 unpublished pages real quick or something
In order to snipe that good number
right, but im pretty sure you cant claim 28000 before 27900-27999 exist
for example, this mod
ah yeah didnt think it through lol, I should correct it to "someone doing the same thing as you snagging your wanted number"
(you may also stalk mods with that if you want^)
gonna really mess up the number snipers when i publish my mod in 2025 with an id of 16000 and they go try and claim 16001
but we r almost 30k
at 28033
yeah but i initially made the page for it back in march 2023. just neverp ublished it
Jeez, i remember passing 10k
Can someone tell me how the fishing sprites work? And how I can code them in and everything? (Please ping btw)
for random.Next, if it's given 1 and 3, it could return 1,2 or 3, right?
oh no itd be 1 or 2
#making-mods-general message hopefully this take you to it properly, sometimes I can't with how bad discord is
it does! thank you!
10k what
wow another new mod!! https://www.nexusmods.com/stardewvalley/mods/28034
Nexus page ID
The idea of the bats neatly organizing them in the center of the cave is very funny to me
it's absolutely bonkers. my wobbly cat (published march 20) is 20557
i had it queued up a day or two ahead of time, so that's right about where sdv nexus was at the release
i completely forgot that 1.6 released in march
When did 1.6.8 release
28 April 2024.
Working up the energy to do the Nexus release and BBcode slog in a day or two, but in the meantime, figured I'd share my white whale, finally harpooned: https://github.com/focustense/StardewFishingSea
I'm hoping someone way cooler then me can help me figure this one out, I've basically tried everything I can think of:
oops, probably a bad format to use
try that again
I cannot for the life of me make it stop lightening the entire map drastically at 8pm on my procedurally generated maps
I can adjust the light level to 0 and then i can't make it dark at all (it seems to ignore ambient light completely then), or I can set ambient light and it's dark until 8pm and always brightens like in the video, and no property or setting i can find seems to make any difference
are you doing anything wacky (e.g. running a shader) with rendering, or just using like ambientLight?
I've tried setting the indoor lighting property by hand and by adding a map property (again via code since there isn't a tmx file in this case)
both react the same way
the maps I load via tmx file work fine, it's just these ones I build via c# code that do this
if I debug, the ambient light color value is correct (in fact it stays exactly the same at 1950 and 2000 hours, no change at all in the Game1.ambientLight value, but clearly it renders completely differently)
I even added an _updateAmbientLighting method and force set it to a specific value, still no change in behavior at all
hmm. i would guess it has something to do with the light map, but i'm not sure what exactly
I did go through the loadMap method line by line and try to make sure i was doing all the same steps it is, maybe I'll go one step deeper and look at the MapLoader class
(i had a similar effect in beta with my shader mod, which caused terrible flashbangs when it hit the evening time and the light map suddenly kicked in)
that involved the light map setting the world texture to some kind of different state which the shader was not equipped to handle
something about the light map being subtractive color or similar
so if the light map is being activated at exactly 8 pm you could be hitting a weird rendering corner case. not sure what to suggest about it, though, sorry
yeah, I assumed it was flopping from additive to subtractive, but even if I set the AmbientNightLight it doesn't work, and i tried "reversing" the values there
I'll see if there is something specific about the light map i can find
I might also try loading a blank tmx map or something and then adding from there if I can (the problem there is getting a valid path to do the load with)
since it expects a file path and not a in memory resource when you call loadMap
The crafting (cooking technically) station refuses to use the dynamicrule >< why do you refuse my context tag 
I think someone mentioned you need spacecore to make cooking use a context tag? but maybe that was only in the case of cooking recipes?
its for the better crafting dynamic rules, trying to use the context tag gsq with it... but right now I probably did something and the no matter what the dynamic rule is, it refuses to appear
I don't see anything about being able to use context tags
BC can filter items by GSQs
are you using the right target? I think it's Target and not Input
BC can filter items by item query, then using the peritemcondition, I could use the context tag one
Used both to test out ><
out of interest, what are the map properties? you may be missing a flag to use/ignore lighting
uhh post your code I suppose?
I will try to have a clean save - since my test file has made ALL dynamic rules disappear, even the ones by BC already
I've tried a few sets, so because it's a location I'm building in code, originally I had the location isOutdoors = false, isFarm = false and isGreenhouse = false, and indoorLightColor = <color> and indoorLightNightColor (? i think, might be rmisremembering that one) set to <color> as well. Since then I've tried variations on indoorLightColor and indoorLightNightColor, i've tried light levels of various ranges. After awhile I decided to try setting the map property directly for AmbientLight. Right now based on ichor's suggestion I'm looking at various settings and basically force updating the Game1.ambientLight based on the isDarkOut method, and I'm getting some results at least, so now I'm playing around with that
originally though I didn't have any "map properties" at all, because I jsut set them all on the location to begin with
even though I'm not outdoors I've tried "ignoreOutdoorLighting both true and false as well (this didn't seem to do much, which wasn't a shock :P)
Selph and atra already provided this person with some options for getting a list of all the items in game, but if anyone else has any thoughts they're willing to share I'm sure they would be grateful: #1284189032930349127 message
They're certainly asking for a lot, an info dump of everything basically not just items and easy too? I decompiled that Stardew Web mod and it's enormous, the amount of stuff it does to create that functionality is insane
oddly maps like FarmCave get by just fine with no map properties set at all. maybe you're inadvertently replacing the default behaviour by setting things to false/null/other?
oh wait i didnt read the 2nd message
maybe a python script that just parses Data/Objects and dumps the important stuff (id, description, category, etc.) will suffice
does patch export include things locked behind conditions
it'll include the data, which includes the conditions (unless set in CP When)
If it's a vanilla condition and not a CP When that's unfulfilled
CP conditions? no, but I'd be rather concerned for mods that lock items behind CP patch
When conditions is what i meant yeah
unless you export directly from CP's content pack data, that's just how it'll be
When conditions might just change other data too (like context tags which is somthing they want too)
Yeah, wanting a list of everything that's neatly organised without having to do any scripting seems like a gigantic stretch lol
without any scripting is just impossible though without writing things down by hand lol
Kinda seems more like a modded farmers question to ask if anyone had heard of a mod that would do what they wanted than a support question lol
yeah
For the record
What I suggested is literally six lines of python
Chatgpt could probably write it successfully
But python D:
π
(I just don't know python, I have nothing against it)
i have nothing legitimate against python. only vibes (i Don't Like It)
Please #programmers-off-topic for the python hatefest
Thanks everyone that has given me enough info to be able to take back to them 
first time ive seen atra be the one to shuffle ppl into programming off topic first /lh
python is fun and lovely
{
"Action": "EditData",
"Target": "Mods/leclair.bettercrafting/Rules",
"Entries": {
"KSS.Sauce": {
"Id": "KSS.Sauce",
"DisplayName": "Test",
"Icon": {
"Type": "Item",
"ItemId": "(O)605",
},
"Rules": [
{
"ItemId": "RANDOM_ITEMS (O)",
"PerItemCondition": "ITEM_CONTEXT_TAG Target kss_saucepickle"
}
]
},
I'm currently experimenting with a lot of lighting values and settings that change by time so I can see different configurations in effect quickly to figure out what seems to have an impact and what doesn't π
hacky, but it works /shrug
python solves my problems and writes thousands of lines of json and merges hundreds of spritesheets faster than i could make a coffee and i like that
the rule now really refuses to appear, I probably did an oops somewhere 9-9
did you copy this directly from your json or did you retype it cause what you've got here is missing braces which might be why its just not appearing at all now
i was trying to find missing braces but it's very very very very hard when the indentation is flattened hahah
pcon (pancake object notation)
https://smapi.io/json/none/fffaeb416e514c87acd696e8068061c1
better here π I was having problems having it load
did better crafting note any issues in your log?
nope, but let me replicate to get a pretty log π red time
fk it whatevs
python o-o
and just realized I made a typo in Cooking
So this dynamic rule, is it supposed to show up even if it doesn't match anything?
I have an item to match it tho, so I am not sure - I really need to stop being [ENTER] key trigger happy
What am I looking at 0.0
You are so lovely 
yes, python's beautiful, isn't it π
someone in modded-tech-support wanted a way to parse all items* in game in a readable fashion, so that script's for doing just that
*only includes Data/Objects. I am not doing the other stuff lmao
just to clarify, you seem to be trying to set up a category containing recipes that cook that item. You do have that recipe right
yes, the recipe is loading correctly too
and the categories show up, but the recipe's not in them?
did you move the json that has your category into a different json but didnt add it to an Include
does it show up when you're trying to add a dynamic category
you might want to share your content pack in a compressed zip file here for people to run and test themselves
This uses CP so it should show up in a patch summary yeah?
the list of categories are saved per player, it might not get updated on an existing save
(disclaimer: I'm only guessing from experience using BC as a player)
and yeah check that too
yeah I believe so
I made a new one now to test, the thing is also wanting to incorporate the dynamic rule into a custom crafting station
but baby steps vv
time for a patch summary π load #21 of game launching
The eternal debug cycle
uh, it worked?
https://smapi.io/log/fd171a2958464a82a705d57b58c78a99
????
???????
Log Info: SMAPI 4.0.8 with SDV 1.6.8 build 24119 on Microsoft Windows 10 Home, with 10 C# mods and 2 content packs.
Suggested fixes: One or more mods are out of date, consider updating them
I am now even more confused
It just wanted to mess with you I guess
was this a new save or existing one?
maybe the rules were wrong before lol
but yeah, BC saves the player's list of categories into its directory, and categories added via the CP rule will only be added on a fresh save, or when you clear the config
if you go into BC's folder, find the data for your old save and yeet it, then it should work
hmm now to figure out how to use it, if I can, on a custom crafting station
I am yeeting the old save data before I continue
the crafting station asset has a Categories field, so probably that?
how come nobody seems to ping pathos these days
surely i'm not the only one with extremely specific and destructive requests (and very dumb questions)
how can i casually and offhandedly throw them in here when i'm the only one pinging
I only ping if I have bug reports, and I haven't found any for a while
(because I don't play on 1.6.9 lol, I get access mainly to fix my mods)
the thought of thinking i had something worth pinging about but then being corrected and being told that i was mistaken instead would keep me up at night forever after
oh you get used to it after a few (a lot)
(also, im not smart enough to ever be sure if what ive found is a bug or im just misunderstanding behaviour, and the few times ive ended up being sure, someone else pinged pathos before i did)
i'm a frequent caller on the stardew modding helpline π
(I actually do have a bug, but that would require an annoying rework of how machines work so it's out of scope)
(and it's so insignificant it isn't really worth fixing)
so if you (for some reason) have a machine rule that inputs 3 coal, and the machine itself takes 2 coal as fuel
the machine will eat 5 coals per run
however if you only have 3 coal in your inventory the game checks that you have 3 coal for the input rule (which you do), as well as have 2 coal for the fuel (which you also do, technically), and as a result allows you to proceed with 3 coal
like I said, so insignificant, but would require a rather annoying rework just to accommodate super edge cases
I don't understand the info here, do you guys know how I could I code the spouse patio?
the Category model do expect some fields, you probably have to replicate them?
https://github.com/KhloeLeclair/StardewMods/blob/f66ae9967f40deb23dcf695c16ce3c99f62e3624/BetterCrafting/Models/Category.cs#L13
DynamicRuleData looks promising
I should maybe ask Khloe if that is actually possible for the custom crafting stations 
Oh nevermind, looks like I got it
i pinged pathos not that long ago about what i'm pretty sure is bugs in the Child draw routines (certain hats cause jump offset to fail to work, and hats do not respect the child's drawOnTop value), but it doesn't affect vanilla content so there was no interest.
(i also usually phrase my questions like this as "is this intended behavior" rather than presuming it's a bug)
i usually phrase my questions as an apology
i wonder if farmer overhead held items still use the wrong offset when jumping
(its json5 that ignores trailing commas)
yeah i don't think trailing commas specifically are in jsonc style
c is sadly for comment, not comma 
Is there any other difference between json5 and jsonc?
Ooh it doesn't complain about multi-line strings, apparently
im pretty sure jsonc just adds comment support. json5 is closer to what newtonsoft uses, though its not quite the same, but the differences are, i think, very very very unlikely to come up
I learn something everyday in here
json5 will also make vsc not complain about using single quotes around strings
i'm surprised to see someone using VSCode here specifically, but it is pretty good with content pack modding
does it actually build/deploy content packs?
i think a lot of people in here use VSCode
I always use vs code for content pack mods
i say build/deploy since building solution in VSCommunity sends the files to your mod folder from your working folder
are you confusing it with just Visual Studio?
Most people just edit directly the mods folder one
I am writing my mod in my mods folder
VSC meaning visual studio code
I don't see any reason to have a separate working folder
My SpaceCore content syntax highlighter works in VSCode but I couldn't get it working in VS, so...
does opt to keep a separate working folder personally but I get why folks dont
separate working folder means i can have a .git outside of my mods folder hahah
i work on my mods in working folders (where the .git repos are) and use make to build and/or install them to my mods folder
My .git is just inside my mods folder
it's so much cleaner having a separate working folder
plus it zips my releases up for me haha
Eh, it's not that big of a deal for content packs
You don't have obj/bin folders for example
- the mod build config only works for C# mods
(There is the recent PR that makes it able to deploy additional content packs...)
VS does create and obj+bin folder for content packs when built, comes with your zipped-up release
it's a little time saver
I guess, but at the same time you have to restart the game for edits
If you edit in the mod folder you can patch reload
that's true
(Or patch reload specific file once Pathos releases the version with my PR)
on the other hand, if you build solution without debugging and launch smapi separately, you can rebuild and patch reload as you like
the only time i dont edit my content pack mod just inside my mods folder is when that content pack is packaged with a C# complement mod anyway
I symlink my content-only mods to keep everything in the same repo
and keep the live reloading
VS22 is more resource-intensive than VSC and I can't afford to have it open much lol
somehow even after so many years i still live in fear of symlink
i know you can't ruin things with it but it feels like i should
That's weird, the association I have is just json to jsonc. I can't find anything saying I'm using json5
did you just tell vsc to specifically ignore trailing commas like, separately
Maybe... not sure where to find that lol
Oh I figured it out, it's the content patcher schema
How do I use the CP schema? I am not enjoying the json5 lack of error checking
"$schema": "https://smapi.io/schemas/content-patcher.json",
I just put this on my first line after the {
# yaml-language-server: $schema=https://smapi.io/schemas/content-patcher.json
Put that at the top of the file
Oh wait, you're talking about JSON. Silly me. 
Sorry linkoid I am not ready to learn YAML yet :)
If I see people needing help with it, I'll definitely become familiar with it, but I actually like all the brackets lmao
Except the ones at the bottom, those suck when you don't have validation
No, I totally understand. YAML is too powerful. 
Ooh I was able to set up the schema for my whole workspace so I don't need to have it in individual files
Oh nice, though does that also get put on manifests?
Yup lol
Well, that's a little unfortunate lol
I barely look at my manifest though
I'm just trying to reduce the number of warnings to an amount that's manageable so I can see warnings I actually care about in each file
Yeah it is kind of a just a copy paste, rewrite, close forever situation
It is going to tell me I am missing the "Format" field in every file though
Until you need to update I guess
Oh yeah, that's true, it doesn't like included files lol
So I still have pretty yellow file names lol
is there such a thing as a warning you care about
Lol
i thought we called those errors
woooo my category thing works 
but I still gotta add the recipe to the recipes part :(
Yes, there is. Duplicate key. Warning in VSC, problem for me.
Oh yeah, that is a warning huh, I guess it doesn't break the json, just overwrites usually
Yup and I just discovered one from something I'd copied from the modding wiki because I removed all the trailing comma warnings, yay
i suppose that's pretty important as far as warnings go 
I have been procrastinating actually doing any schedule work with all this 
It's just my normal absolute mess xD
That means you have invalid JSON
Well, my file is about 90% comments - how does your converter handle them?
Because the actual JSON in my file is fine
It converts the comments to YAML comments
Unless you found the perfect syntax to trigger a bug in my converter.
I'll try removing the comments
It was the comments that your converter was displeased with
:/
It was happy enough to convert this to this
Huh
Comments work for me (although they are disappearing, which they aren't suppose to do that)
It has an issue with multi-line comments
Complained about this
/* Laaaaa
laaAAAAA
aaaa!
*/
{
"Changes":
[
{
"LogName": "Hiria Schedule",
"Action": "EditData",
"Target": "Characters/schedules/Aba.Hiria",
"Entries": {
"spring": "0630 {{ModID}}_Campervan 11 5 0/0730 {{ModID}}_NationalPark 32 28 2/1030 {{ModID}}_NationalPark 26 52 1/1800 Forest 93 39 2/2100 Saloon 26 22 3",
"marriage_spring_2": "0700 {{ModID}}_NationalPark 32 28 2/1200 {{ModID}}_NationalPark 18 17 0/1700 Farm 74 17 3/2200 bed",
"marriage_Mon": "0700 {{ModID}}_NationalPark 32 32 2/1200 {{ModID}}_NationalPark 14 19 0/1700 Saloon 22 22 0",
}
}
]
}
thats probably bc the comment is outside the json structure
Ahh yeah that might be it
putting the multi line comment inside it is fine for this converter
Yes okay that was the problem
tbh i didnt expect normal jsonc to be fine with that either
A shame because I've definitely seen a few people do that lol
I have 55 lines of comments before the json structure
I put comments before the json in every file I make
And it works fine?
Yup, completely.
to be fair, smapi's json parser is very, very lenient
you could write your files in crayon and it'll put them on the fridge
SMAPI's json parser is just Newtonsoft.JSON
Favorite parent
(I have also just released a mod update with comments outside the json structure because I didn't know that was even a potential problem haha)
which is exactly what my converter uses
Oh, I see
The YAML writer is throwing the error, not the JSON deserializer.
It's less fun committing code crimes when you don't know they are crimes
Then it's just being inept :(
I guess now that I know it's a crime I can just go "tee hee" to myself every time I write a comment at the top or bottom of my files
TIL, seems like a microsoft related thing. newtonsoft.json's homepage doesn't even mention it supports jsonc
comments are definitely not standard in most parsers/serializers, as it wasn't part of the json spec
its documentation does say it can handle comments though. you can even have it load them instead of ignoring them for... whatever reason
system.text.json also supports comments
hi! i wanna start making mods for content patcher, but the sdv wiki article on it is really vague, and i don't have have any experience coding in json. does anyone have any like good guides i can use?
What sort of mod do you want to make?
hey guys. do yall know if theres a mod that lets you upgrade the farmhouse instantly? im about to test some upgradeable PIF rooms but skipping days until robin's done is a bit of a hassle
Don't need a mod. Just type debug houseupgrade X in the SMAPI window, where X is 1, 2, or 3 depending on the house upgrade level you want.
ahh i didnt know that. thanks!
I usually try to leave the house before doing it though because otherwise you have to noclip out of the void lol
eh thats fine i have noclip on when testing all the time anyways haha
Fair. I don't when testing maps because I need to be able to check my collision stuff.
i only turn it off when i do that specifically. its just that since ive been doing big map mods i need to go places fast with the amount of rivers i keep putting in!
Haha that makes sense. Do you use CJB Cheats to set your speed higher too? I have a +8 speed buff when testing.
I have fixed the problem. Give the github runner a few minutes to update the website and it should work even with comments at the top of the file. It will still throw an error if the entire file is a comment, but nothing I can do about that.
Edit: nvm it already updated it. that was fast...
i keep forgetting to do that! i have a separate move speed mod though. i just use cjb to change weather/days/seasons
i feel like map makers using speed +10 and noclip mode is going to lead to some very unknowingly hard-to-navigate fams hahah
i definitely have messed up on collisions bc i forgot to check them without noclip, but i personally have a fixed map size standards for my maps and try to make the layout flow as well as possible haha
i try to not have my maps have any dead ends and multiple paths to take, with exceptions like the island in cliffside cove
just wanna start off adding some new items, mainly for my own personal use, like adding better coffee, etc.
I don't know of any tutorials for adding items, unfortunately, but the wiki page for items, the 1.6 migration page, and the content patcher documentation are all good pages to look at - and other than that I'd really recommend downloading a mod that adds items and look at what they do.
https://stardewvalleywiki.com/Modding:Items
https://stardewvalleywiki.com/Modding:Migrate_to_Stardew_Valley_1.6#Custom_items
https://github.com/Pathoschild/StardewMods/blob/develop/ContentPatcher/docs/author-guide/action-editdata.md
thanks!
It doesn't complain anymore and it does show all the comments that exist in my file before the json structure but is still deleting all the comments that I put inside the json.
yeah, that'll take more work to fix
there's a good smattering of crops mods out there, and they add a lot of new items. you could look at those, too
Nauuuur I definitely need to put the recipe names 
that's actually really helpful, I'll have to check those out
thanks for the help!
you're welcome :D
I want a working fast forward mod! Time to learn how to decompile and poke at mods.
please understand that time travel is a delicate affair
it sounds so simple, and yet
scheduling.....
It sounds like it's asking for problems, to me, but I am willing to ask for problems if it means I don't have to sit around all day waiting for Hiria to get from her home to the busstop.
debug hurry Hiria ?
(https://stardewvalleywiki.com/Modding:Console_commands#Movement_and_warping_2)
Hmmm I could try that and try changing the time. Let me check if that works.
Yay, that works perfectly when I don't have to check pathing, thanks!
Too bad the idea I was trying didn't work and instead Hiria just walked off into the void lol
yep, it won't help if you need to time your chara as they run from A to B or find which way they take, but it's better than nothing 
Yay my idea did work after all. Temporary invisibility!
Drat, it's too fragile. I won't be able to use it.
racking my brains for extra room ideas... i've made an upgradeable PIF attic and this room that can be used as a laundry/toilet/closet/mudroom or something like it
maybe another bathroom layout? a pantry? there's already quite a lot of PIF cellars out there so i won't be making any though!
If you're interested in input from a PIF user, I would personally like more normal house storey layouts because I use the Upper Hall and not any of the others because I just want spaces to put furniture in, not greenhouses or cellars or anything.
(Floorplans might be a better word for what I meant lol)
ooh i see! i'll save that suggestion for another pack!
im working specifically on tiny rooms for this pack
(what is PIF)
It sounds like what you're already making is something I would be keen on too
PIF is a framework for new rooms in your farmhouse.It's especially useful on tiny farms and in multiplayer, as time stops in that room on days when the player didn't play.Access to your pe
the most banger mod ive used in recent times /lh
(ooh I see. thank you!)
PIF is great for when you have custom farmhouse layouts and want to add more and more rooms
I like it because I don't have to have a custom farmhouse downloaded
No worrying about whether the farmhouse creator understands renovation compatibility or anything
i could definitely work on new floorplans yeah
PIF makes my sims 4 builder heart very happy
this too! but for me it's bc i prefer using small custom farmhouses, and adding rooms just makes my farmers' houses more personal? like it's their farmhouse despite for example using the same modded farmhouse
and having separate rooms you can access adds more immersion imo
Yeah I enjoy it and I'm glad you're making more rooms for it. I'll definitely download yours once it's out!
oh i know what i should add... a boiler room
wanted to have one to place my furnaces and forging related stuff in... mine are currently in the cellar (also used as a pantry) and it's bothering me haha
(I also assumed it was Personal Indoor Framework, but apparently the name on GitLab is Personal Indoor Farm)
Hi, I don't know if anyone on here but I scoured the net and the stardew game files and I am struggling to locate what controls the mayonnaise reactions.
I was thinking of adding reactions to other items as well, but am unsure how it was done
like how it's crafted or villagers' comments on it when gifted?
villgers comments. I found the dialog strings but not the trigger, what calls the strings
iirc mayo reaction is hardcoded and dependent on age and manners and social anxiety and specific NPCs
Dang I suspected it might be hardcoded
unless you do just mean when gifted. i assumed you meant when they see you eat it
Yah when they see you eat it
then yes that is hardcoded
π¦
in Farmer.performDrinkAnimation i think if you care to look if you know C# and wanna try and patch it
Hmm. I do know C# maybe I'll take a look at it, thanks π
hii I met a c# problem. I cant use helper.readconfig to initialize config in constructor of modEntry public ModEntry() because it will cause error. And then, annoying warning about "if para includes null" appears. I compeletly know what is that meaning and actually it never causes error because I finish ini in override void Entry.I just want to know ,if I close that warning, will it appear in others smapi when they use my mod? and how can I solve this warning in case of not closing it?
Now for its disappearing, I declare it like private ModConfig? Config and call like config ?? new ModConfig(). Effective but stupid
Is there a framework for 1.6 which makes animated furniture possible?
"Furniture Framework" claims that it can: "Support for animated base Sprite and Layers"
update: so that was a lie. i ended up merging the boiler room with a cellar lmao
Thank you I'll check it out
is it feasible to add custom type persistent locations yet? or are we still sorta stuck
working on previews... im pretty satisfied with how the rooms turned out!
Looks like two very cozy nooks 
thanks! they're a pack of tiny rooms for PIF! decided to stop at 5 before i get too carried away lol
is there a guide somewhere on adding my own location context? all I can find is adding the location itself but nothing about context...
There's the wiki info: https://stardewvalleywiki.com/Modding:Migrate_to_Stardew_Valley_1.6#Custom_location_contexts
awesome thanks!
im trying to make my custom location have certain weather upon first visit, like how ginger island is always sunny. though i dont quite understand how to do that...
from what i can tell, it's sunny in ginger island because of a mail flag. not sure if i have to do the same thing here or if there's another way
Would anyone know the debug command for unlocking the greenhouse in RSV?
hmmm setting condition to !PLAYER_VISITED_LOCATION locationname should do it... theoretically. i'll need to test this out
Thank you, I was able to (sortof) figure it out by teleporting there, but if I moved I would be forced out straight away. But it made do thank you for the help though, Jen :)
i.. have no idea how that helped you as i was just musing to myself trying to fix my own problem
right now smapi is giving me red and i have no idea what it means
ah
Your player visited location GSQ needs a player argument I expect. Something like Current or Any.
ooh ok i will add that in
Needs to go before the location name btw
When a command on the wiki has <these> around the argument that means it's required. [Square brackets] means it's optional.
In MP, only the first player to visit will get guaranteed weather if you use Any. (Just FYI in case that's not the behaviour you want.)
So I should use Current instead of I want it to apply to all players?
You can't actually get what you want
Weather is host determative
If you want something like "always X weather at first visit" you have to pick from
"Always X weather until all players have visited"
Or "always x weather until at least one player has visited"
Aww darn. Sorry I didn't know it was host determined only.
Then "All" is what you want, going off the wiki
kk I'll keep it as is
Hey, I'm new to modding so just trying to implement a simple tool to start. I've edited the Data/Tools file to add a new entry and the tool is showing up (I can add it to my inventory using player_add) and the texture is loading but it's saying it's an error item and not loading the description. I can't work out why when the other proprties are loading fine. Can of course share code but thought it may be an obvious issue π
you'll want to share either the code or the error log so someone can see where you may have gone wrong. It can be any number of things that aren't obvious until code is seen.
Sweet. I scanned the error long and doesn't seem like there's much there. What's the best way to share code?
you can plug the file here https://smapi.io/json
and share a link or add 3 of these ` to make a section of code.
like this
I will say that custom tools via data/tools are finicky
I'm open to alternative ways it just seemed to be what made sense for me to do π
here's the code regardless
Nah, I haven't converted my 1.5.6 tools to 1.6 yet but I recall having to do a lot a very obnoxious harmony to get it to work
sounds like a good learning experience for me? π
hopefully someone online can help you, if not you can try asking again later. I for one am not it with c# yet. lol
okay sounds good. I'm in no rush maybe I'll even figure it out!
good luck π
Your tool class name is probably making it a return scepter btw
You will at the very least have to specify your assembly
And register custom subclasses with spacecore
And I'm pretty sure you have to patch the code that generates the tool
So. Do you really want a tool. Or would an item and intercepting the right click action work
Because the later is easier
By far
is there a mod that can force certian events to happen? i need something like that so i can test a texture i made. specifically for the giant stump so i need to trigger the wind storm event to knock it down.
Anyways I'm going to work so have funnnnnnnn!!!!!!
have you looked at console commands? https://stardewvalleywiki.com/Modding:Console_commands#Festivals_and_events
Could do this. It's all about learning the basis for me so trying to do things step by step. Registering it and have it appear correctly in the inventory is step 1.
https://www.nexusmods.com/stardewvalley/mods/27242 this might help?
thank you
all you would need to do is use CJB cheats menu to set greenhouse to completed and sleep one night to trigger it with this. i think
i will give this a try
Wind storm event only has a 10% chance to trigger on the night of a sunny day. Not really the most reliable testing method
A console command would be better
Ok it doesn't need to be sunny but it's still only a 10% chance
okay. i just need to figure out what the spesfic command is
im not seeing a command for wind storm on the wiki
if it's an even you would need to lookup the event id in like data or something

alright. i will see if i can find it
not seeing it in the data files
i found a list of event ids on the wiki so that's very useful.
that will be very useful for later testing
im still not seeing this spesfic event which is annoying. perhaps because it is part of the latest update
it's out now!! a mini pack of versatile tiny rooms (+some extra features) for PIF 
yeah, its gotta have an event id. the wiki probably just hasn't beenupdated to include it
these are cute!
agreed!
this is def annoying. is there another way to get the id?
i tried doing it with event repeater and nothing showed up...

at this point itd be better to just do the other method
complete greenhouse via cjb, sleep until it triggers
(this mod specifically removes the RNG from that event)
tedious but i will keep trying. thanks
i have it open on my main save but i dont want to mess with the season on that file
i got it to happen. thanks for the help!

Nevermind I found what I was looking for. To continue from yesterday I found this: https://www.nexusmods.com/stardewvalley/mods/20357 to make my openable letters
https://www.nexusmods.com/stardewvalley/mods/26402 - Faeries Horticulture now comes with exclusive Custom Mixed Seeds all available at Krobus which can be traded for with somewhat rare items. No more buying the seeds directly, now you have to rely on luck! (or the item spawner)
Can I include some text in a config for the player to see if they don't use GMCM? For example, "this must be a multiple of 10 between 10 and 150 or it will not work"
i'd just make the backing field 1 to 15
well the validation will just be a console error saying "you didn't set your config right, the function is turning off"
I mean, if the player does not use GMCM, runs the game to generate a config, then goes and edits it with notepad++ and sets whatever value (10000 or something), running the game again can clamp that value to 150?
the code makes sense. Thank you!
Hey, so I'm trying to update a mod - what should I open in visual studio to do so? If I open the .csprog file it gives an error and if I just open the folder I can edit the files but I can't build the project. The mod is Custom Monster Floors.
how familiar are you with C# (modding related or no)
I know basic programming, but I've never used C# (or visual studio)
In that case this will be helpful:
https://stardewvalleywiki.com/Modding:Modder_Guide/Get_Started
I've been following that, but that's more about creating your own mod than editing someone else's
Do you get errors when building or you just straight up can't build?
just straight up doesn't give the option to (at least, the same option given when making my own mod)
and you imported the project folder into VS?
I think so. I opened the folder containing it with VS - if I try to open the actual .csprog file it gives an error (the mod I'm editing was one in a collection of many and it seems like it wants the other mod files to work)
here is what the interface looks like - the stuff in the console is from trying the build option
Delete the bin and obj folders
Make sure implicit using are disabled
This is all part of updating to net 6 btw pretty normal
Don't think anyone wrote up instructions
oh alright
so it is the right folder and stuff it's just not building because of errors?
You also have a packages.config
I think so, yeah. Should I do anything with it?
okay, so I deleted the bin and obj folders but it seems like they get remade whenever I try to build it. Was that just to generate new ones? Also, I put "<ImplicitUsings>disable</ImplicitUsings>" in the csprog folder - is that how I disable it?
Ok, scratch everything else I've said. It's now only giving me one error, which is that an assets file wasn't found and that I should run a NuGet package restore to fix it. I don't see an option to do a package restore, though. Under tools/package manager it only gives the option for the console and settings. How should I do the package restore?
eyyy, my first int slider config. Thank you for the help!
This thing is scope creeping a lot from my original intent to be more universally useful than specific to my exact farm.
Does someone know where the drinking animations went?. (The ones on the farmer sheet no longer work when replaced.)
Hi all, anyone know how to work weather appearance mechanics? I tried this for hats in rain:
{
"Id": "Hat Mechanic",
"Condition": "WEATHER TARGET (Rain, Storm, GreenRain)",
"Season": "Summer, Spring, Fall",
"Indoors": true,
"Outdoors": true,
"Portrait": "Portraits/Sebastian_Hat",
"Sprite": "Characters/Sebastian_hat",
"IsIslandAttire": false,
"Weather": "Storm, Rain, GreenRain",
"Precedence": -1000,
"Weight": 0
}```
Unfortunately it's still only showing the default outfit for that day
while i dojnt know about the "Weather" field specifically, it might be because your Condition is not written like a GSQ should be and so will not be true, so the outfit cant apply
WEATHER Target Rain Storm GreenRain
it looks like the Appearance section doesnt even have a Weather field? so im not sure why thats there
Those seasons also don't work iirc
atra is also right it looks like it only takes one
You know what I don't think I even needed a season
as long as winter overrides it with a priority of -3000
Appearance data doesn't have a weather field as far as i'm aware
yeah I'm not sure how that got there
I copied this from old code I had when it was working before I introduced a random outfits mechanic
but I must have done it wrong even then
IT WORKS NOW!
You guys fix stuff instantly
thank you so much
I think this is what broke it because I tried several formats for weather but never thought of removing multiple seasons
Currently looking into how I could make these preview images compatible with menu recolours/portrait replacements (currently I load a premade image, but I want to construct the image from game assets instead)
Right now I'm pretty stuck on how I can get the scroll and particularly the text on the scroll
But I guess I can screw around with the remaining stuff in the meantime
Hi folks! I seem to be having some trouble with xnb unpacking programs. I used to use XNB Extract, but that seems to have stopped working after 1.6.
The Wiki recommends StardewXNBHack, but when I run it, it just generates a bunch of red error text.
"Unhandled exception: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types."
etc etc.
It's in the Stardew Valley folder where it's supposed to be.
I then tried the xnbcli program the wiki mentions, and it also does nothing. It behaves like XNB extract does these days -- The program runs, but delivers no unpacked file and shows no error messages. I'm kind of at a loss. Is there something I'm missing?
Did you make sure StardewXnbHack.exe was in the Stardew Valley folder and not just the folder it comes in?
Yep.
And also you have the latest SDV and SMAPI installed?
To the best of my knowledge. Let me check my SMAPI version rq
Knowing which versions of everything you're using will be my next question lol
Currently in the beta for 1.6.9 and so things are pretty specific at the moment as to what version of each you need
Sneaky buggers updated SMAPI on my earlier this month. Let's see if that helps
Aaaand the new version won't install...bbs
Which version of each are you trying to use?
Remember to use correct version of stardewxnbhack
Need the prerelease (1.1.1?) for 1.6.9
1.1.1 for SDV 1.6.9 and SMAPI 4.1.0 but 1.1.0 for SDV 1.6.8 and SMAPI 4.0.8
I only saw one version available? Where are the different versions found?
StardewXnbHack is all on the github releases page
That's where I went, but I'll look again.
SMAPI has several mirror locations, but I think you can only get 4.1.0 from Nexus?
Am I missing something or does drawing text via SpriteBatch.DrawString() ignore the alpha value from the color argument?
SDV 1.6.9 requires joining the private beta on Steam
But I suggest sticking with 1.6.8 unless you need a feature that's specifically in 1.6.9 or are trying to make sure your mod won't need anything extra to work in 1.6.9
I have the 1.1.0 version it looks like
Yeah
Are you pass in something like Color.White * 0.5f
Ahh, Sokath, his eyes uncovered. Many thanks. Let's see how that works
Iβve tried hardcoded values like new Color(255, 0, 0, 0) and itβs still fully opaque.
The color is a mask, hence why you need to pass in a grey to draw transparency
Check your spritebatch
There is at least one setting that disables transparency iirc
It works! Thank you!
Oh, so there's no way to actually get a fully white text label with transparency?
it's gonna be premultiplied alpha, isn't it
so if you want to draw anything at some alpha, you want to multiply ALL 4 Color components by the alpha
You're not using the built-in game function to draw that scroll?
Nope, wanting to learn how to do that though ahaha
I made them myself just cobbling the parts together in an image editor
It's all in SpriteFont.
Oohh okay, I'll have a look
Wait, let me double-check... that might be the text without the banner. There's definitely a method for it though.
Yep, just figured that out. That works! Thanks for the help! π
Sorry, I had a brain fart. SpriteText, not SpriteFont.
Specifically, you want SpriteText.drawStringHorizontallyCenteredAt.
(I don't use it, personally, that's why I forgot, but I do still use the Cursors image; definitely do not make your own version of the background if you want it to be compatible with recolors.)
Absolutely, I'll hopefully get that going once I make the rest work ahaha
You might have some trouble with the fact that the margins are too tight in your version. But looks like you've got enough white space to work with, you can space out the portraits and their titles a bit.
Gotcha! I can totally give that a spin
I'll have more questions for sure though (especially since I'm not sure how to go from create text on scroll -> place scroll in image)
But I can probably at least "make scroll with text" successfully now ahaha
Oooooh okay
I guess what I mean is how I'll have that scroll with text display in the GMCM menu above the portrait previews side-by-side
Ugh, I keep getting all these horribly named functions confused (that's why I didn't use it).
Correction again, the function you probably want is drawStringWithScrollCenteredAt (or just drawString which takes a param for it)
There's a whole bunch of very similar and all goofily named functions in there, one of them will be the want you want, haha
As far as the GMCM stuff specifically, although I'm moving away from all that, you're just drawing on a SpriteBatch for a custom item so it shouldn't be anything special.
Ahaha I'll surely be able to find it with this guidance!
Hmmm okay, I'll keep that in mind
I feel like every other corner you turn when looking in Stardew's files you get springobjects or LooseSprites/Cursors levels of shenaniganry and disorganization
But this is some good direction for navigating that shenaniganry, so thanks much!
The image is in cursors, although the font is not.
You can use Cursors directly if you prefer (I do), but you'll need a way to nine-patch (which Stardew doesn't give you).
That doesn't sound fun ahaha
Depends on your hobbies, maybe. For you, probably not that fun.
Is the portrait bg sprite smaller than portrait then 
Those portraits look accurately-sized to me - as in the original size of both the background and the portrait.
The portrait sprite skates very close to the margins but that's actually normal.
I'm gonna just. not think about the possibility of Portraiture compat 
Chu was asking me about that some weeks ago and I'm reasonably sure that Portraiture does some very low-level patching that actually looks for the source rectangle of the portrait being drawn to a sprite batch, and replaces it with its own.
It's very likely to be compatible with anything that draws portraits if those portraits are being drawn the normal way.
So far I've been setting it up to not actually draw the portrait, just to grab a portrait texture loaded from elsewhere
(granted I haven't finished enough to test it yet)
? you have to draw it in order for it to be on the screen.
Draw means draw to sprite batch. Literally calling Draw. Not like... setting pixels one by one, or something like that, if that's what you were imagining.
Oh I meant "drawn the normal way" draw I think
Not terribly good with the vocab I'm afraid
Portraiture patches SpriteBatch.Draw. You're definitely using that.
Whether you're using it in the way that Portraiture understands... that's another question. But most code does.
Oh not in what I was doing so far, I didn't even know of the existence of SpriteBatch until just now
I was planning to just reconstruct the static images I originally had ahaha
Not an effective implementation by any means though
You may not have been paying attention to it, but you surely cannot build the UI you just posted a screenshot of without calling that method.
It's in there somewhere.
Not a single pixel goes on the screen without a SpriteBatch being involved. (At least, not any pixels we care about)
Did silicon mean draw as in "I made those sprites with border and text et al in aseprite then load & show it"
I forget if gmcm had a image option that you are using rn
But now u will need the custom option for sure 
Oh. I'm just remembering now that GMCM has that AddImage which takes a texture and rectangle. So it's basically a tiny wrapper around SpriteBatch that technically hides the SpriteBatch.
Ahhh that's what was puzzling me
I was using the built-in AddImage, yep
So I was starting to wonder how I'd have that use a SpriteBatch (I'm assuming now that the answer is that I don't)
Yeeeaah... GMCM isn't going to give you a nine-patch on the Cursors image so the scaling will suck, unless Casey wants to add one.
You have to use the SpriteText function and do a "complex" option.
I wouldn't mind if you just omit the scroll for time being
Esp cus now you can just draw only the active portrait
So it'd be intuitive which one is "on"
Hmmm I do want to have the "off" portrait visible so people can see their options
Unchecking a box is free
Anyway, even if the portrait itself continues to use GMCM's AddImage, that's still just doing SpriteBatch.Draw underneath, so it makes no difference for mods like Portraiture. The scroll kinda has to be a direct draw, though.
Unfortunately it doesn't live update with my setup so people would have to leave the screen and come back
I stripped all the parts that did do that from focustense's example ahaha
You have to watch for the field change in GMCM. Basically, without a lot of weird hacks, you can have it reflect live changes to Image options (since you control the texture) and Complex options (since you control the draw) but none of the vanilla GMCM widgets.
Even though GMCM calls it "Complex", it's really not that different from an Image.
Only difference is the essentially 1 line of code for GMCM to draw to the sprite batch for you, vs. you doing it yourself.
This is some C# scoping thing that I'm not 100% sure about, but I think the draw delegate can have access to the Config object?
So it'd just be If Config.Alt then draw A else B
The draw delegate can have access to anything you want it to. That's why a complex option can live-update.
Yay closures 
It's the other way around that doesn't work; if you add, say, a drop-down list to GMCM, and then update the underlying config value, there is no way to tell GMCM to sync the dropdown list to reflect the updated value.
Yeah no events rip
(I say "no way", but of course I mean "no way short of the eye-watering hacks I did before")
I may as well become better friends with "Complex" GMCM options and SpriteBatches in any case
(GMCM 2.0 looms, in the distance)
Well, you know, I do have some experience with this now if you're looking for help... (though I'm sure you prefer to fly solo anyway)
I wonder how MCM type mods work in other games 
(they don't I think)
SkyUI is based on (ugh) Flash.
Hm.
Though the MCM API is much simpler.
I want to add auto registering for simple configs to 2.0
Like registering based on public properties
Atra had one of those things in PYE. I yeeted it... didn't see the point of a bunch of reflection to replace 5 lines of code.
(with all due respect, of course)
I feel it's gotta be more controlled than that
A question, I'm trying to include $q, $r, and $p in my dialogue and VSCode is screaming at me in red saying it's got an unexpected string end of string and a supposed expected comma
(I use the wiki as reference so I'm a lil confused)
Well, I can't really use attributes with pintail stuff can I?
Maybe if it only auto register a wrapper generic class props
Yeah, it is kinda error-prone once you get into enums, unless you want to establish a translation system.
did you forget to escape some quotes in your strings
Can u include the class def in the IApi file and expect it to work over pintail
I don't know
Adventure awaits
Pintail does not do classes. Period.
(Except for those in shared assemblies, obviously.)
Unfort
You can't use attributes sorta
I guess it depends how deep you're willing to get into reflection and conventions.
Like, when we write analyzers/codegens, we often write them to depend on an attribute with some name irrespective of the actual type.
(Because the analyzer itself can't have any library dependencies)
So, if the user defines their own attributes with an agreed-upon name like RangeAttribute, and you use reflection to break through pintail's proxy and get the target object, then...
What if you make ppl write their gmcm in spacecore content lang
(Then a lot of people wouldn't use it)
can i ping u at my thread 
feel free!
If you really, really wanted to do this auto-detect-with-customization thing, and you're willing to do pierce Pintail's proxy (which you pretty much have to do regardless), then you'd most likely do it the way Newtonsoft handles serialization extensions, e.g. allow the config class to define methods like GetFooMin/GetFooMax/GetFooRange. That way you don't need shared attributes, and the user doesn't have to create them.
(I'm still skeptical of the value of this relative to the cost of maintaining it, but YOLO)
Localization sounds like a huge headache, though, since you don't have access to their translations.
In theory they could pass in their ITranslationHelper I guess
But that's a Future Casey problem
is there a really simple way of accessing another mod's translations? because i use an extremely not simple way
I've used reflection on the object returned by the mod registry to get it before
I assume the not-simple way involves a lot of reflection.
presuming the other mod isn't willingly giving it away
oh yes
my favourite flavour of reflection: smapi core methods
that's pretty much what i'm doing but with a couple extra steps added
Probably the least obnoxious (but still fairly obnoxious) way to do it would be to get the API, assuming they provide one, and then do what Casey said, just reflect on it to get its Helper and thereby its Translations.
oh right this is what i was going to ping pathos to ask about lol
but i lost the courage since it's an awful thing to do
If they don't provide an API then they're probably not prepared to have their mod messed with.
You don't even have to get the API - just Helper.ModRegistry.Get( modId ); and then reflect on that
I was doing this for a content pack I believe
So the C# component could leave everything in the CP component
yeah i keep my translations in the CP component too
Huh. IModInfo is the actual entry mod?
wow i thought i was the only person dumb or crazy enough to do this lol
we're both stupid 
It stores the relevant mod/pack on the IModInfo impl if I remember correctly
It's just an object containing a Manifest and IsContentPack.
Ah, yeah, it was recently I did this
Surprising that the implementation would store the whole graph behind it.
i reflect smapi > modregistry > get (uniqueid) > directorypath > smapi > readtranslationfiles (directorypath/i18n) > translations > get
Getting the helper is so much easier
now that you mention it i really don't need to get the modregistry entry by reflection, but that's just a trivial part of this awful solution lol
I've also used it to get textures: https://github.com/spacechase0/StardewValleyMods/blob/develop/SpaceShared/Util.cs#L20-L40
anyway i would've wanted to ask pathos if we could simply get the translation entries from another mod through SMAPI's modhelper without needing to reflect
we now have 2 users with the use case!!
it's a case
What were the main arguments against such a thing 
Pathos probably won't go for it if I had to guess
Hasn't it been proposed before and rejected for the same reason you can't just grab another mod's content.json and such?
Since it'd be relying on mod internals (the translation data)
a) it's fucked
b) something about mod compartmentability
like we can still do it without, it's just probably a very naughty thing to do
Yeah, the basic idea is that mods get to choose what's public and private. If you want to violate that and reflect on their internals, that's on you, it's your responsibility if they break.
if it were a normal thing to do we wouldn't be discussing it in shady corners like we are now
#making-mods-general is a shady corner, you heard it here first
it is though, even most people in #modded-stardew have us blocked lol
I have vague feel that mod translation should be content though
I mean, most people in modded farmers don't make mods
So it makes sense to mute this channel
sure but they're cousins yknow
you can understand that 99% of people have us muted, but our cousins too...
my children
And you can't access the private content of another mod. If the mod wants to add those translations to game strings, then you don't need SMAPI to help.
So you can't (or shouldn't) access *.png of another mod but they should have choice to expose it
well the choice to expose it is the content pipeline
There's not really a standard way to do it 
Yes. If you framed it that way, Pathos might go for it.
Besides targeting String/whatever I suppose
i think for one mod or another i pushed all my strings into a content file and referenced that from elsewhere
As in "can we have an API to make our strings public like we make other assets public".... but on the other hand that kind of already exists?
You could just load Strings/{{ModID}}
but it's just more convenient to use i18n directly in c# since you often want to do things like tokenisation
But then you have to repeat all the ones you do public
And Pathos doesn't like implicit behavior
it has been and it was
Yeah it is default private 
(Hence why I did things a certain way with passthrough tokens for include patches)
Unlike textures which tend to be public unless someone goes for internal asset key with intention
man i just came here to beg for an answer about whether we can feasibly do persistent custom type locations yet and now my OTHER stupid topic's taken over
Textures are considerably scarier because of ownership.
oh that was last night lol, no i have no idea
You just register it with the SpaceCore serializer and set the appropriate field in Data/Locations I think
peeks in
i'd argue textures don't tend to be public, for the most part c# mods still have it way easier ignoring the content pipeline entirely
"CreateOnLoad": {
"MapPath": "Maps\\CommunityCenter_Ruins",
"Type": "StardewValley.Locations.CommunityCenter",
"AlwaysActive": false
},
@ blueberry
hi atra, this is the clandestine side of my code which u once described as pretty and nice
or someone did, it feels like you did lol
Content edits on the other hand are a pain with C#, But you can't embed CP in a C# mod hence why I made my content engine stuff
i'm sure i tried with custom types here when 1.6 landed and it didn't work, maybe i'm misremembering
Let me look at the code calling type
something something only checking for stardewvalley types
Did you try adding ", AssemblyName" to it?
Or did Pathos change that to be an assembly specific check like with tools
Yeah it should still be fine
i didn't, i suppose i can try again now since i just assumed it didn't work
Just do "MyMod.MyLocation, MyModAssemblyName"
Assuming MyMod namespace and MyLocation class name of course
and also i don't know if SDV handles custom locations with removed assemblies quite as gracefully as it handles removed custom items
That's why you register it with the SpaceCore serializer
It stores it outside the save




i'll have to try again
(Also won't serialize at all without that step but anyways)
(Unless you inject it yourself into the serializer)
see it'll be nice if this works since it sucks having static classes for my location behaviour haha
https://github.com/Pathoschild/SMAPI/issues/954
https://github.com/Pathoschild/SMAPI/issues/955
(the convo has moved on a bit ofc but re: the translations stuff. i dont feel like searching for the convo that happened after in the channel tho feel free to find it yourself if you're more curious but i wouldnt get hopes up about not havin to reflect to get i18n in the future)
you can do typeof(CustomLocationClass).AssemblyQualifiedName
but what if CP
(that's presumably just to get the qualified name that you use in cp)
Look, I have no free time rn to think about things
i sure hope button's harmony thing doesnt let you make whole ass classes
i havent been paying too much attention im half distracted by a movie so i dont even know what y'all are talkin about
it's best if you don't think about this thing, it's a very bad idea lol
that's a good couple of links tho button, pretty much directly answers what i was wondering
very vindicating to see #making-mods-general is officially the smapi feature proposals channel so i'm allowed to say dumb ideas
Cecil when π
I wanna mark everything noinlining
(Not literally everything)
Just, you know, a few functions I had to write transpilers for instead
same (just woke up from a 4 hour food coma)
(Just got home from work lol)
same (i got out of bed because these questions keep me up)
Ugh, didn't realize I had to put the mod description in the actual discord message that gets published. Oh well, next time.
I got a "the code actually worked how I wanted" jumpscare
With immediate feedback implemented successfully I think the scrolls can be scrapped
Now to return to finangling the images ahaha
@next plaza: look into marriage schedules with your 0 schedule fix (6d ago)
Remind me in 24 hours to look into this
heh heh I hope it's not too important... nefarious grin (#6255645) (24h | <t:1727049117>)
Will Casey do it this time or delay it- and the answer is delay it
Bit of a noob here. So I decompiled the game code (Stardew Valley.dll), found stuff I wanted edit, and know c# so know how to alter the code to get it to do what I want.
But how do I get a mod to edit the methods in the .dll file, Is the possible? Struggling to find guides on that part.
you need to use harmony for that
do tell us what you want to edit though, might be alternate ways
Thank you both. I am playing around with performDrinkAnimation to see if I can add more reactions to different items
I'm not making many breakthroughs in terms of assembling this image 
I'm guessing I ought to be using SpriteBatch and not attempting to construct a Texture2D somehow
In which case I gotta figure out how to SpriteBatch
Thanks to @brittle pasture and @uncut viper , owe you guys a beer. if (!Game1.Player.CanMove) return; did the trick
you just need to call draw twice
i wanted to add a sort of icon over the items that players bind to key binds but man that is a nightmare
Ooh could I know more about that (if there is much more to know)
Because I don't know what that means ahah
i swear i remember there being some guide to making a menu item for modconfig menu
for my mod
how do i do this
or if anyone has link, much thanks
you can look at DialogBox.drawPortrait ig, but i just mean you would call b.Draw for the portrait bg sprite (from mouse cursors) then call b.Draw for your portrait
Oohh okay, would that be using the Complex config?
Okay thanks much!!!! I think I get it
so a harmony postfix will work yes, but there is a event for drink animation that you can listen, game itself uses it
drinkAnimationEvent.onEvent += performDrinkAnimation;
need reflection to access drinkAnimationEvent ofc
oh god that's in there?
the mayo drink reaction is in there for some reason yea
Not too sure how this works
reflection or harmony 
you might need to give a little more info haha
Haha sorry, was googling reflection, not sure how a lot of this works tbh. So you can use drinkAnimationEvent.onEvent to listen for when the game uses performDrinkAnimation and then create code that reacts right? But can this react to specific items used as well?
so you need to obtain instance of Game1.player.drinkAnimationEvent, which is private
yeah, if you added one it could react to specific items, just the way that the base game's one does
ah yea i always forget smapi has reflection helper 
here's a quick example that should work as you hope:
public override void Entry(IModHelper helper)
{
var netEvent = helper.Reflection.GetField<NetEvent1Field<Object, NetRef<Object>>>(Game1.player, "drinkAnimationEvent").GetValue();
netEvent.onEvent += this.OnDrink;
}
public void OnDrink(StardewValley.Object o)
{
if (o.ItemId == "24" || o.Name == "Parsnip")
{
this.doParsnipBehaviour();
}
}
although you might need to delay the reference to Game1.player until helper.Events.GameLoop.GameLaunched if it's null at this stage
GameLaunched is also an event, so you can add another method with += just the same as with netEvent.onEvent
i thought Game1.player was non-null even at the title menu?
non null but the wrong instance
this is an instance method
(also, just fyi, hooking an event like this prevents the gc from eating. This is probably fine here but would be a problem if you tried this on, say, minelevel.)
how else would you add an event handler 
Glad you asked! Let me find the nonsense
oh great, nonsense! i'm curious
(I run the event handler through a small class I make sure to retain no hard references to.)
I'm a nerd
nerd herd 
I think I have a fundamenatlly bad understanding of spritebatch because I don't really get how to use it with GMCM
would you like an incredibly convoluted example?
Yes!!
I work best with examples (even if they may be so convoluted that maybe I reconsider how well I work with them)
i think this is my only ComplexOption mod and it's probably the worst mod i have
if you're on 1.6.8.x you can download loc to see how it looks (#modded-stardew message) but it just broke in 1.6.9 today
ok it's added to the game correctly from data/locations, i just needed to use its full full full name including QualifiedName, AssemblyName, Version, Culture, PublicKeyToken
i have a complex option example as well if you would like another https://github.com/ichortower/Nightshade/blob/dev/src/GMCM.cs
That's weird, I thought it only needed type name and assembly name 
QualifiedName and QualifiedName, AssemblyName wouldn't work
Good to know though
thats what AssemblyQualifiedName returns i think
yep 
i always wondered what Culture means though
