Jump to content

Recommended Posts

So as you've read, this is my first time making mods. 

I've got a slight idea as to how to make them and learned that I can change values in tuning.lua through mods. 

 

So I tried to make a modmain.lua file that can change parts of the tuning.lua script, but every time I open the game, it tells me that the mod crashed. 

 

The modmain.lua script is here: 

 

 

TUNING.TORCH_ATTACK_IGNITE_PERCENT = 50

TUNING.LIGHTER_ATTACK_IGNITE_PERCENT = 25
 
TUNING.TINY_FUEL = total_day_time*.1
TUNING.SMALL_FUEL = total_day_time*.25
TUNING.MED_FUEL = total_day_time*.5
TUNING.MED_LARGE_FUEL = total_day_time*.75
TUNING.LARGE_FUEL = total_day_time*1
 
TUNING.TINY_BURNTIME = seg_time*.1
TUNING.SMALL_BURNTIME = seg_time*.25
TUNING.MED_BURNTIME = seg_time*.5
TUNING.LARGE_BURNTIME = seg_time
 
TUNING.CAMPFIRE_FUEL_MAX = total_day_time*12
TUNING.CAMPFIRE_FUEL_START = total_day_time
 
TUNING.ROCKLIGHT_FUEL_MAX = total_day_time*12
 
TUNING.FIREPIT_FUEL_MAX = total_day_time*24
TUNING.FIREPIT_FUEL_START = total_day_time
 
TUNING.PIGTORCH_FUEL_MAX = total_day_time*7
 
TUNING.NIGHTLIGHT_FUEL_MAX = total_day_time*48
TUNING.NIGHTLIGHT_FUEL_START = total_day_time

 

Please tell me what I did wrong. 

total_day_time and seg_time are local variables inside tuning.lua and are not defined in your mod's environment. You need to change those to TUNING.TOTAL_DAY_TIME and TUNING.SEG_TIME.

Also, generally, when asking for help with a crash, it's helpful to post the error message.

So as you've read, this is my first time making mods. 

I've got a slight idea as to how to make them and learned that I can change values in tuning.lua through mods. 

 

So I tried to make a modmain.lua file that can change parts of the tuning.lua script, but every time I open the game, it tells me that the mod crashed. 

 

The modmain.lua script is here: 

 

 

Please tell me what I did wrong. 

Is that the entire script? It's not that easy, bro.

If you want to tweak tuning.lua, take a look at almost ANY mod that has "Tweak" in it.

Study it, and then try to tweak it. Also, if you are on a windows, go to Documents/Klei/DoNotStarve and look at log.txt if the game crashes without displaying the log. Copy and paste that here. Then people can help you.

 

EDIT: I got Ninja'd. Squeek explains pretty well.

Edited by goldfish911

total_day_time and seg_time are local variables inside tuning.lua and are not defined in your mod's environment. You need to change those to TUNING.TOTAL_DAY_TIME and TUNING.SEG_TIME.

Also, generally, when asking for help with a crash, it's helpful to post the error message.

 

So I added them as local variables, copying the constants from tuning.lua, but it still says crashed on last start. 

 

Btw, if you're the person I think you are, thanks for making the Minimap HUD mod. 

So I added them as local variables, copying the constants from tuning.lua, but it still says crashed on last start.

Adding them as local variables is the wrong approach. Instead, you can just get the values from the TUNING table like so:

 

TUNING.TINY_FUEL = TUNING.TOTAL_DAY_TIME*.1
As for the crash, you need to post the crash log. See the Log.txt section of this thread.

 

Btw, if you're the person I think you are, thanks for making the Minimap HUD mod.

You're welcome. Edited by squeek

Is that the entire script? It's not that easy, bro.

If you want to tweak tuning.lua, take a look at almost ANY mod that has "Tweak" in it.

Study it, and then try to tweak it. Also, if you are on a windows, go to Documents/Klei/DoNotStarve and look at log.txt if the game crashes without displaying the log. Copy and paste that here. Then people can help you.

 

EDIT: I got Ninja'd. Squeek explains pretty well.

 

Can't find any other mods that tweak it, and those that I did find, I copied their syntax, and still says crashed on last startup, automatically disabled. 

 

Adding them as local variables is the wrong approach. Instead, you can just get the values from the TUNING table like so:

 

TUNING.TINY_FUEL = TUNING.TOTAL_DAY_TIME*.1
As for the crash, you need to post the crash log. See the Log.txt section of this thread.

 

You're welcome.

 

 

Tried both ways, still says "Crashed on Last Startup, Automatically Disabled". Also, I mean the game isn't crashing, just the mod when I try to enable it. 

Also, if you are on a windows, go to Documents/Klei/DoNotStarve and look at log.txt if the game crashes without displaying the log. Copy and paste that here. Then people can help you.

This here is what we need, OP. Upload the log.txt else we can't help you any further.

 

Starting up
Don't Starve: 88571 WIN32_STEAM
Build Date: 2013-10-30_10-40-33
THREAD - started 'GAClient' (6624)
HttpClient::ClientThread::Main()
cGame::InitializeOnMainThread
WindowManager::Initialize
RestoreWindowPosition
   Saved Client Pos (62 x 22)
   Adjusted Window Pos (54 x -8)
EnsureWindowOnScreen
   All good.
GLInfo
~~~~~~
GL_VENDOR: Google Inc.
GL_RENDERER: ANGLE (Intel® HD Graphics)
GL_VERSION: OpenGL ES 2.0 (ANGLE 1.0.0.2249)
GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL ES 1.00 (ANGLE 1.0.0.2249)
THREAD - started 'WindowsInputManager' (1460)
OpenGL extensions (16, 16):
GL_ANGLE_framebuffer_blit
GL_ANGLE_instanced_arrays
GL_ANGLE_pack_reverse_row_order
GL_ANGLE_texture_compression_dxt3
GL_ANGLE_texture_compression_dxt5
GL_ANGLE_texture_usage
GL_ANGLE_translated_shader_source
GL_EXT_read_format_bgra
GL_EXT_robustness
GL_EXT_texture_compression_dxt1
GL_EXT_texture_format_BGRA8888
GL_EXT_texture_storage
GL_OES_get_program_binary
GL_OES_packed_depth_stencil
GL_OES_rgb8_rgba8
GL_OES_standard_derivatives
GL_MAX_TEXTURE_SIZE = 4096
GL_MAX_TEXTURE_IMAGE_UNITS = 16
GL_MAX_RENDERBUFFER_SIZE = 4096
GL_MAX_VIEWPORT_DIMS = 4096, 4096
GL_MAX_VARYING_VECTORS = 10
GL_MAX_VERTEX_ATTRIBS = 16
GL_MAX_VERTEX_UNIFORM_VECTORS = 254
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 4
GL_MAX_FRAGMENT_UNIFORM_VECTORS = 221
4 compressed texture formats
texture format 0x83f0
texture format 0x83f1
texture format 0x83f2
texture format 0x83f3
cDontStarveGame::DoGameSpecificInitialize()
cGame::StartPlaying
LOADING LUA
DoLuaFile scripts/main.lua
DoLuaFile loading buffer scripts/main.lua
scripts/main.lua(144,1) running main.lua
 
scripts/modindex.lua(257,1) loaded modindex
scripts/modindex.lua(57,1) ModIndex: Beginning normal load sequence.
 
LOADING LUA SUCCESS
scripts/playerdeaths.lua(79,1) PlayerDeaths loaded morgue 586
scripts/playerprofile.lua(298,1) loaded profile
scripts/playerprofile.lua(356,1) bloom_enabled false
scripts/saveindex.lua(75,1) loaded saveindex
scripts/gamelogic.lua(1052,1) OnFilesLoaded()
scripts/gamelogic.lua(1041,1) OnUpdatePurchaseStateComplete
scripts/gamelogic.lua(73,1) Unload BE
scripts/gamelogic.lua(76,1) Unload BE done
scripts/gamelogic.lua(78,1) Load FE
scripts/gamelogic.lua(80,1) Load FE: done
SimLuaProxy::QueryServer()
scripts/modindex.lua(67,1) ModIndex: Load sequence finished successfully.
 
Reset() returning
HttpClientWriteCallback (0x00590A79, 1, 1007, 0x0409F838)
HttpClientWriteCallback READ 1007 (1007 total)
QueryServerComplete for handle [1] ok, HTTP 200: [{    "standalone":{       "motd_title":"Don't Starve Figures!",       "motd_body":"Don't Starve collectable figures are available now in the Klei Store!",       "link_title":"Klei Store",       "link_url":"http://store.kleientertainment.com"    },    "steam":{       "motd_title":"Don't Starve Figures!",       "motd_body":"Don't Starve collectable figures are available now in the Klei Store!",       "link_title":"Klei Store",       "link_url":"http://store.kleientertainment.com"    }    "rogsteam":{       "motd_title":"Don't Starve Figures!",       "motd_body":"Don't Starve collectable figures are available now in the Klei Store!",       "link_title":"Klei Store",       "link_url":"http://store.kleientertainment.com"    }    "rogstandalone":{       "motd_title":"Don't Starve Figures!",       "motd_body":"Don't Starve collectable figures are available now in the Klei Store!",       "link_title":"Klei Store",       "link_url":"http://store.kleientertainment.com"    } } ]
QueryStats: { "req":"modrank", "field":"Session.Loads.Mods.list", "fieldop":"unwind", "linkpref":"external"}
scripts/screens/modsscreen.lua(766,1) Reloading Mod Info Prefabs
scripts/screens/modsscreen.lua(753,1) Loading Mod Info Prefabs
scripts/screens/modsscreen.lua(758,1) Unloading Mod Info Prefabs
HttpClientWriteCallback (0x005909F8, 1, 708, 0x0409F838)
HttpClientWriteCallback READ 708 (708 total)
QueryServerComplete for handle [2] ok, HTTP 200: [{"modlinks":{"ws-Where's My Beefalo?":"http:\/\/steamcommunity.com\/sharedfiles\/filedetails\/?id=222103064","ws-Always On Status":"http:\/\/steamcommunity.com\/sharedfiles\/filedetails\/?id=180843799","ws-DisplayFoodValues":"http:\/\/steamcommunity.com\/sharedfiles\/filedetails\/?id=170030148","ws-More Map Icons":"http:\/\/steamcommunity.com\/sharedfiles\/filedetails\/?id=253290802","ws-Minimap HUD":"http:\/\/steamcommunity.com\/sharedfiles\/filedetails\/?id=188251898"},"modfeature":{"ws-Where's My Beefalo?":"http:\/\/steamcommunity.com\/sharedfiles\/filedetails\/?id=222103064"},"modnames":["ws-DisplayFoodValues","ws-Minimap HUD","ws-Always On Status","ws-More Map Icons","ws-Where's My Beefalo?"]}
]
scripts/screens/modsscreen.lua(758,1) Unloading Mod Info Prefabs
Collecting garbage...
lua_gc took 0.01 seconds
~SimLuaProxy()
lua_close took 0.02 seconds
ReleaseAll
ReleaseAll Finished
cGame::StartPlaying
LOADING LUA
DoLuaFile scripts/main.lua
DoLuaFile loading buffer scripts/main.lua
scripts/main.lua(144,1) running main.lua
 
scripts/modindex.lua(257,1) loaded modindex
scripts/modindex.lua(57,1) ModIndex: Beginning normal load sequence.
 
scripts/mods.lua(141,1) Loading mod: Upgraded Fire (Longer Fire)
scripts/mods.lua(165,1) Mod: Upgraded Fire (Longer Fire) Loading modworldgenmain.lua
scripts/mods.lua(173,1) Mod: Upgraded Fire (Longer Fire)  Mod had no modworldgenmain.lua. Skipping.
scripts/mods.lua(165,1) Mod: Upgraded Fire (Longer Fire) Loading modmain.lua
scripts/mods.lua(169,1) Mod: Upgraded Fire (Longer Fire)  Error loading mod!
...f/Singleplayer Games/Don't Starve/data/../mods/Upgraded Fire/modmain.lua:1: unexpected symbol near '・
 
scripts/mods.lua(255,1) Mod: Upgraded Fire (Longer Fire) Registering prefabs
scripts/mods.lua(278,1) Mod: Upgraded Fire (Longer Fire)  Registering default mod prefab
LOADING LUA SUCCESS
scripts/playerdeaths.lua(79,1) PlayerDeaths loaded morgue 586
scripts/playerprofile.lua(298,1) loaded profile
scripts/playerprofile.lua(356,1) bloom_enabled false
scripts/saveindex.lua(75,1) loaded saveindex
scripts/gamelogic.lua(1052,1) OnFilesLoaded()
scripts/gamelogic.lua(1041,1) OnUpdatePurchaseStateComplete
scripts/gamelogic.lua(71,1) FE assets already loaded
SimLuaProxy::QueryServer()
scripts/mods.lua(212,1) Disabling Upgraded Fire (Longer Fire) because it had an error.
scripts/frontend.lua(479,1) SCRIPT ERROR! Showing error screen
scripts/modindex.lua(67,1) ModIndex: Load sequence finished successfully.
 
Reset() returning
HttpClientWriteCallback (0x00590A79, 1, 1007, 0x0409F838)
HttpClientWriteCallback READ 1007 (1007 total)
QueryServerComplete for handle [3] ok, HTTP 200: [{    "standalone":{       "motd_title":"Don't Starve Figures!",       "motd_body":"Don't Starve collectable figures are available now in the Klei Store!",       "link_title":"Klei Store",       "link_url":"http://store.kleientertainment.com"    },    "steam":{       "motd_title":"Don't Starve Figures!",       "motd_body":"Don't Starve collectable figures are available now in the Klei Store!",       "link_title":"Klei Store",       "link_url":"http://store.kleientertainment.com"    }    "rogsteam":{       "motd_title":"Don't Starve Figures!",       "motd_body":"Don't Starve collectable figures are available now in the Klei Store!",       "link_title":"Klei Store",       "link_url":"http://store.kleientertainment.com"    }    "rogstandalone":{       "motd_title":"Don't Starve Figures!",       "motd_body":"Don't Starve collectable figures are available now in the Klei Store!",       "link_title":"Klei Store",       "link_url":"http://store.kleientertainment.com"    } } ]
Stale Component Reference: GUID 100026, @D:/USB Stuff/Singleplayer Games/Don't Starve/data/scripts/widgets/text.lua:50
Stale Component Reference: GUID 100027, @D:/USB Stuff/Singleplayer Games/Don't Starve/data/scripts/widgets/text.lua:50
Stale Component Reference: GUID 100029, @D:/USB Stuff/Singleplayer Games/Don't Starve/data/scripts/widgets/text.lua:50
Stale Component Reference: GUID 100029, @D:/USB Stuff/Singleplayer Games/Don't Starve/data/scripts/widgets/text.lua:25
Force aborting...
 

 

This one? cant find how to post .txt files. 

 

EDIT - Figured it out, thanks. 

Edited by Virus714

This one? cant find how to post .txt files. 

At the bottom of the page there's Fast Reply. Below that is Post and More Reply Options. Select More Reply Options to bring up another page with a bigger Reply box. Underneath the Reply box, there's an Attach Files feature. Use this to Browse to your log.txt and hit Attach This File (found underneath) to upload it.

 

Alternatively, wrap all of that text you copy/pasted with [ spoiler ] [ /spoiler ] (without spaces).

E.g.

 The 'Spoiler' function is handy for when you want to post a lot of material but you don't want to occupy too much space. Use this function to hide material but allow those it concerns to access it. This keeps things tidy.

 

Edited by InaneDugong

You have some strange symbol on the first line of your modmain.lua. Remove that.

 

There's literally nothing there, the text on my modmain.lua is the same as the original post, except that I turned the total_day_time into TUNING.TOTAL_DAY_TIME. 

I am having almost the same problem with my mod, and I now know the problem is apparently on line 1, but its a symbol that I cant even type and is no where in my modmain.lua file. I don't know what to do, and I do not understand the BOM, UTF-8, ANSI or any of that talk, so if that's what my problem is as well, can someone explain it a bit better?

sorry if im being stupid or something. but hay #new modder and all that stuff :/

I am having almost the same problem with my mod, and I now know the problem is apparently on line 1, but its a symbol that I cant even type and is no where in my modmain.lua file. I don't know what to do, and I do not understand the BOM, UTF-8, ANSI or any of that talk, so if that's what my problem is as well, can someone explain it a bit better?

sorry if im being stupid or something. but hay #new modder and all that stuff :/

What text editor are you using?

Then check the Encoding drop down. If it's in UTF-8, then try selecting either Convert to UTF-8 without BOM or Convert to ANSI.

oh, its the encoding, i will try changing it to see if it works

 

EDIT

that error is now gone, however now i am getting a problem with the actual code.

 

error from the log

)/Steam/steamapps/common/dont_starve/data/../mods/Poultice's/modmain.lua:59: '}' expected (to close '{' at line 51) near 'cooktime'

 

A bit of the script in question (the majority of the script is variants of this)

AddIngredientValues({"CrushedPetals"}, {flower=1})

local StrongPoultice = {

        name = "Strong Poultice",

        test = function(cooker, names, tags) return names.butterflywings >= 3 and tags.inedable >= 1 end,

        priority = 1,

        weight = 1,

        foodtype="Health",

        health = TUNING.HEALING_HUGE*24,

        hunger = TUNING.CALORIES_HUGE*18

        cooktime = 0.25,

    }

AddCookerRecipe("cookpot", StrongPoultice)

  

Edited by AnimeOfTheArts

i feel a bit bad for troubleshooting on this thread when the crashes have changed from what the original post was about, but after fixing all of the small "oops i forgot that" bugs; the game now just flat out crashes without a log, and from what i can figure out its a nil value, but its listing off game data assets. so im back, with a crashlog of all the important bits,

 

important bits

Collecting garbage...
lua_gc took 0.02 seconds
~SimLuaProxy()
lua_close took 0.02 seconds
ReleaseAll
ReleaseAll Finished
cGame::StartPlaying
LOADING LUA
DoLuaFile scripts/main.lua
DoLuaFile loading buffer scripts/main.lua
scripts/main.lua(158,1) running main.lua
    
scripts/modindex.lua(257,1) loaded modindex    
scripts/modindex.lua(57,1) ModIndex: Beginning normal load sequence.
    
scripts/mods.lua(144,1) Loading mod: Poultice's    
scripts/mods.lua(168,1) Mod: Poultice's    Loading modworldgenmain.lua    
scripts/mods.lua(176,1) Mod: Poultice's      Mod had no modworldgenmain.lua. Skipping.    
scripts/mods.lua(168,1) Mod: Poultice's    Loading modmain.lua    
scripts/mods.lua(103,1) modimport: ../mods/Poultice's/scripts/cookpotfix.lua    
scripts/mods.lua(182,1) Mod: Poultice's      Error loading mod!
...mmon/dont_starve/data/../mods/Poultice's/modmain.lua:106: attempt to index global 'STRINGS' (a nil value)
LUA ERROR stack traceback:
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/../mods/Poultice's/modmain.lua(106,1) in main chunk
        =[C] in function 'xpcall'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/util.lua(439,1) in function 'RunInEnvironment'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mods.lua(179,1) in function 'InitializeModMain'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mods.lua(162,1) in function 'LoadMods'
        scripts/main.lua(226,1) in function 'ModSafeStartup'
        scripts/main.lua(271,1)
        =[C] in function 'SetPersistentString'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(17,1) in function 'SavePersistentString'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/modindex.lua(58,1)
        =[C] in function 'GetPersistentString'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/modindex.lua(45,1) in function 'BeginStartupSequence'
        scripts/main.lua(270,1) in function 'callback'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/modindex.lua(268,1)
        =[C] in function 'GetPersistentString'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/modindex.lua(248,1) in function 'Load'
        scripts/main.lua(269,1) in main chunk
    
LOADING LUA SUCCESS
scripts/playerdeaths.lua(79,1) PlayerDeaths loaded morgue    4640    
scripts/playerprofile.lua(425,1) loaded profile    
scripts/playerprofile.lua(489,1) bloom_enabled    true    
scripts/saveindex.lua(97,1) loaded saveindex    
scripts/gamelogic.lua(1125,1) OnFilesLoaded()    
scripts/gamelogic.lua(1114,1) OnUpdatePurchaseStateComplete    
scripts/gamelogic.lua(86,1)     FE assets already loaded    
scripts/mods.lua(258,1) Mod: Poultice's    Registering prefabs    
scripts/mods.lua(264,1) Mod: Poultice's      Registering prefab file: prefabs/StrongPoultice    
scripts/mods.lua(268,1) Mod: Poultice's        StrongPoultice    
scripts/mods.lua(264,1) Mod: Poultice's      Registering prefab file: prefabs/NormalPoultice    
scripts/mods.lua(268,1) Mod: Poultice's        NormalPoultice    
scripts/mods.lua(264,1) Mod: Poultice's      Registering prefab file: prefabs/BasicPoultice    
scripts/mods.lua(268,1) Mod: Poultice's        BasicPoultice    
scripts/mods.lua(264,1) Mod: Poultice's      Registering prefab file: prefabs/SmallPoultice    
scripts/mods.lua(268,1) Mod: Poultice's        SmallPoultice    
scripts/mods.lua(264,1) Mod: Poultice's      Registering prefab file: prefabs/CrushedPetals    
scripts/mods.lua(268,1) Mod: Poultice's        CrushedPetals    
scripts/mods.lua(281,1) Mod: Poultice's      Registering default mod prefab

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
×
  • Create New...