1 Screenshot

About This File

This mod is made by Ipsquiggle at Klei to show off various features of the mod API.

This mod is not meant to be played. It is for scripting demonstration only.

I'll keep this up-to-date as I add functions to the API so you have an example of how they are used.

Updated for the Stuff of Nightmares release! Tonnes of new functions and examples to check out! :grin:

What's New in Version 1.1-1.3   See changelog


No changelog available for this version.

  • Like 2
  • Thanks 2

User Feedback

Recommended Comments

On 7/14/2015 at 7:46 PM, SuperScaryman23 said:

am i the only one here who doesnt know what an api... I CAN CODE BUT I CANT FIND OUT WHAT AN API IS OR HOW TO ACCESS IT if anyone can help me with this plz do

The API is used for your code to talk to the code that powers basic functionalities in Don't Starve.  It is the code that was written by Klei Entertainment which you can reference to make your mod affect behaviors, actions, etc within the game.  This isn't exactly a correct definition, but it is close enough for what you're asking.


From the API files I am looking at in order to start learning their code:

-- Cookpot recipes
--  AddIngredientValues({"item"}, {"tag"=value})
--		Lets the game know the "worth" of an item. You can supply a list of
--		items in the first parameter if they will all have the same values.
--		Each tag is a particular "kind" of thing that a recipe might require
--		(i.e. meat, veggie) and the value is how much of that kind your item is
--		worth.
--		See cooking.lua for examples. 
--	AddCookerRecipe("cooker", recipe)
--		Adds the recipe for that kind of cooker. In the base game the only
--		cooker is "cookpot".
--		See preparedfoods.lua for recipe examples.

-- Give flowers some cooking value. We made up a new "kind" of food, called flower.
AddIngredientValues({"petals", "petals_evil"}, {flower=1})

The API call that your mod could use in this instance is the AddIngredientValues() method or the AddCookerRecipe() method.

I can't really give you any better explanation than their documentation already provides, as I am just now looking over their modding forums -- however, if you have further questions, hopefully myself or someone else will be able to assist you.  Sadly, it doesn't look as if a lot of people are helpful on the forums.  I will check them as I have time and see updates or responses to my post.

Best of Luck,


  • Like 1

Share this comment

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now