Tool SMAPI: Stardew Modding API

Discussion in 'Mods' started by ClxS, Mar 6, 2016.

Thread Status:
Not open for further replies.
  1. Pathoschild

    Pathoschild Tiy's Beard

  2. pepoluan

    pepoluan Big Damn Hero

    D'oh~~ ... I did not notice there's a Set() method on playerChoiceColor ... I naively thought since it's readonly I have to change other attributes T.T

    Thanks for the pointer! Let me do some experiments...

    Edit: YAAYY!!! IT WORKS!!!!!

    ====================

    Now for a totally different thing:

    How do I pass a token to a custom token?

    I tried doing it like this:
    Code:
    {{pepoluan.DailyRandom/xnbloader:{{season}}}}
    but I got error instead:
    Code:
    [04:33:18 WARN  Content Patcher] Ignored ZZZ pepo's Personal XNB Loader > Load Characters/Emily: error reading info. Technical details:
    System.InvalidOperationException: The 'pepoluan.DailyRandom/xnbloader' token requires an input argument.
      at ContentPatcher.Framework.Tokens.GenericToken.AssertInput(ITokenString input) in C:\source\_Stardew\Mods.Pathoschild\ContentPatcher\Framework\Tokens\GenericToken.cs:line 155
      at ContentPatcher.Framework.Tokens.GenericToken.GetValues(ITokenString input) in C:\source\_Stardew\Mods.Pathoschild\ContentPatcher\Framework\Tokens\GenericToken.cs:line 127
      at ContentPatcher.Framework.Conditions.TokenString.TryGetApplied(IContext context, String& result, InvariantHashSet& unavailableTokens) in C:\source\_Stardew\Mods.Pathoschild\ContentPatcher\Framework\Conditions\TokenString.cs:line 192
      at ContentPatcher.Framework.Conditions.TokenString.ForceUpdate(IContext context) in C:\source\_Stardew\Mods.Pathoschild\ContentPatcher\Framework\Conditions\TokenString.cs:line 154
      at ContentPatcher.Framework.Conditions.TokenString..ctor(ILexToken[] lexTokens, IContext context) in C:\source\_Stardew\Mods.Pathoschild\ContentPatcher\Framework\Conditions\TokenString.cs:line 106
      at ContentPatcher.Framework.Conditions.TokenString..ctor(String raw, IContext context) in C:\source\_Stardew\Mods.Pathoschild\ContentPatcher\Framework\Conditions\TokenString.cs:line 57
      at ContentPatcher.ModEntry.TryParseStringTokens(String rawValue, IContext tokenContext, IManifest forMod, IMigration migrator, String& error, IParsedTokenString& parsed) in C:\source\_Stardew\Mods.Pathoschild\ContentPatcher\ModEntry.cs:line 904
      at ContentPatcher.ModEntry.TryPrepareLocalAsset(String path, IContext tokenContext, IManifest forMod, IMigration migrator, String& error, IParsedTokenString& tokenedPath) in C:\source\_Stardew\Mods.Pathoschild\ContentPatcher\ModEntry.cs:line 976
      at ContentPatcher.ModEntry.LoadPatch(ManagedContentPack pack, PatchConfig entry, IContext tokenContext, IMigration migrator, Action`1 logSkip) in C:\source\_Stardew\Mods.Pathoschild\ContentPatcher\ModEntry.cs:line 535.
    
    ("xnbloader" is the name of the custom token I've registered to ContentPatcher; it's actually reflecting my own mod that custom loads some assets I've cherry-picked from older XNB mods, hence the name "xnbloader")

    A different custom token in the same file that goes by the following syntax:
    Code:
    {{pepoluan.DailyRandom/xnbloader:haley}}
    has no problem at all.
     
      Last edited: Jul 5, 2019
    • Pathoschild

      Pathoschild Tiy's Beard

    • pepoluan

      pepoluan Big Damn Hero

      Sorry, went to bed already last nite :)

      Here's last night's log: https://log.smapi.io/XmGx5fAH

      Please ignore all messages about "Haley404" -- I purposefully pointed CP to a non-existent file so I can see the indication in the SMAPI console screen.

      -----

      Edit 1:
      Latest log: https://log.smapi.io/VpCy36pV

      This one based on latest version of code as loaded to https://bitbucket.org/pepoluan/sdvmod-daily-random/src/default/

      Edit 2: Attached is the relevant content.json that causes problems. Line 30 works, as can be seen in the log whenever the message [requested "haley"] appears. Line 35 caused the exception, and seems to be never requested by CP afterwards.

      Excerpts for lines 27~36:
      Code:
        {
          "Action": "Load",
          "Target": "Characters/Haley",
          "FromFile": "Characters/Haley404_{{pepoluan.DailyRandom/xnbloader:haley}}.png"
        },
        {
          "Action": "Load",
          "Target": "Characters/Emily",
          "FromFile": "Characters/Emily404_{{pepoluan.DailyRandom/xnbloader:{{season}}}}.png"
        },
      
       

        Attached Files:

        Last edited: Jul 6, 2019
      • Pathoschild

        Pathoschild Tiy's Beard

        @pepoluan Can you send me a zip of the compiled mod + content pack? The code on GitHub doesn't currently add any tokens.
         
        • starifarm

          starifarm Void-Bound Voyager

          Hi, just had a weird crash. It's Winter year 2 in this save and the first night of the Night Market fest. I went to the underwater fishing sub, pulled out my line and once I caught something (it looked like a tree sapling, it was gold I believe) and the game crashed. I do have Stardew Valley Expanded and the CJB cheats menu with the always catch cheat on if that's relevant.
          This is the SMAPI log: https://log.smapi.io/mPf1ZhYX
           
          • haskg84

            haskg84 Void-Bound Voyager

          • pepoluan

            pepoluan Big Damn Hero

            Sorry for the lateness in replying.

            I had just merged your patches (BitBucket mercurial doesn't support merge requests?? that's strange... I remember it does... I'll investigate that separately, and if that's the case, I'll change over to git). Also shift over from using an embedded xoshiro implementation to a NuGet one.

            Cleaned solution, Rebuild Solution, and run. SMAPI Log: https://log.smapi.io/kcR99xMR

            Attached are:
            • Latest compiled result of Daily Random mod.
            • "pepo XNB Loader", which is a custom CP mod I used to experiment with custom tokens, including the YAML file required by the Daily Random mod

            .
             

              Attached Files:

            • seasickdolphin

              seasickdolphin Space Hobo

              I need help I have never played stardewvalley before with mods and i have followed all of the instructions for downloading SMAPI and the content patcher but all i keep getting is a "Application not Responding" and a black screen and the spinning wheel of death. I am on mac.
              https://log.smapi.io/X9tU391t
               
              • Pathoschild

                Pathoschild Tiy's Beard

                @starifarm It seems the game caught an invalid fish and failed trying to read the fish fields. I'm not sure why though; does it happen consistently? If so, what if you temporarily remove all mods (except those that add custom NPCs)?

                @haskg84 It looks like you installed XNB file replacement mods, which are no longer recommended. You can reset your content files to fix those, and feel free to post a new log if the errors still happen afterwards.

                @pepoluan I sent you a custom build of Content Patcher on Discord; let me know if that fixes it for you.

                @seasickdolphin Try reinstalling Mono (either channel is fine) to fix that.
                 
                • pepoluan

                  pepoluan Big Damn Hero

                  Yup, seen the file. I'll test it later tonight after I get back home. Currently at work right now.
                   
                  • MystressMo

                    MystressMo Void-Bound Voyager

                    Mind debugging this for me? It was a random crash out of nowhere.

                    I downloaded the latest version of smapi...yesterday or the day before

                    The start of my errors.
                    [10:44:28 ERROR SMAPI] An error occured in the overridden draw loop: System.NullReferenceException: Object reference not set to an instance of an object.
                    at StardewModdingAPI.Framework.SGame.DrawImpl(GameTime gameTime) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\SGame.cs:line 1237
                    at StardewModdingAPI.Framework.SGame.Draw(GameTime gameTime) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\SGame.cs:line 952
                     

                      Attached Files:

                      Last edited: Jul 8, 2019
                    • 13akoors

                      13akoors Scruffy Nerf-Herder

                      Probably a good start would be checking all the mods with updates, and updating as many as you can
                       
                        MystressMo likes this.
                      • MystressMo

                        MystressMo Void-Bound Voyager

                        I did. Updated them all. And ran them. Game was working well last night. after deleting 2 troublesome mods.

                        I guess I can go back and quad check to see if there is another conflict arising. Was hoping i was just overlooking so I didn't have to go the long route lol
                         
                          Last edited: Jul 8, 2019
                        • Pathoschild

                          Pathoschild Tiy's Beard

                          @MystressMo Here's the important bit in your case:
                          It seems you made a backup of your Gynocyde save, but left the backup in the Saves folder. The game tried to load the backup, but the folder name doesn't match the save file, so the game crashed.
                           
                            MystressMo likes this.
                          • MystressMo

                            MystressMo Void-Bound Voyager

                            @Pathoschild I just want to say thank you....I really appreciate you.

                            I saw that...but I thought it was something that it was doing on its own. Had no idea. You are amazing and thank you for your time!
                             
                              Pathoschild likes this.
                            • andril11

                              andril11 Orbital Explorer

                            • qtMarie

                              qtMarie Void-Bound Voyager

                              Last edited: Jul 10, 2019
                            • parlaxz

                              parlaxz Intergalactic Tourist

                              I'm trying to play a large bit of mods with friends and everything works fine in singleplayer but when I try multiplayer it sticks in the loading screen forever when I try to walk into town. I originally had SVE installed but tried uninstalling it, to no avail.

                              Any help is greatly appreciated!
                              SMAPI log: https://log.smapi.io/fpNV930b
                               
                              • Moragaine

                                Moragaine Existential Complex

                                You might want to cut back on the number of mods you use when trying multiplayer; unless everyone has the same mod setup there are going to be a lot of problems, whether you are the host or a farmhand.
                                 
                                Thread Status:
                                Not open for further replies.

                                Share This Page