FPSConsole

Home

Documents / Manual / Table Of Contents

Under construction.

Configurations

This sections covers all available configuration options.

There should be a "global_cfg.lua" file in the FPSConsole root. This file is currently loaded automatically when FPSConsole starts and it contains all default values for the config options. It also acts as a sample config file.

If you would like to load another config file, use the "load_cfg".

command_shortcuts

This table can be used to make your own command shortcuts or even new commands (which reuse old ones).

See Commands / Shortcuts and the file "global_cfg.lua" for examples.

directories

Valid variables:

keyboard_bindings

Valid Variables:

User defined keyboard bindings

Defining your own custom keyboard bindings is very easy. Here is an example:

test_binding = 
{
	kbd_shortcut = "CTRL+Q",
	command = "echo \"this is a test!\"",
},

As you see, you need to create a new table for every keyboard binding. There are two required variables that need to be defined in the table. They are:

regexes

Valid variables:

window

Valid variables:

startup

consoles

Valid tables(bold)/variables:

Commands

Generic Syntax

All commands have the same syntax:

command ["arguments"]

Naturally, not all commands take arguments. The quotation marks are needed only if there are spaces or semi-commas in string. I still suggest that they should be used always, since there are some issues with the command parsing. Test and see.

Chaining

Commands can be chained by adding a semi-comma to the end of the command. Example:

cls; echo "foo"; echo "bar"

The above example first clears the output control with the "cls" command and then prints the string "foo" and "bar" to it.

Shortcuts

Command shortcuts can be used to give alternative names to commands or even to make new commands by using the old ones. I will use the following shortcut to explain how they work:

get_o =
{
	command = "lua \"echo ( get ('__ARGS__') ) \"",
	shortcut = "get_o", 
},

The "shortcut" variable contains the command that can be used to execute the binded command. The specially formated string "__ARGS__" will get replaced with the arguments that are passed to the shortcut. So the command

get_o "tmp.os"

Would look like

lua \"echo ( get ('tmp.os') ) \"

after parsing.

The above shortcut passes the given argument string to the Lua interpreter. The Lua interpreter then calls the built-in FPSConsole command "get" to retrieve the operating system description. After "get", the OS description is echoed to the output control via another built-in command "echo".

Note

If you will replace the "echo" command with the Lua "print" command, nothing will get printed out. This is because the Lua interpreter is built-in to FPSConsole and not executed as a new process. If it would be executed as a new process, the input/output of the script would be piped to the output control (like when using a Python script with an external Python interpreter.).

Built-In Commands

Some of the built-in commands are pretty straightforward to use but there are also few commands which require their own argument syntax.

We will not go thru every built-in command and I will try to explain how to use them.

calc

Calculates the given statement. Syntax:

calc statement

Since "calc" is directly using the Lua scripting language, you can use all of the mathematical functions (that Lua supports) in the statement! Example:

calc "math.random()+math.random()"

For more information, please refer to the Lua Reference Manual and to the Math Library Tutorial.

cls

Clears the output control.

echo

Echoes the given string to the output control. Syntax:

echo foo

echo "foo with some spaces and a semi-comma;"

Changing the Text Color

The text colour can be changed by adding a backward slash and a hex color value to the string. An example follows:

echo "\#24FF00Some green text!"

Note that currently only the first parsed hex colour is used, others will be ignored (So the first hex colour defines the color for the whole string, no matter where the hex value was.).

exec

Executes the given executable. Syntax:

exec "C:/Path to / the / executable"
fonts

Prints out all available fonts. This can be useful when setting up the used font.

get

Returns the value of the given variable. Syntax:

get tmp.os

get colors.background_output

This command doesn't currently print the requested variable but you can easily fix that. Snippet:

get_o =
{
	command = "lua \"echo ( get ('__ARGS__') ) \"",
	shortcut = "get_o", 
},

If you add this to the "command_shortcuts" table in the config file and run it from the application, you will see that it now gets printed out. If you would like this to be the default behavior, just change value of the "shortcut" variable to "get". This will override the built-in "get" command.

hide

Hides the application

lua

Executes Lua statements.

Almost all built-in commands can be used via Lua. Some functions like "calc" are not available since they use Lua them self too. An example on how to execute an built-in function with Lua:

lua "echo ( get ( 'tmp.os' ) )"

The above statement first calls the "get" command to retrieve the current operating system description and then echoes it to the output control.

Files can be executed too:

lua "extensions/about.lua"

You should find the file "about.lua" in the extensions folder.

References: Lua 5.0 Manual

load_cfg

Loads the given config file. Syntax:

load_cfg "C:/path/to/the/config/file.foo"
quit

Exits the application.

reload_cfg

Reloads the previously loaded config file.

restart

Restarts the application.

save

Saves the content of the output control. Syntax/Example:

save "C:/foo/bar.baz"
set

Sets an config value or an temporary variable. Syntax/Example:

set "keyboard_bindings.hotkey=Q"

set "tmp.foo=bar"

set "command_shortcuts.exit.command=exit"

Temporary variables are not stored to a file so they are valid while the program is running.

show

Shows the application (which could have been hidden with the "hide" command.). Designed for extensions.

view

Opens the given file to the output control. Syntax:

view "C:/path/to/the/file"
set_active_console

Sets the active console. Syntax/Usage:

set_active_console "NameOfTheConsole"
new_console

Creates a new console with the given name. Syntax/Usage:

new_console "NameOfTheConsole"
get_consoles

Prints out the list of available consoles.

del_console

Deletes the console with the given name.

next_console

Sets the next console as the active one.

prev_console

Sets the previous console as the active one.

tile_horizontally

Tiles consoles horizontally.

tile_vertically

Tiles consoles vertically.

maximize_console

Maximizes (and sets active) the console with the given name or the active one if no name was specified.

SourceForge.net Logo
Built With wxWidgets