2 Screenshots

About This File

A few improvements to the console.

On Steam: http://steamcommunity.com/sharedfiles/filedetails/?id=173892495

Major features

  • Console log is scrollable
  • Console log no longer prints file/line number information (but log.txt still does)
  • 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
  • Many general useability improvements, bugs that have been fixed, and small but useful tweaks

Minor features (the rest)

  • Console always runs the "consolecommands" script when it is opened (no more having to do RunScript("consolecommands"))
  • Console log gets hidden whenever the console closes
  • Console history ignores consecutive duplicate lines
  • Console log and console input text is slightly smaller
  • Console log has word wrap enabled
  • Fixed console history not properly resetting when you move up through the history and then back down to the start
  • 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)
  • Added c_nextday() command as a shortcut for GetClock():MakeNextDay()
  • 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 GetPlayer()" would print something like "100009 - wilson"); basically return can be used as somewhat of an alias of print
  • Console prints back any command you give it with "> " prefixed in front of it
  • Console has a transparent black background
  • Console can print multiple return values
  • Console will auto-execute console commands (example: "c_nextday" would translate to "return c_nextday()")
  • If the first character of an inputted line is '=', then it will be translated to 'return ' (example: "=test" becomes "return test")
  • Better, more informative error handling for inputted lines

Things that are not currently possible with Lua:

  • Moving the text input cursor (for example, moving the cursor based on mouse clicks)
  • Any sort of real text selection
  • Copy/paste support

Get involved:


What's New in Version 1.3.1   See changelog

Released

  • Bumped API version to 6
  • Made the new CTRL+V paste support enabled by default



User Feedback

Recommended Comments

Nice mod! The only thing I would change is the font size. On my end at least, it's about twice as small as the original size. Rather hard to read on a small screen when you play windowed.

Share this comment


Link to comment
Share on other sites

Nice mod! The only thing I would change is the font size. On my end at least, it's about twice as small as the original size. Rather hard to read on a small screen when you play windowed.

 

Thanks. Yeah, I realized that the font size might not work for everyone's resolution. You can disable it by changing ENABLE_SMALLER_FONTS to false in modmain.lua.

 

Got a bugfix update ready that I'll upload in a few minutes.

Share this comment


Link to comment
Share on other sites

Good stuff! Was wondering: Is it possible to wedge a _G lookup in the code before the input gets executed so that we can add our own stuff as real console commands instead of having an interactive Lua mode? For example typing c_nextday instead of c_nextday() and the code searches _G['c_nextday'] first and calls it if exists, execute normally if not?

Share this comment


Link to comment
Share on other sites

Good stuff! Was wondering: Is it possible to wedge a _G lookup in the code before the input gets executed so that we can add our own stuff as real console commands instead of having an interactive Lua mode? For example typing c_nextday instead of c_nextday() and the code searches _G['c_nextday'] first and calls it if exists, execute normally if not?

 

I'll look into that.

Share this comment


Link to comment
Share on other sites

I'll look into that.

If you're going to do that, put an option to disable it, as it breaks the semantics of the Lua language.

But anyway, great mod. These improvements are much in need. I just have a few suggestions/requests:

  • Instead of trying to add a "return " prefix when you get the "attempt to call a nil value" error, which may as well be a real error, have you considered doing what the standard Lua interactive Lua interpreter does? It checks the line to see if "=" is its first character, and if so replaces it with "return " (it relly replaces it, even in the history). That way you have both complete control over what you get to print and you get syntactic convenience, writing things like "= a" to print a variable a, or "= foo()" to print the return values from foo.
  • Have you considered adding support for printing multiple return values? To do that, you'd wrap the pcall(loadstring(...)) call in a table, i.e. {pcall(loadstring(...))}, checking the first element of this table as the status variable and printing the rest through

    nolineprint( select(2, unpack(the_table_variable)) )
  • Could you make things more modmain-based? Doing a diff of your overridings agains the standard game files, I saw this is definitely possible. It makes sense to override consolescreen, since you're implementing a new screen that may not benefit from vanilla changes in this file. But I think the TextEdit widget should definitely be patched through modmain.
  • What about a real configuration file, that doesn't need to be replaced on mod updates?
Finally, have you thought about opening this project up as a collaboration, since this is quite a handy tool for basically everyone? If doing so, I could certainly help with what I asked/suggested above.
  • Like 1

Share this comment


Link to comment
Share on other sites

Definitely, simplex. This mod started out of frustration with the console (and without much intention of releasing it), so I did it really quickly and without much thought put into compatibility/overwriting/configuration.

I've started a Github repo for it: https://github.com/squeek502/Better-Console

Collaboration thread: http://forums.kleientertainment.com/index.php?/topic/27119-better-console-collaboration-thread/

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