#making-mods-general

1 messages Β· Page 37 of 1

finite ginkgo
#

No slack, only judge

brittle pasture
#

they've been doing the "chat in modded-farmers" strat, you gotta step up your speedrun tactics smh

uncut viper
#

i have spoken outside of this channel like 5 times ever and im not about to change that

brittle pasture
#

Hmm this could be useful; I already have a custom asset of string to item queries to EMC

lucid iron
#

is the 30min xp cd actually per channel then

uncut viper
#

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

iron ridge
#

"unhandled exception"
it's in a try catch ???

tender bloom
#

why is it saying stackoverflow exception is another thing that's confusing me

#

I feel like I don't see that in VS warnings

iron ridge
#

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

drowsy pewter
#

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

loud ice
#

Oh I don’t know

#

:0

#

I go ahead and private it

drowsy pewter
#

Thanks for understanding ^^

loud ice
#

Ofc

#

I am artist my self, I don’t like when person use my stuff

#

:p

iron ridge
#

hmmm
guess this might have to be gpl licensed

loud ice
#

I release a mod too early

#

To summarize it

iron ridge
calm nebula
#

Stack overflows

#

Ave

#

Also oom

iron ridge
#

ah

calm nebula
#

Your homework for the week is to find out why

iron ridge
#

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

proven spindle
#

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

uncut viper
#

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

lucid iron
#

In the logs parser you can turn on trace

uncut viper
#

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

proven spindle
#

Not trying to alter it, just trying to get a read on what the current compat status is

#

Thanks!

uncut viper
#

you'll have to check each individual mod you're looking at compatibility for, then, to see if they affect the load order

proven spindle
#

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

uncut viper
#

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

proven spindle
#

It's so I can update the compat section of my mod description telling people what to expect if they have both downloaded

lucid iron
#

Is it not possible to make your mod compatible

proven spindle
#

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'

lucid iron
#

You can make sure another mod loads before yours with a false dependency if you want

proven spindle
#

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

uncut viper
#

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

proven spindle
#

The dialogue patch itself doesn't have a priority set. Is there another way to check its current priority status?

uncut viper
#

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

proven spindle
#

Cool. Thanks!

iron ridge
#

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)
uncut viper
#

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?)

iron ridge
#

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;

            }
        }
brittle pasture
#

so the IL is so you can call base.update()?

iron ridge
#

correct

uncut viper
#

does DynamicMethod's constructor actually allow null as the return type?

iron ridge
#

given that the code it's borrowed from seems to work I imagine so

brittle pasture
#

DayUpdate accepts an argument, it doesnt look like you passed it

#

You only passed this (as ldarg0)

uncut viper
#

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

brittle pasture
#

Probably needs a ldarg1 before the call

uncut viper
#

it might need to be a Callvirt instead too

lucid iron
#

if this is just a prefix then could you just cast __instance to GameLocation?

iron ridge
brittle pasture
#

that doesn't work for whatever reason

lucid iron
#

sad

iron ridge
#

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?

brittle pasture
#

Add to the type array where you're defining it

uncut viper
#

you created GameLocationUpdate

#

specifically the first type array

iron ridge
#

oh the oid), new Type[] { typeof(FarmCave) }, t?

brittle pasture
#

yeh

iron ridge
#

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

uncut viper
#

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?

brittle pasture
#

Actually the problem might be you need to update the Action type to Action<FarmCave, int>

iron ridge
#

it probably doesnt help that

Encapsulates a method that has a single parameter and does not retum a value.

brittle pasture
#

Goes up to 16 apparently, not sure what happens if you need a function with 17 params

uncut viper
#

probably change it to accept an array of parameters instead

iron ridge
#
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)
brittle pasture
#

too many params

uncut viper
#

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

iron ridge
#

so do I remove ldarg 0

#

or 2?

uncut viper
#

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

brittle pasture
#

the code was based on the GitHub link though, which seems to do stuff like that
Try just removing the ldarg2 line

iron ridge
#

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)
brittle pasture
#

well we're getting somewhere at least
now try changing callvirt back to call

iron ridge
#

i did that just before you sent it

#

and i get through the night at least

#

it works!!
tysm!!

brittle pasture
#

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

uncut viper
#

but handrolling il is fun! SDVpuffersmile

zealous drift
#

anybody know if theres a knockback limit for weapons?

old edge
#

I have some lava logic code need help with I think

brittle pasture
zealous drift
#

hmm ok

rancid temple
calm nebula
#

Why the fuck would you not cache the fucking method

iron ridge
#

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>));
rancid temple
#

I guess it published at some point while I was away from my computer finally lmao

rancid temple
#

Yeah lol, got lucky

uncut viper
#

i just stalk newly uploaded mods waiting for a nice number opportunity

brittle pasture
#

then it turns out the number you wanted was taken long ago by a WIP mod

velvet narwhal
#

(but i get a number even if it's private...)

iron ridge
#

and not necessarily look for a nice number

uncut viper
iron ridge
#

you dont have to publish to get a number

rancid temple
#

If someone were to create like 3 unpublished pages real quick or something

#

In order to snipe that good number

uncut viper
#

right, but im pretty sure you cant claim 28000 before 27900-27999 exist

iron ridge
#

for example, this mod

brittle pasture
uncut viper
#

that would be much more likely

#

thankfully has not happened to me SDVpufferthumbsup im too fast

iron ridge
uncut viper
#

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

lucid iron
#

but we r almost 30k

iron ridge
#

at 28033

uncut viper
#

yeah but i initially made the page for it back in march 2023. just neverp ublished it

tender bloom
#

Jeez, i remember passing 10k

uncut viper
#

so itll be 16000 in New eventually

#

we've gone up like 8000 just since 1.6 alone

eternal mortar
#

Can someone tell me how the fishing sprites work? And how I can code them in and everything? (Please ping btw)

iron ridge
#

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

rancid temple
eternal mortar
#

it does! thank you!

calm nebula
iron ridge
rancid temple
#

The idea of the bats neatly organizing them in the center of the cave is very funny to me

tiny zealot
#

i had it queued up a day or two ahead of time, so that's right about where sdv nexus was at the release

velvet narwhal
#

i completely forgot that 1.6 released in march

calm nebula
#

When did 1.6.8 release

velvet narwhal
#

28 April 2024.

teal bridge
nova gale
#

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

tiny zealot
#

are you doing anything wacky (e.g. running a shader) with rendering, or just using like ambientLight?

nova gale
#

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

tiny zealot
#

hmm. i would guess it has something to do with the light map, but i'm not sure what exactly

nova gale
#

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

tiny zealot
#

(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

nova gale
#

interesting

#

I'll see if I can find anything on that front

tiny zealot
#

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

nova gale
#

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

tardy adder
#

The crafting (cooking technically) station refuses to use the dynamicrule >< why do you refuse my context tag SDVpufferknife

nova gale
#

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?

tardy adder
#

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

rancid temple
#

I don't see anything about being able to use context tags

brittle pasture
#

BC can filter items by GSQs

#

are you using the right target? I think it's Target and not Input

tardy adder
#

BC can filter items by item query, then using the peritemcondition, I could use the context tag one

tardy adder
brave fable
# nova gale

out of interest, what are the map properties? you may be missing a flag to use/ignore lighting

brittle pasture
#

uhh post your code I suppose?

tardy adder
#

I will try to have a clean save - since my test file has made ALL dynamic rules disappear, even the ones by BC already

nova gale
# brave fable out of interest, what are the map properties? you may be missing a flag to use/i...

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)

vernal crest
#

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

faint ingot
#

spending all my time making schedules nobody will ever see πŸ˜›

rancid temple
brave fable
brittle pasture
uncut viper
#

does patch export include things locked behind conditions

brave fable
#

it'll include the data, which includes the conditions (unless set in CP When)

rancid temple
#

If it's a vanilla condition and not a CP When that's unfulfilled

brittle pasture
#

CP conditions? no, but I'd be rather concerned for mods that lock items behind CP patch

uncut viper
#

When conditions is what i meant yeah

brave fable
#

unless you export directly from CP's content pack data, that's just how it'll be

uncut viper
#

When conditions might just change other data too (like context tags which is somthing they want too)

vernal crest
brave fable
#

without any scripting is just impossible though without writing things down by hand lol

rancid temple
#

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

drowsy pewter
#

yeah

calm nebula
#

For the record

#

What I suggested is literally six lines of python

#

Chatgpt could probably write it successfully

rancid temple
#

But python D:

calm nebula
#

🐍

rancid temple
#

(I just don't know python, I have nothing against it)

tiny zealot
#

i have nothing legitimate against python. only vibes (i Don't Like It)

calm nebula
vernal crest
#

Thanks everyone that has given me enough info to be able to take back to them SDVpufferheart

uncut viper
#

first time ive seen atra be the one to shuffle ppl into programming off topic first /lh

brave fable
#

python is fun and lovely

tardy adder
nova gale
#

hacky, but it works /shrug

brave fable
#

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

tardy adder
uncut viper
brave fable
#

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)

tardy adder
brave fable
#

did better crafting note any issues in your log?

tardy adder
#

nope, but let me replicate to get a pretty log πŸ˜„ red time

brittle pasture
tardy adder
#

python o-o

brittle pasture
#

and just realized I made a typo in Cooking

rancid temple
#

So this dynamic rule, is it supposed to show up even if it doesn't match anything?

tardy adder
#

I have an item to match it tho, so I am not sure - I really need to stop being [ENTER] key trigger happy

pine ermine
#

What am I looking at 0.0

vernal crest
brave fable
#

yes, python's beautiful, isn't it 😌

brittle pasture
# pine ermine What am I looking at 0.0

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

brittle pasture
tardy adder
brittle pasture
#

and the categories show up, but the recipe's not in them?

tardy adder
#

the category doesn't show up

#

the recipe shows up in misc.

uncut viper
#

did you move the json that has your category into a different json but didnt add it to an Include

brittle pasture
#

does it show up when you're trying to add a dynamic category

brave fable
#

you might want to share your content pack in a compressed zip file here for people to run and test themselves

rancid temple
#

This uses CP so it should show up in a patch summary yeah?

brittle pasture
#

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

tardy adder
tardy adder
#

but baby steps vv

tardy adder
rancid temple
#

The eternal debug cycle

tardy adder
ocean sailBOT
#

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

tardy adder
#

I am now even more confused

rancid temple
#

It just wanted to mess with you I guess

brittle pasture
#

was this a new save or existing one?

tardy adder
#

the new save

#

which wasn't working before?????

brittle pasture
#

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

tardy adder
#

SDVpufferthinkblob 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

brittle pasture
#

the crafting station asset has a Categories field, so probably that?

brave fable
#

how come nobody seems to ping pathos these days SDVpufferthinkblob 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

brittle pasture
#

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)

uncut viper
#

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

brave fable
#

oh you get used to it after a few (a lot)

uncut viper
#

(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)

brave fable
#

i'm a frequent caller on the stardew modding helpline 😌

brittle pasture
#

(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

tardy adder
#

crafting station's Categories field is unamused by my dynamic rule

round field
brittle pasture
#

DynamicRuleData looks promising

tardy adder
#

I should maybe ask Khloe if that is actually possible for the custom crafting stations SDVpufferthinkblob

round field
#

Oh nevermind, looks like I got it

tiny zealot
#

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)

brave fable
#

i usually phrase my questions as an apology

#

i wonder if farmer overhead held items still use the wrong offset when jumping

vernal crest
#

My VSC very much complaining about trailing commas

#

(It is JSONC)

uncut viper
#

(its json5 that ignores trailing commas)

brave fable
#

yeah i don't think trailing commas specifically are in jsonc style

#

c is sadly for comment, not comma SDVpufferpensive

vernal crest
#

Is there any other difference between json5 and jsonc?

#

Ooh it doesn't complain about multi-line strings, apparently

uncut viper
#

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

tardy adder
#

catblehp I learn something everyday in here

uncut viper
#

json5 will also make vsc not complain about using single quotes around strings

brave fable
#

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?

uncut viper
#

i think a lot of people in here use VSCode

next plaza
#

You don't have to build content packs?

#

You just edit them

uncut viper
#

content packs are just jsons

#

(and misc other files)

nova gale
#

I always use vs code for content pack mods

brave fable
#

i say build/deploy since building solution in VSCommunity sends the files to your mod folder from your working folder

uncut viper
#

are you confusing it with just Visual Studio?

next plaza
#

Most people just edit directly the mods folder one

vernal crest
#

I am writing my mod in my mods folder

uncut viper
#

VSC meaning visual studio code

vernal crest
#

I don't see any reason to have a separate working folder

next plaza
#

My SpaceCore content syntax highlighter works in VSCode but I couldn't get it working in VS, so...

nova gale
#

does opt to keep a separate working folder personally but I get why folks dont

brave fable
#

separate working folder means i can have a .git outside of my mods folder hahah

tiny zealot
#

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

vernal crest
#

My .git is just inside my mods folder

brave fable
#

it's so much cleaner having a separate working folder

#

plus it zips my releases up for me haha

next plaza
#

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...)

brave fable
#

VS does create and obj+bin folder for content packs when built, comes with your zipped-up release

#

it's a little time saver

next plaza
#

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

brave fable
#

that's true

next plaza
#

(Or patch reload specific file once Pathos releases the version with my PR)

brave fable
#

on the other hand, if you build solution without debugging and launch smapi separately, you can rebuild and patch reload as you like

uncut viper
#

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

brittle pasture
#

I symlink my content-only mods to keep everything in the same repo

#

and keep the live reloading

vernal crest
#

VS22 is more resource-intensive than VSC and I can't afford to have it open much lol

brave fable
#

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

rancid temple
uncut viper
#

did you just tell vsc to specifically ignore trailing commas like, separately

rancid temple
#

Maybe... not sure where to find that lol

#

Oh I figured it out, it's the content patcher schema

vernal crest
#

How do I use the CP schema? I am not enjoying the json5 lack of error checking

rancid temple
#

"$schema": "https://smapi.io/schemas/content-patcher.json",
I just put this on my first line after the {

pine ermine
#

# 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. SDVkrobusgiggle

vernal crest
#

Sorry linkoid I am not ready to learn YAML yet :)

rancid temple
#

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

pine ermine
#

No, I totally understand. YAML is too powerful. SDVpufferdizzy

vernal crest
#

Ooh I was able to set up the schema for my whole workspace so I don't need to have it in individual files

rancid temple
#

Oh nice, though does that also get put on manifests?

vernal crest
#

Yup lol

rancid temple
#

Well, that's a little unfortunate lol

vernal crest
#

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

rancid temple
#

Yeah it is kind of a just a copy paste, rewrite, close forever situation

vernal crest
#

It is going to tell me I am missing the "Format" field in every file though

rancid temple
#

Until you need to update I guess

#

Oh yeah, that's true, it doesn't like included files lol

vernal crest
#

So I still have pretty yellow file names lol

brave fable
#

is there such a thing as a warning you care about

rancid temple
#

Lol

brave fable
#

i thought we called those errors

tardy adder
#

woooo my category thing works SDVpufferparty
but I still gotta add the recipe to the recipes part :(

vernal crest
#

Yes, there is. Duplicate key. Warning in VSC, problem for me.

rancid temple
#

Oh yeah, that is a warning huh, I guess it doesn't break the json, just overwrites usually

vernal crest
#

Yup and I just discovered one from something I'd copied from the modding wiki because I removed all the trailing comma warnings, yay

brave fable
#

i suppose that's pretty important as far as warnings go SDVpufferthinkblob

vernal crest
#

I have been procrastinating actually doing any schedule work with all this SDVkrobusnaughty

pine ermine
#

Oof

#

That sounds like a rough json file

vernal crest
#

It's just my normal absolute mess xD

pine ermine
#

I mean, you could try copy & pasting it in here just for fun.

vernal crest
pine ermine
#

That means you have invalid JSON

vernal crest
#

Well, my file is about 90% comments - how does your converter handle them?

#

Because the actual JSON in my file is fine

pine ermine
#

It converts the comments to YAML comments

#

Unless you found the perfect syntax to trigger a bug in my converter.

vernal crest
#

I'll try removing the comments

#

It was the comments that your converter was displeased with

pine ermine
#

:/

vernal crest
#

It was happy enough to convert this to this

pine ermine
#

Huh

#

Comments work for me (although they are disappearing, which they aren't suppose to do that)

vernal crest
#

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",
            }
        }
    ]
}
uncut viper
#

thats probably bc the comment is outside the json structure

vernal crest
#

Ahh yeah that might be it

uncut viper
#

putting the multi line comment inside it is fine for this converter

vernal crest
#

Yes okay that was the problem

uncut viper
#

tbh i didnt expect normal jsonc to be fine with that either

rancid temple
#

A shame because I've definitely seen a few people do that lol

vernal crest
#

I have 55 lines of comments before the json structure

#

I put comments before the json in every file I make

pine ermine
#

And it works fine?

vernal crest
#

Yup, completely.

brave fable
#

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

pine ermine
#

SMAPI's json parser is just Newtonsoft.JSON

rancid temple
#

Favorite parent

vernal crest
#

(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)

pine ermine
#

which is exactly what my converter uses

#

Oh, I see

#

The YAML writer is throwing the error, not the JSON deserializer.

vernal crest
#

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

boreal fern
#

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

uncut viper
#

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

tawdry phoenix
#

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?

vernal crest
#

What sort of mod do you want to make?

unique sigil
#

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

vernal crest
unique sigil
#

ahh i didnt know that. thanks!

vernal crest
#

I usually try to leave the house before doing it though because otherwise you have to noclip out of the void lol

unique sigil
#

eh thats fine i have noclip on when testing all the time anyways haha

vernal crest
#

Fair. I don't when testing maps because I need to be able to check my collision stuff.

unique sigil
#

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!

vernal crest
#

Haha that makes sense. Do you use CJB Cheats to set your speed higher too? I have a +8 speed buff when testing.

pine ermine
# vernal crest Yes okay that was the problem

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...

unique sigil
brave fable
#

i feel like map makers using speed +10 and noclip mode is going to lead to some very unknowingly hard-to-navigate fams hahah

unique sigil
#

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

tawdry phoenix
vernal crest
# tawdry phoenix just wanna start off adding some new items, mainly for my own personal use, like...

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

vernal crest
pine ermine
#

yeah, that'll take more work to fix

dusty scarab
# tawdry phoenix thanks!

there's a good smattering of crops mods out there, and they add a lot of new items. you could look at those, too

tardy adder
tawdry phoenix
#

thanks for the help!

dusty scarab
#

you're welcome :D

vernal crest
#

SDVpufferwaaah I want a working fast forward mod! Time to learn how to decompile and poke at mods.

brave fable
#

please understand that time travel is a delicate affair

#

it sounds so simple, and yet

#

scheduling.....

vernal crest
#

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.

brave fable
vernal crest
#

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

brave fable
#

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 SDVpufferthumbsup

vernal crest
#

Yay my idea did work after all. Temporary invisibility!

#

Drat, it's too fragile. I won't be able to use it.

unique sigil
#

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!

vernal crest
#

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)

unique sigil
#

ooh i see! i'll save that suggestion for another pack!

#

im working specifically on tiny rooms for this pack

uncut viper
#

(what is PIF)

vernal crest
#

It sounds like what you're already making is something I would be keen on too

unique sigil
uncut viper
#

(ooh I see. thank you!)

unique sigil
#

PIF is great for when you have custom farmhouse layouts and want to add more and more rooms

vernal crest
#

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

unique sigil
#

i could definitely work on new floorplans yeah

#

PIF makes my sims 4 builder heart very happy

uncut viper
#

why is it called PIF

#

Personal Interior Framework?

unique sigil
#

and having separate rooms you can access adds more immersion imo

vernal crest
unique sigil
#

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

finite ginkgo
quick adder
#

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

iron ridge
#

like how it's crafted or villagers' comments on it when gifted?

quick adder
#

villgers comments. I found the dialog strings but not the trigger, what calls the strings

uncut viper
#

iirc mayo reaction is hardcoded and dependent on age and manners and social anxiety and specific NPCs

quick adder
#

Dang I suspected it might be hardcoded

uncut viper
#

unless you do just mean when gifted. i assumed you meant when they see you eat it

quick adder
#

Yah when they see you eat it

uncut viper
#

then yes that is hardcoded

quick adder
#

😦

uncut viper
#

in Farmer.performDrinkAnimation i think if you care to look if you know C# and wanna try and patch it

quick adder
#

Hmm. I do know C# maybe I'll take a look at it, thanks πŸ™‚

oak dragon
#

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

iron stream
#

Is there a framework for 1.6 which makes animated furniture possible?

calm nebula
#

Spacecore

#

(I don't know how just that it is possible.)

spice inlet
unique sigil
brave fable
#

is it feasible to add custom type persistent locations yet? or are we still sorta stuck

unique sigil
#

working on previews... im pretty satisfied with how the rooms turned out!

iron stream
unique sigil
merry rampart
#

is there a guide somewhere on adding my own location context? all I can find is adding the location itself but nothing about context...

vernal crest
merry rampart
#

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

iron stream
#

Would anyone know the debug command for unlocking the greenhouse in RSV?

merry rampart
#

hmmm setting condition to !PLAYER_VISITED_LOCATION locationname should do it... theoretically. i'll need to test this out

iron stream
merry rampart
#

right now smapi is giving me red and i have no idea what it means

iron stream
#

I tried the debug warp RSVGreenhouse1

#

Wouldn't let me move though

merry rampart
#

ah

vernal crest
#

Your player visited location GSQ needs a player argument I expect. Something like Current or Any.

merry rampart
#

ooh ok i will add that in

vernal crest
#

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.

merry rampart
#

gotcha

#

i added Any and that fixed it. no more red

vernal crest
#

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.)

merry rampart
#

So I should use Current instead of I want it to apply to all players?

calm nebula
#

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"

vernal crest
#

Aww darn. Sorry I didn't know it was host determined only.

merry rampart
#

hmmm id rather the first one

#

fits the lore of the area better

vernal crest
#

Then "All" is what you want, going off the wiki

merry rampart
#

kk I'll keep it as is

vernal crest
#

But don't you have it as Any?

#

Thanks for the catch btw atra :)

merry rampart
#

I do

#

I thought I had it as All but guess not

#

Changed it to that

outer acorn
#

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 πŸ™‚

noble jolt
#

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.

outer acorn
#

Sweet. I scanned the error long and doesn't seem like there's much there. What's the best way to share code?

noble jolt
#

and share a link or add 3 of these ` to make a section of code.

like this
calm nebula
#

I will say that custom tools via data/tools are finicky

outer acorn
#

here's the code regardless

calm nebula
#

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

outer acorn
#

sounds like a good learning experience for me? πŸ˜†

noble jolt
#

hopefully someone online can help you, if not you can try asking again later. I for one am not it with c# yet. lol

outer acorn
#

okay sounds good. I'm in no rush maybe I'll even figure it out!

noble jolt
#

good luck πŸ˜„

calm nebula
#

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

royal nimbus
#

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.

calm nebula
#

Anyways I'm going to work so have funnnnnnnn!!!!!!

noble jolt
outer acorn
frigid hollow
royal nimbus
#

thank you

frigid hollow
#

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

merry rampart
#

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

royal nimbus
#

im not seeing a command for wind storm on the wiki

noble jolt
#

if it's an even you would need to lookup the event id in like data or something

royal nimbus
merry rampart
#

it'd probably be setFarmEvent

#

then the event id

royal nimbus
#

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

unique sigil
merry rampart
noble jolt
#

agreed!

royal nimbus
merry rampart
#

i tried doing it with event repeater and nothing showed up...

royal nimbus
merry rampart
#

at this point itd be better to just do the other method

#

complete greenhouse via cjb, sleep until it triggers

frigid hollow
royal nimbus
#

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!

floral canyon
novel obsidian
#

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)

Nexus Mods :: Stardew Valley

Our precious sewer-dweller Krobus has managed to get his hands on some elusive seeds, which he claims are from faeries.This mod adds 16 new crops, four for each season (including winter)! Update

plucky reef
#

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"

lucid iron
#

i'd just make the backing field 1 to 15

calm nebula
#

(1) no

#

(2) validate that shit in the setter

plucky reef
#

well the validation will just be a console error saying "you didn't set your config right, the function is turning off"

calm nebula
#

I would clamp it personally tbh

#

Math.Clamp(value - value %10, 10, 150)

plucky reef
#

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?

plucky reef
#

the code makes sense. Thank you!

thin remnant
#

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.

brittle pasture
#

how familiar are you with C# (modding related or no)

thin remnant
#

I know basic programming, but I've never used C# (or visual studio)

brittle pasture
thin remnant
#

I've been following that, but that's more about creating your own mod than editing someone else's

brittle pasture
#

Do you get errors when building or you just straight up can't build?

thin remnant
#

just straight up doesn't give the option to (at least, the same option given when making my own mod)

brittle pasture
#

and you imported the project folder into VS?

thin remnant
#

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

calm nebula
#

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

thin remnant
#

oh alright

#

so it is the right folder and stuff it's just not building because of errors?

calm nebula
#

You also have a packages.config

thin remnant
#

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?

plucky reef
#

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.

pearl junco
#

Does someone know where the drinking animations went?. (The ones on the farmer sheet no longer work when replaced.)

lone ice
#

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

uncut viper
#

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

calm nebula
#

Those seasons also don't work iirc

uncut viper
#

atra is also right it looks like it only takes one

lone ice
#

You know what I don't think I even needed a season

#

as long as winter overrides it with a priority of -3000

finite ginkgo
#

Appearance data doesn't have a weather field as far as i'm aware

lone ice
#

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

lone ice
wise berry
#

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

sharp scroll
#

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?

rancid temple
#

Did you make sure StardewXnbHack.exe was in the Stardew Valley folder and not just the folder it comes in?

sharp scroll
#

Yep.

rancid temple
#

And also you have the latest SDV and SMAPI installed?

sharp scroll
#

To the best of my knowledge. Let me check my SMAPI version rq

rancid temple
#

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

sharp scroll
#

Sneaky buggers updated SMAPI on my earlier this month. Let's see if that helps

#

Aaaand the new version won't install...bbs

rancid temple
#

Which version of each are you trying to use?

lucid iron
#

Remember to use correct version of stardewxnbhack

#

Need the prerelease (1.1.1?) for 1.6.9

rancid temple
#

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

sharp scroll
#

I only saw one version available? Where are the different versions found?

rancid temple
#

StardewXnbHack is all on the github releases page

sharp scroll
#

That's where I went, but I'll look again.

rancid temple
#

SMAPI has several mirror locations, but I think you can only get 4.1.0 from Nexus?

oblique mountain
#

Am I missing something or does drawing text via SpriteBatch.DrawString() ignore the alpha value from the color argument?

rancid temple
#

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

sharp scroll
#

I have the 1.1.0 version it looks like

lucid iron
sharp scroll
#

I take it back, I have 1.1.1

#

I seem to need 1.1.0

#

Since i'm not in the Beta

rancid temple
#

Yeah

lucid iron
sharp scroll
#

Ahh, Sokath, his eyes uncovered. Many thanks. Let's see how that works

oblique mountain
lucid iron
#

The color is a mask, hence why you need to pass in a grey to draw transparency

calm nebula
#

Check your spritebatch

#

There is at least one setting that disables transparency iirc

sharp scroll
#

It works! Thank you!

oblique mountain
proud wyvern
#

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

teal bridge
wise berry
#

Nope, wanting to learn how to do that though ahaha

#

I made them myself just cobbling the parts together in an image editor

teal bridge
#

It's all in SpriteFont.

wise berry
#

Oohh okay, I'll have a look

teal bridge
#

Wait, let me double-check... that might be the text without the banner. There's definitely a method for it though.

oblique mountain
teal bridge
#

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.)

wise berry
#

Absolutely, I'll hopefully get that going once I make the rest work ahaha

teal bridge
#

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.

wise berry
#

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

teal bridge
#

That function does both.

#

It draws the scroll and the text.

wise berry
#

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

teal bridge
#

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.

wise berry
#

Ahaha I'll surely be able to find it with this guidance!

wise berry
#

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!

teal bridge
#

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).

wise berry
#

That doesn't sound fun ahaha

teal bridge
#

Depends on your hobbies, maybe. For you, probably not that fun.

lucid iron
#

Is the portrait bg sprite smaller than portrait then think

teal bridge
#

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.

wise berry
#

I'm gonna just. not think about the possibility of Portraiture compat SDVpufferdizzy

teal bridge
#

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.

wise berry
#

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)

teal bridge
#

? 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.

wise berry
#

Oh I meant "drawn the normal way" draw I think

calm nebula
#

imagines a little mouse with a paintbrush

#

I'm sorry

wise berry
#

Not terribly good with the vocab I'm afraid

teal bridge
#

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.

wise berry
#

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

teal bridge
#

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)

lucid iron
#

Did silicon mean draw as in "I made those sprites with border and text et al in aseprite then load & show it"

wise berry
#

Again- not very effective ahaha

lucid iron
#

I forget if gmcm had a image option that you are using rn

#

But now u will need the custom option for sure Bolb

teal bridge
#

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.

wise berry
#

Ahhh that's what was puzzling me

teal bridge
#

I thought it was the Custom setting.

#

Err, not custom... Complex as GMCM calls it.

wise berry
#

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)

teal bridge
#

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.

lucid iron
#

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"

wise berry
#

Hmmm I do want to have the "off" portrait visible so people can see their options

lucid iron
#

Unchecking a box is free

teal bridge
#

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.

wise berry
#

I stripped all the parts that did do that from focustense's example ahaha

teal bridge
#

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.

lucid iron
#

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

teal bridge
#

The draw delegate can have access to anything you want it to. That's why a complex option can live-update.

lucid iron
#

Yay closures ukimasu2

teal bridge
#

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.

lucid iron
#

Yeah no events rip

teal bridge
#

(I say "no way", but of course I mean "no way short of the eye-watering hacks I did before")

next plaza
#

(GMCM 2.0 looms, in the distance)

#

(Past the horizon)

wise berry
#

I may as well become better friends with "Complex" GMCM options and SpriteBatches in any case

teal bridge
#

(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)

lucid iron
#

I wonder how MCM type mods work in other games yggy

wise berry
#

(they don't I think)

teal bridge
#

SkyUI is based on (ugh) Flash.

lucid iron
#

Hm.

teal bridge
#

Though the MCM API is much simpler.

next plaza
#

I want to add auto registering for simple configs to 2.0

#

Like registering based on public properties

teal bridge
#

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)

lucid iron
#

I feel it's gotta be more controlled than that

round dock
#

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 stress (I use the wiki as reference so I'm a lil confused)

next plaza
#

Well, I can't really use attributes with pintail stuff can I?

lucid iron
#

Maybe if it only auto register a wrapper generic class props

teal bridge
#

Yeah, it is kinda error-prone once you get into enums, unless you want to establish a translation system.

uncut viper
lucid iron
#

Can u include the class def in the IApi file and expect it to work over pintail

next plaza
#

I don't know

lucid iron
#

Adventure awaits

teal bridge
#

Pintail does not do classes. Period.

#

(Except for those in shared assemblies, obviously.)

lucid iron
#

Unfort

calm nebula
#

You can't use attributes sorta

teal bridge
#

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...

lucid iron
#

What if you make ppl write their gmcm in spacecore content lang

teal bridge
#

(Then a lot of people wouldn't use it)

round dock
teal bridge
#

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.

next plaza
#

In theory they could pass in their ITranslationHelper I guess

#

But that's a Future Casey problem

brave fable
#

is there a really simple way of accessing another mod's translations? because i use an extremely not simple way

next plaza
#

I've used reflection on the object returned by the mod registry to get it before

teal bridge
#

I assume the not-simple way involves a lot of reflection.

brave fable
#

presuming the other mod isn't willingly giving it away

#

oh yes

#

my favourite flavour of reflection: smapi core methods

brave fable
teal bridge
#

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.

brave fable
#

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

teal bridge
#

If they don't provide an API then they're probably not prepared to have their mod messed with.

next plaza
#

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

brave fable
#

yeah i keep my translations in the CP component too

teal bridge
#

Huh. IModInfo is the actual entry mod?

brave fable
#

wow i thought i was the only person dumb or crazy enough to do this lol

#

we're both stupid SDVpufferchickhug

next plaza
#

It stores the relevant mod/pack on the IModInfo impl if I remember correctly

teal bridge
#

It's just an object containing a Manifest and IsContentPack.

next plaza
#

Ah, yeah, it was recently I did this

teal bridge
#

Surprising that the implementation would store the whole graph behind it.

next plaza
brave fable
#

i reflect smapi > modregistry > get (uniqueid) > directorypath > smapi > readtranslationfiles (directorypath/i18n) > translations > get

next plaza
#

Getting the helper is so much easier

brave fable
#

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

next plaza
brave fable
#

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

lucid iron
#

What were the main arguments against such a thing bolbthinking

next plaza
#

Pathos probably won't go for it if I had to guess

teal bridge
#

Hasn't it been proposed before and rejected for the same reason you can't just grab another mod's content.json and such?

next plaza
#

Since it'd be relying on mod internals (the translation data)

brave fable
#

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

teal bridge
#

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.

brave fable
#

if it were a normal thing to do we wouldn't be discussing it in shady corners like we are now

next plaza
brave fable
lucid iron
#

I have vague feel that mod translation should be content though

next plaza
#

I mean, most people in modded farmers don't make mods

#

So it makes sense to mute this channel

brave fable
#

sure but they're cousins yknow

#

you can understand that 99% of people have us muted, but our cousins too...

#

my children

teal bridge
lucid iron
#

So you can't (or shouldn't) access *.png of another mod but they should have choice to expose it

brave fable
#

well the choice to expose it is the content pipeline

lucid iron
#

There's not really a standard way to do it bolbthinking

teal bridge
#

Yes. If you framed it that way, Pathos might go for it.

lucid iron
#

Besides targeting String/whatever I suppose

brave fable
#

i think for one mod or another i pushed all my strings into a content file and referenced that from elsewhere

teal bridge
#

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?

next plaza
#

You could just load Strings/{{ModID}}

brave fable
#

but it's just more convenient to use i18n directly in c# since you often want to do things like tokenisation

next plaza
#

But then you have to repeat all the ones you do public

#

And Pathos doesn't like implicit behavior

lucid iron
#

Yeah it is default private blobcatgooglyblep

next plaza
#

(Hence why I did things a certain way with passthrough tokens for include patches)

lucid iron
#

Unlike textures which tend to be public unless someone goes for internal asset key with intention

brave fable
#

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

next plaza
#

Oh, I didn't see that question

#

Did you figure it out?

teal bridge
#

Textures are considerably scarier because of ownership.

brave fable
#

oh that was last night lol, no i have no idea

next plaza
#

You just register it with the SpaceCore serializer and set the appropriate field in Data/Locations I think

calm nebula
#

peeks in

brave fable
#

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

calm nebula
#

What in the love of reflection

#

.. it's none of my business, please continue

next plaza
#
    "CreateOnLoad": {
      "MapPath": "Maps\\CommunityCenter_Ruins",
      "Type": "StardewValley.Locations.CommunityCenter",
      "AlwaysActive": false
    },

@ blueberry

brave fable
#

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

next plaza
brave fable
#

i'm sure i tried with custom types here when 1.6 landed and it didn't work, maybe i'm misremembering

next plaza
#

Let me look at the code calling type

brave fable
#

something something only checking for stardewvalley types

next plaza
#

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

brave fable
#

i didn't, i suppose i can try again now since i just assumed it didn't work

next plaza
#

Just do "MyMod.MyLocation, MyModAssemblyName"

#

Assuming MyMod namespace and MyLocation class name of course

brave fable
#

and also i don't know if SDV handles custom locations with removed assemblies quite as gracefully as it handles removed custom items

next plaza
#

That's why you register it with the SpaceCore serializer

#

It stores it outside the save

brave fable
#

SDVpufferthinkblobSDVpufferthinkblobSDVpufferthinkblobSDVpufferthinkblobSDVpufferthinkblob i'll have to try again

next plaza
#

(Also won't serialize at all without that step but anyways)

#

(Unless you inject it yourself into the serializer)

brave fable
#

see it'll be nice if this works since it sucks having static classes for my location behaviour haha

uncut viper
lucid iron
#

you can do typeof(CustomLocationClass).AssemblyQualifiedName

brittle pasture
#

but what if CP

brave fable
#

(that's presumably just to get the qualified name that you use in cp)

calm nebula
lucid iron
#

i sure hope button's harmony thing doesnt let you make whole ass classes

uncut viper
#

i havent been paying too much attention im half distracted by a movie so i dont even know what y'all are talkin about

brave fable
#

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

next plaza
#

Cecil when πŸ˜”

#

I wanna mark everything noinlining

#

(Not literally everything)

#

Just, you know, a few functions I had to write transpilers for instead

brittle pasture
calm nebula
#

(Just got home from work lol)

brave fable
#

same (i got out of bed because these questions keep me up)

teal bridge
#

Ugh, didn't realize I had to put the mod description in the actual discord message that gets published. Oh well, next time.

wise berry
#

With immediate feedback implemented successfully I think the scrolls can be scrapped

#

Now to return to finangling the images ahaha

patent lanceBOT
#

@next plaza: look into marriage schedules with your 0 schedule fix (6d ago)

next plaza
#

Remind me in 24 hours to look into this

patent lanceBOT
#

heh heh I hope it's not too important... nefarious grin (#6255645) (24h | <t:1727049117>)

finite ginkgo
#

Will Casey do it this time or delay it- and the answer is delay it

quick adder
#

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.

lucid iron
#

you need to use harmony for that

#

do tell us what you want to edit though, might be alternate ways

brittle pasture
quick adder
#

Thank you both. I am playing around with performDrinkAnimation to see if I can add more reactions to different items

wise berry
#

I'm not making many breakthroughs in terms of assembling this image SDVpufferflat

#

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

worthy rose
#

Thanks to @brittle pasture and @uncut viper , owe you guys a beer. if (!Game1.Player.CanMove) return; did the trick

lucid iron
worthy rose
#

i wanted to add a sort of icon over the items that players bind to key binds but man that is a nightmare

wise berry
#

Because I don't know what that means ahah

worthy rose
#

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

lucid iron
wise berry
#

Oohh okay, would that be using the Complex config?

lucid iron
#

ya

#

i dont think the add image let you do 2 draws so no way around that Bolb

wise berry
#

Okay thanks much!!!! I think I get it

lucid iron
#

need reflection to access drinkAnimationEvent ofc

calm nebula
#

oh god that's in there?

lucid iron
#

the mayo drink reaction is in there for some reason yea

lucid iron
#

reflection or harmony Bolb

brave fable
#

you might need to give a little more info haha

quick adder
#

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?

lucid iron
#

so you need to obtain instance of Game1.player.drinkAnimationEvent, which is private

brittle pasture
#

just a fancy smancy way of saying "access private fields"

tiny zealot
#

yeah, if you added one it could react to specific items, just the way that the base game's one does

lucid iron
#

ah yea i always forget smapi has reflection helper blobcatgooglyblep

brave fable
#

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

calm nebula
#

Yeah you need to wait until gsmelaunchrd

#

Sorry

#

Saveloaded

brave fable
#

GameLaunched is also an event, so you can add another method with += just the same as with netEvent.onEvent

calm nebula
#

Cuz might not be thr right instance

#

Also careful about dangling references

brave fable
#

i thought Game1.player was non-null even at the title menu?

calm nebula
#

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.)

brave fable
#

how else would you add an event handler SDVpufferthinkblob

calm nebula
#

Glad you asked! Let me find the nonsense

finite ginkgo
#

oh great, nonsense! i'm curious

calm nebula
#

(I run the event handler through a small class I make sure to retain no hard references to.)

brave fable
#

how do you come up with this hahah

#

i just += and sometimes even -=...

calm nebula
#

I'm a nerd

lucid iron
#

nerd herd DokkanStare

wise berry
brave fable
#

would you like an incredibly convoluted example?

wise berry
#

Yes!!

wise berry
#

I work best with examples (even if they may be so convoluted that maybe I reconsider how well I work with them)

brave fable
#

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

brave fable
next plaza
#

That's weird, I thought it only needed type name and assembly name SDVPufferThink

brave fable
#

QualifiedName and QualifiedName, AssemblyName wouldn't work

next plaza
#

Good to know though

lucid iron
#

thats what AssemblyQualifiedName returns i think

brave fable
#

yep SDVpufferthumbsup

lucid iron
#

i always wondered what Culture means though