This project will be no longer developed on this repo. Take a look at next iteration: github.com/Namek/TheConsole which is less hacky internally but doesn't look like Q3A anymore.
Wide-usage JavaScript-able Console for Windows OS, currently looking and animating like the one in Quake 3 Arena game. Currently made with libgdx and Java 8.
Features:
- custom scripts to be called as commands
- command aliasing
- auto-reloading of scripts when script file is modified
- command invoke history like in bash (keys UP, DOWN)
- run one-line JavaScript code directly in shell (do some math or whatever)
- separated JSON configuration for every script
- Copy
core/assets/scripts
into%APPDATA%/TheConsole/scripts
- Import as Gradle project, run
the-console-desktop
- When run, toggle console visibility by global hotkey:
CTRL + ~
- Type
help
and hitENTER
- Have fun by exploring/editing content of scripts and even adding more of them.
- You can exit hitting
ALT + F4
https://gist.github.com/WebReflection/9627010
https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/api.html
args.length
args[0], args[1], ...
Utils.audioFilePlayer.play(filePath)
Utils.exec(filePath)
Utils.execAsync(filePath)
Utils.getClassName(object)
Utils.openUrl(encodeURI(someUrl))
Utils.requestUrl(url) //HTTP GET
console.log(text)
console.log(text, color)
console.error(text)
console.clear()
console.hide()
console.window
assert(bool, string)
assertInfo(bool, string)
JavaClass(className) // Java: Class.forName(className);
System // Java: System.class
Sources for globals:
Utils
is placed in JsUtilsProvider.javaconsole
is ConsoleProxy.java- whole file script is lanched by JsScriptManager.java#runScopedJs()
- Java->JavaScript bindings are made in JsScriptManager#createJsEnvironment JavaScriptExecutor.java#ctor
Every script can store it's configuration or whatever. To see some examples go see filesystem
.
-
Get your storage:
Storage = Storage.getGlobalStorage("myscript")
-
Get variable
var path = Storage.get("path") console.log(path)
-
Overwrite variable and save Storage
var newPath = ... Storage.set("path", newPath) Storage.save()
You can assert
whatever you like, e.g. script arguments.
When first argument of assert
/assertInfo
is not true, it stops whole scripts and displays given text to the console:
-
red text:
assert(args.length == 0, "Please, no args.")
-
white text:
assertInfo(args.length == 0, "Please, no args.")