A Godot 4 Plugin. Provide a runtime console so your can run any script expression in your game!
✅ Flexible conosle window with edge snapping, resizing and dragging.
✅ No need to define complex commands, extremely easy to run code in your game directly.
✅ Simple but reliable notification system. Send notifications whenerver you want.
✅ Floating widgets system. Monitor variables or performance, add buttons and save them in runtime .
✅ Auto-complete your expression using tab
with help information extracted from your code.
✅ Navigate throught submit histories using up
/down
.
✅ You can always press F1 and search PankuConsole
in your editor to get the coding documentation.
- Clone or download a copy of this repository.
- Copy the contents of
addons/panku_console
into yourres://addons/panku_console
directory. - Enable
PankuConsole
in your project plugins.
For more detailed information, please visit Installing plugins
-
Enable this plugin, it will add an autoload singleton which named
Panku
in your project. -
Run any scene, press
~
key, and the console window will pop up. (The key can be changed in the script) -
The console window explanation:
- The title, drag this to move the window around.
- Exit button, click to close the window.
- Env options, use
Panku.register_env()
to add more envs. - Input field, press enter to submit, up/down to navigate history input.
- Resize button, drag this to resize the window.
-
Try to type 'abs(cos(PI))', you will see the result
1
. -
Now, try to type
help
and you will get some basic hints.How is this implemented? Well, it's EXTREMELY easy, just define a variable or constant like this in the
default_env.gd
, more details will be explained in the next step.const _HELP_help = "this string will be used as help info in auto-completion" var help = "available methods: say_hi(), enable_in_game_logs(bool), cls()"
-
The core execution procedure is implemented by
Expression
which is a class that stores an expression you can execute.For example, you can add
Panku.regiter_env("player", self)
in the_ready()
function of your player script. Once it's done, suppose there is a variable calledhp
in your player script, you can typehp
(The left option button should beplayer
) in the console, then you will get the actual value of player's hp. What's more, you can typeset("hp", 100)
to change the value(Note that you can't usehp=100
since this is not a valid expression).For more information about what is
Expression
, please visit Evaluating expressions -
Check
panku.gd
or typeF1
and searchPankuConsole
to see what you can do with the global singletonConsole
At last, please pay attention that while this plugin is powerful, it's not ready for players since Expression
is unsafe and exposes lots of internal structure.
A safer command system is being actively developed which can be used by the players, see the Roadmap part below.
We're planning to add more features to this plugin in the future, stay tuned!
Roadmap: Panku Console Roadmap
You are welcome to make contributions, feel free to make issues, proposals and pull requests.
Licensed under the MIT license, see LICENSE
for more information.