3 Screenshots

About This File

This mod improves upon the Lua console in Don't Starve Together.  It was started as a collaboration between this author and @squeek.

Major Features

  • Extended and configurable command history. Each history line is editable (that is, scrolling past a previous line will save any modifications to it), and the command history is preserved saved between game sessions.
  • Console log is scrollable
  • Console keeps focus when you'd expect it to
  • Console doesn't close after each line entered
  • Added basic CTRL+A select all support (hitting backspace after CTRL+A will delete all the text)
  • Added support for multi-line inputs (useful for e.g. function definitions and for loops)
  • Many general useability improvements, bugs that have been fixed, and small but useful tweaks
  • Better, more informative and less cluttered error handling

Minor features

Spoiler
  • With the "Hide on close" option, the console log gets hidden whenever the console closes
  • Console log and console input text is slightly smaller
  • Console log has word wrap enabled
  • Modified the c_select command so that it will set the debug entity to whatever is under the mouse if it is called with no parameter (default c_select requires a parameter)
  • With the "Variable autoprint" option, the console will automatically print back the value of any variable you enter (for example, if you do "test = 1" and then just "test" it will print back "1")
  • If you use "return" it will print back the value that is returned (for example, "return ThePlayer" would print something like "100009 - wilson"); basically return can be used as somewhat of an alias of print. This supports multiple return values, such as "return 1, 2, 3".
  • The console prints back any command you give it prefixed with "> " if on local execution and "% " if on remote execution.
  • The console has a transparent black background
  • With the "Command autoexec" option, the console will auto-execute console commands (example: "c_teleport" would translate to "return c_teleport()")
  • If the first character of an input line is '=', then it will be translated to 'return ' (example: "=test" becomes "return test").

Technical features

Spoiler

As illustrated in the screenshots, console commands run in their own environment, but with full access to the global environment, which also remains accessible in the tables _G and GLOBAL (which are aliases of each other).

This means global variables can be freely used, but new variables aren't exported to the global environment unless this is done explicitly via _G or GLOBAL. When accessing variables, those in the console environment take precedence over globals. Combining these two properties, the console environment becomes its own sandbox for code execution, with variables set not running the risk of clashing with global variables and inadvertently affecting the game state, but still retaining full access to these global variables.

In addition, every extension this mod does to standard commands and functions is done in this private environment, also preventing clashes with the game and other mods. This structure encourages greater use of the console as a place in which to write actual code to diagnose or manipulate the game state.

Dedicated server support

This mod has essentially two elements: extending the console UI and extending the processing and execution of Lua code. The former makes sense only in a client, and requires only the client to cooperate, and this is why this is a client mod. However, it may still be enabled in servers, including dedicated servers (though force enabling from modsettings.lua may be required). If that is done, the extensions to the execution of Lua code (including syntax extensions and all that was discussed in the "Technical features" section) will be applied to the server, both for code transmitted to it via a remote console by an admin user and for code read by a dedicated server from its terminal input.

Get involved

Repository on GitHub (branch together)


What's New in Version 2.0.0   See changelog

Released

Made the modicon show in the forum page

  • Like 3



User Feedback

Recommended Comments

On 5/19/2016 at 6:59 AM, cezarica said:

Would be great if you would update the Steam one as well. That version is bugged and crashes the game. :|

I plan on uploading it to Steam once the DS and DST codebases are fully unified. The version posted here does also work under singleplayer Don't Starve, though it still has some glitches I have to iron out in that case.

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