Lumina Posted November 29, 2017 Share Posted November 29, 2017 Hi, I'm testing a mod and it would be more convenient to have shortcut for some commands i'm using often, like when i want to give myself some items. How can i add my own commands to the game ? Thanks. Link to comment Share on other sites More sharing options...
CarlZalph Posted November 29, 2017 Share Posted November 29, 2017 Klei/DoNotStarveTogether/customcommands.lua Link to comment Share on other sites More sharing options...
Lumina Posted November 29, 2017 Author Share Posted November 29, 2017 Thanks. Link to comment Share on other sites More sharing options...
Lumina Posted November 30, 2017 Author Share Posted November 30, 2017 So, i encounter some problem. The file didn't existed on this folder, i created it. Then i created my command. But when i'm trying to use it on game nothing happens. There is nothing in the log about something wrong with the custom command. Here is the content of my file : function c_gofast(player) player = ListingOrConsolePlayer(player) if player ~= nil then c_select(player) c_give("cane", nil, true) c_give("yellowamulet", nil, true) end end (I used the "c_goadventuring()" command as a template). The console command itself is enabled. Do i have to enable the custom command too ? Should i add something in my custom command lua file ? What is missing ? Thanks for help. Link to comment Share on other sites More sharing options...
Lumina Posted December 2, 2017 Author Share Posted December 2, 2017 So, does anyone has an idea about what is wrong ? Link to comment Share on other sites More sharing options...
Backtalker Posted December 2, 2017 Share Posted December 2, 2017 (edited) Another way you can do this is by making a mod (If you want to make a mod for it) If not, then their way is perfectly sustainable. If you are making a mod for it you can do this. local d = function(text) if not type(text) == "string" then return end print(string.lower(tostring(text))) -- A word of warning, I come from a simplified lua, so I amm not sure if this would work. end GLOBAL.d = d -- Creates the console command "d" For example, if my simplified version of LUA works, then it should lower the string. Edited December 2, 2017 by Backtalker Link to comment Share on other sites More sharing options...
Weexer Posted December 7, 2017 Share Posted December 7, 2017 @Lumina looks like customcommands.lua doesn't work anymore, it's not working for me aswell. Im sure Your function will work if You paste it there: ...\Steam\steamapps\common\Don't Starve Together\data\scripts\consolecommands.lua Be aware that file can be overwritten by updates. Here are custom commands that i use for testing ingame: function c_speed() c_give("cane") c_give("yellowamulet") c_give("minerhat") c_give("walrushat") end function c_fight() c_give("armorwood") c_give("hambat") c_give("wathgrithrhat") end function c_stats() ThePlayer.components.sanity:SetPercent(1) ThePlayer.components.health:SetPercent(1) ThePlayer.components.hunger:SetPercent(1) end function c_stats2() AllPlayers[2].components.sanity:SetPercent(1) AllPlayers[2].components.health:SetPercent(1) AllPlayers[2].components.hunger:SetPercent(1) end function c_creative() c_listallplayers() c_supergodmode() ThePlayer.components.builder:GiveAllRecipes() end function c_creative2() c_supergodmode(AllPlayers[2]) AllPlayers[2].components.builder:GiveAllRecipes() end Hope i helped a little Link to comment Share on other sites More sharing options...
CarlZalph Posted December 7, 2017 Share Posted December 7, 2017 Customcommands.lua still works. If you're trying to use it on the server, then put it in the server's directory and not your client's. Else you'll need to use TheNet:SendRemoteExecute on the client. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now