Giter Site home page Giter Site logo

chonsole's Introduction

Modern chili console for the Spring Engine.

Features

  • history persistant through restarts, history autocomplete
  • detailed command overview
  • custom command support (/gamerules, /execw, etc.)
  • integration with liblobby for Spring lobby communication
  • i18n

Dependencies

  • Spring 101.x+
  • chili
  • liblobby (optional, support for Spring lobby communication)
  • i18n (optional, support for i18n)

Install

  1. Obtain the repository either by adding it as a git submodule or by copying the entire structure in to your Spring game folder. Put it anywhere (although /libs is suggested and used by default).
  2. Copy the file ui_chonsole_load.lua to the luaui/widgets and luarules/gadgets folders and modify the CHONSOLE_FOLDER path.

Customization

Basic configuration can be done in the luaui/config/globals.lua file. It is possible to set console size, position, color of the suggestions and more.

Chonsole can also be extended by creating custom commands and contexes. This is done by creating extension files and putting them in the exts folder. Chonsole already comes with four extensions:

  • core: improves existing engine functionality
  • exec: allows execution of arbitrary Lua code
  • rules: allows modifications of {game,team,unit}rule variables
  • lobby: provides commands for connecting to the Spring Lobby server

Each extension can have the following:

  • command table: defines commands that can be executed
  • conext table: defines contexts which modify how text is interpreted (e.g. Allies: is an context included by default)
  • an additional i18n file can be put in the exts/i18n folder

The command table has the following format:

	commands = {
		{
			command = string, -- name of the command to be displayed
			description = string, -- description used to explain the command to the user
			cheat = boolean, -- whether command requires cheat to be executed (extensions don't need to very if cheating is enabled, this is handled by chonsole automatically)
			suggestions = function(cmd, cmdParts)
				local suggestions = {}
				-- this function is used to generate the (sub)suggestions for the command, optional
				-- this is done to present the user a list of valid (or suggested) arguments
				return suggestions
			end,
			exec = function(command, cmdParts)
				-- function that executes the command, mandatory
			end,
			execs = function(luaCommandStr)
				-- function that executes the command in a synced gadget, optional
				-- in case this is wanted, the user should first send required data using Sync(...) in the exec command
			end,
			execu = function(luaCommandStr)
				-- function that executes the command in an unsynced gadget, optional
				-- in case this is wanted, the user should first send required data using Unsync(...) in the execs command
			end,
		},
		-- list of commands
	}

The context table has the following format:

	context = {
		{
			name = string, -- name of the context, used internally to differentiate between them
			parse = function(txt)
				-- function that returns true if the matching string (starting with /) belongs to the given context, mandatory
				-- for example, it could be used to match all strings starting with /a as belonging to the "allies" context
			end,
			exec = function(str, context)
				-- function that executes the string in the given context, mandatory
				-- this is used to execute the text following the command, e.g. in the case of "allies", it should send the entered text as a chat command to all allies
			end
		},
		-- list of contexts
	}

For additional details, check the existing examples.

chonsole's People

Contributors

gajop avatar

Stargazers

 avatar

Watchers

 avatar

chonsole's Issues

add action support bindings

Currently the way of switching contexts or opening chat is predefined.
Rely on Spring keybindings for support.

Use or invent a standardized method for adding custom commands

It would be greatly beneficial if we could have a standardized way of adding custom commands that would be used by other console implementations as well as the engine one.

It should be possible to register widget, gadget (synced and unsynced) commands by also providing their name, cheat and description fields.

These commands should be appear in the / and support seamless execution by Spring.SendCommands().
The implementation could be an engine one, or relying on a new, third party library (that would at least separate Chonsole from the command execution)

better tab completition

tab completion should just complete to the nearest decision point and then print out the list of possible options, instead of cycling around (make this an option used by both when menu is disabled and when it's not)

overlap in suggestions box

At the top of the suggestions box, the suggestions overlap. The 'texture' suggestion seems to be responsible.

ch

Too reproduce, just checkout the BAR svn and mimic the screenshot (I integrated chonsole). We are using the latest chili.

Configurable suggestion menu direction

The suggestion menu direction should be configurable, and it should also provide smart autodetection:

  • The default should be top->bottom
  • In case there is no space using the default, it should revert to bottom->top. It's fine to ignore space requirements if the user forces it to be bottom->top

Better username chat autocomplete

Currently we can only autocomplete usernames by using the /w command.
Make it so it also autocompletes them for regular chat (create a utility function that can be invoked in say/ally/spec/marker and other contexts).
It should also be able to handle clan information, e.g. names starting with [X]
Plan ahead -> this kind of autocomplete could also be used for lobby channels so autocomplete should work on a userlist specified by the function call and not rely entirely on engine-obtained user lists.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.