Tool SMAPI: Stardew Modding API

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

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

    ClxS Pangalactic Porcupine

    SMAPI is an open-source modding API for Stardew Valley that lets you play the game with mods. It loads mods into the game and exposes events they can use to change it. It's safely installed alongside the game's executable, and doesn't change any of your game files. Compatible with the latest version of the game on Linux, Mac, and Windows. For more information: (SMAPI is now maintained by @Pathoschild. :))
     
      Last edited: Oct 2, 2019
    • Hobbit9797

      Hobbit9797 Poptop Tamer

      Did you change something with the events?
      While Events.KeyPressed += Events_KeyPressed; worked in Zoryns version, ControlEvents.KeyPressed += Events_KeyPressed; throws a no overload matches error. I use void Events_KeyPressed(Keys key) so everything should in theory work.
       
        StSong likes this.
      • sirspikey

        sirspikey Void-Bound Voyager

        I'm not using any other mods, I only use smapi for fixing the run speed and inf stamina. It's not a biggy, but is it possible for it to load just a textfile on start with a couple of commands instead of compiling a dll-file (dunno how :p)
         
        • ClxS

          ClxS Pangalactic Porcupine

          Yeah one of the big changes from 0.36 to 0.37 was moving all the EventHandlers to use a similar format (to match Microsoft's style recommendation). KeyPress now is an EventHandler<EventArgsKeyPressed>, so your function should have a signature like: void Events_KeyPressed(object sender, EventArgsKeyPressed e). The actual key pressed would be e.KeyPressed in that function.

          I'll have a look at putting it into a future version. One thing I'm hoping to eventually have is to just allow people to put a .cs file there that gets compiled when the API starts.
           
            Last edited: Mar 6, 2016
          • Airborne

            Airborne Void-Bound Voyager

            I updated to this version from .36 and now none of my mods work. Am I missing something here? do they need to placed somewhere else now or what? I also want to note I'm on the GoG version.
             
            • ClxS

              ClxS Pangalactic Porcupine

              There were a lot of changes from 0.36 to 0.37, so you'll need to get the updated version of your mods. Most of the main ones have been updated now, but there are still a few which aren't. If you really need the ones that aren't I suggest staying on 0.36 until they update them. :)
               
              • Airborne

                Airborne Void-Bound Voyager

                Ah I had no Idea the mods themselves would need to be updated as well. This will be a pain in the future if the API updates frequently I think:(
                 
                • ClxS

                  ClxS Pangalactic Porcupine

                  Oh yeah it definitely will be. Once the API gets to a certain point though I'm going to try and keep breaking changes to as little as possible.
                  Mods will only need to update if they use something I've changed. In this case I changed something almost every mod will use.

                  Once the API is a bit bigger and more stable I don't plan on touching the bits the modders will use.
                   
                  • Airborne

                    Airborne Void-Bound Voyager

                    Yeah right now is the best time to update frequently while all the modders are still active. Don't want to go breaking everyone's favorite mods a year from now and the modders themselves are MIA.
                     
                    • Yoshify

                      Yoshify Intergalactic Tourist

                      Github noob here, would love to contribute if I knew how to use it really.

                      I noticed you have an event in ControlEvents for KeyPressed but not one for KeyReleased, would be a great addition! In my latest mod I just used the games default KeyboardInput events for pressed/released.
                       
                      • ClxS

                        ClxS Pangalactic Porcupine

                        Sure thing, I'll add it into the next release :)
                         
                        • Yoshify

                          Yoshify Intergalactic Tourist

                          Brilliant - appreciate the good work!
                           
                          • bdawson1993

                            bdawson1993 Tentacle Wrangler

                            I'm working on a mod that works a lot with the player, I could pass on my Player class to make them easier to call with just your API :)
                             
                            • CJB

                              CJB Scruffy Nerf-Herder

                            • CJB

                              CJB Scruffy Nerf-Herder

                              Good too see you have a forums post setup. You might wanna add an how to install mod / where to install section in the OP.
                              Also might wanna add CJB Cheats Menu to the test? http://community.playstarbound.com/threads/smapi-0-37-in-game-cheat-menu-v1-3-2-6-mar-2016.108004/
                               
                              • ClxS

                                ClxS Pangalactic Porcupine

                                Would be much appreciated!

                                Already added :) I'll write a guide soon. I have a change I'm planning for update 0.38 or 0.39 which changes how mods are laid out a little. From then, they should be in their own folders with .json file with them which includes the mod info and which DLL it should run, as well as any other content that should be loaded. I'm making that change so people will be able to make content-only mods.
                                It'll be backwards compatible with the old (current) format for a while, but will eventually change.
                                 
                                  Last edited: Mar 6, 2016
                                • Emtu

                                  Emtu Subatomic Cosmonaut

                                  Is that update to Stardew 1.05 coming soon? I know there's a few things in the new one that a lot of people want, like the zoom option.
                                   
                                  • ninjatulio

                                    ninjatulio Space Spelunker

                                    The forum mods should have this pinned.
                                     
                                      vero_games and sourdime like this.
                                    • skedone

                                      skedone Scruffy Nerf-Herder

                                      can anyone tell me why when i i run this its messes up my display of the game hole interface is wrong on 1.04gog edition if that makes a diff (if does i will buy it on steam too lol )

                                      this is what io mean [​IMG]
                                       
                                        Last edited: Mar 7, 2016
                                      • Seeroh

                                        Seeroh Scruffy Nerf-Herder

                                        I have a feature request for the next version. Currently, there are functions for outputting IDs of items/rings/weaponry to your inventory, but not tools. Seems a little weird that a way to spawn in tools wasn't made.
                                         
                                        Thread Status:
                                        Not open for further replies.

                                        Share This Page