Code Monkey home page Code Monkey logo

godot-console's People

Contributors

allcontributors[bot] avatar braboware avatar cryszon avatar eisclimber avatar gamemap avatar guillaumecailhe avatar hilfazer avatar joshdegraw avatar lyaaaaaaaaaaaaaaa avatar quentincaffeino avatar rcubdev avatar renovate[bot] avatar schuette-pw avatar scorpioninc avatar spyrexde avatar zhwt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

godot-console's Issues

Behaviour: Tab should autocomplete commands in history.

As a lot of the time commands can autocomplete to different commands it's been common in Bash and other linux command lines to have tab autocomplete to the next option.

if you have commands 'hef', 'hel' and 'help' then h- displays hef as it's the shortest and closest match. again (after completed to hef) autocompletes to hel then one last time autocompletes to help.

This can be done by holding the original typed string in a buffer (variable or such) and then iterating over the original list of autocompleted options. Typing again would clear this buffer and option list.

Thanks,
Michael Brune

Error when single or double quote after string

I get the error Invalid operands 'String' and 'Nil' in operator '+'. when I try writing, for example, somestring' or even just '' in the console. It doesn't happen for a singular standalone single/double quote '. It also doesn't give an error for 3+ quotes '''.

It's also worth noting that if there is more than one quote after the string ex. hello'' the console will say Command `ello'` not found. culling the first char in the string, which may or may not be related.

"Invalid call. Nonexistent function 'getValueIterator' in base 'Reference (CommandCollection.gd)'." when trying to complete command name with Tab

run the project, write 'foo' in the console then press TAB twice
following error occurs
Invalid call. Nonexistent function 'getValueIterator' in base 'Reference (CommandCollection.gd)'.

try same steps but with 'h' written into the console

there is a problem if there are multiple autocomplete options

MRP: https://www.dropbox.com/s/hvnc7vlwp0igle7/ConsoleAutocompleteError.7z?dl=1

callv: Error calling method from 'callv': 'Node(CustomCommands.gd)::kill': Method expected 1 arguments, but called with 0.

I'm getting this error when trying to call my custom command:

E 0:00:04.854   callv: Error calling method from 'callv': 'Node(CustomCommands.gd)::kill': Method expected 1 arguments, but called with 0..
  <C++ Error>   Method failed. Returning: Variant()
  <C++ Source>  core/object.cpp:830 @ callv()
  <Stack Trace> Callback.gd:55 @ call()
                Command.gd:72 @ execute()
                ConsoleLine.gd:129 @ execute()

This is how I'm registering my command:

func _ready() -> void:
    Console.add_command("kill", self, "kill")\
        .set_description("Kills the player instantly by dealing 100 points of damage. Takes in a player username as an argument. If no username is given, kills the player that ran the command.")\
        .add_argument('victim', TYPE_STRING)\
        .register()

And this is the function that it calls:

func kill(victim):
    $"/root/GameController".get_node(str(victim)).take_damage(100, "shotgun", Global.username)

Both of these are in an autoloaded script and I followed the format from the docs.

Request to change default key to open console

So the problem with just the key code KEY_QUOTELEFT is that on some keyboards it refers to a not that rare used letter. That's also the reason why VSCode's default key to open the console is Ctrl + KEY_QUOTELEFT.
I would ask for doing the same here, so people with a different keyboard layout won't be forced to adjust the settings.

Autocomplete on ENTER works only once

For example, I type 'comm', press ENTER. It executes the command 'commands'.
If I type 'comm' again, press ENTER, I get :
[ERROR] CommandGroup: _getCommand: Unable to provide with proper autocomplete.

This goes for any command. Does a first ENTER will work, then any subsequent try gives the error above.

Using Godot 3.1.2

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/automatic_release.yml
  • actions/checkout v3
npm
addons/@quentincaffeino/godot-callback/package.json
addons/quentincaffeino/console/package.json
  • gut 7.3.0
package.json
  • gut 7.3.0
nuget
demo-csharp/Demo-csharp.csproj
  • Godot.NET.Sdk 3.3.0

  • Check this box to trigger a request for Renovate to run again on this repository

Use theme file to define styles of the controls

Using a Console.theme file, that the user is able to edit with ease, would enable every user to adjust the style of the console to fit their game's style. Also, things like increasing the console's font size on bigger screens would get possible. I think it even will save a bit of memory.
Would be a great and relatively easy to do upgrade :)

Optional arguments

As far as I can tell, there's no way to make an argument optional. This would be really nice, and I imagine not too complicated to implement, but I've tried and I don't understand the code well enough

[Behaviour] Minecraft-like (Awaiting modular structure)

Hi,

Would it be possible that you switch the commands with tab? (like for example in Minecraft)

You have these commands:
sayhello
seeversion

So if you type S, a small HBoxContainer will show all commands with S, and if you type TAB, the command line will show "sayhello", and if you type TAB a second time, the command line will show "seeversion.

Otherwise the chat will be crowded with all commands. (If you use it also as chat)

Thanks,
Gamemap

Parser Error: Expected Indent block after 'if'

It's possible this is my problem, but I am receiving this error in Console.gd. Reviewing it, the code indent blocks look messed up, they are two spaces instead of the traditional four. I don't think that is the problem though, it looks like some tabs are missing? At any rate, this causes the code to error out. Any suggestions?

image

Tweak the code style to match the GDScript style guide

Right now, this plugin uses camelCase for method names, whereas snake_case is typically used in GDScript. Constants also use PascalCase, but the GDScript style guide recommends using UPPER_SNAKE_CASE for those.

It would be good to modify scripts to better match the core Godot API and other established plugins out there. This way, users can use the plugin's methods without introducing style clashes in their existing scripts.

[Suggestion] Reset to default

Something like Console.reset_to_default() to remove all commands besides the default ones.
My player character is creating console commands, but when I switch levels or go to the menu, all the commands break because they can't find a reference. Also, in the menu, commands relating to the player or gameplay shouldn't work anyway, and it's a lot to remember to remove each command manually when the scene changes, and adding a call for each new command I create.

Method 'new' not declared in current class.

Tried installing the project, but I'm getting an error in Argument.gd->build.
I've added Console.tscn as an autoloaded singleton, but this is still happening.

project.godot included in the zip.

project.zip

Ver: Godot 3.1 stable

ObjectDB instances leaked at exit

Godot version: v3.2.3.stable.mono.official
godot-console version: 3.1.3

OS/device: macOS 10.14.6, MacBook Pro (2017)

Issue description:
When exiting a project with godot-console enabled, there are many ObjectDB instance leaks.

Steps to reproduce:

  • Run godot in verbose mode
  • Create new project
  • Create main scene
  • Install godot-console
  • Activate godot-console in plugins menu
  • Exit godot

Minimal reproduction project and log output:
console_test.zip
log_output.txt

How to: add_commands

Hi,

you have build a good addon, but sadly I don't understand how to add commands.
Please tell me how to do that.

Thanks,
Gamemap

Not running

when copying the project and testing it this shows up

Invalid call. Nonexistent function 'register' in base 'Nil'

im new to Godot so i dont know what im doing wrong

Improve documentation

The documentation is a bit lacking. I'm not really away of everything this add-on can do, and I often have to dig into the source code to figure out how to do something. I'd be willing to help in this endeavor, if you can tell me how I can.

Colored bbcode doesn't work in 3.5.stable anymore

While trying to get an error message to show with red color in the console, I noticed that not even the basic console messages have their yellow color (This is in 3.5.stable):

image

I quickly tested the console in 3.4.4.stable and yes the colors are back.
So, it seems like 3.5.stable breaks something with bbcode. Probably not just the colors.

non working animated sprit

my animated sprit does not working
when i press up the player jump and it play the first frame and ignore the rest
there is for frames but just the first who play

[Suggestion] Make the console a node

Right now, the console is automatically autoloaded and works in every scenes of the project.
What if I don't want this behavior ?
I might want to use the console only in certain scenes : for example, I might want it in the actual game for quick debugging, but not in the actual menu.

I suggest the console should be working only when you instanciate it in a scene.
I know "toggle" can be called to avoid that but I feel this would make more sense in terms of Godot's design principles and would respect separation of concerns. Having a UI Node seems more fitting because you wouldn't have to edit directly the plugin to make changes.

I know that this is possible in Godot : https://docs.godotengine.org/en/stable/tutorials/plugins/editor/making_plugins.html#a-custom-node

Of course, the new control node would need to be easily modified with an exposed interface : exported variables, functions, signals, etc...
Ideally, users shouldn't have to look at the code of the plugin if they don't need to.
I think this would fit pretty well with #24

Add a project icon

The asset library page currently points to an icon URL that doesn't exist, causing warning messages to be printed in the editor console.

Please add an icon.png to this repository to solve the issue ๐Ÿ™‚ Its dimensions can be 128ร—128 (preferably) or 64ร—64.

History

Maybe you can write in the documentation that you can change the number of saved previous commands. (Console.gd line 30)

Or are there problems if you set the value too high?

Gamemap

Fix for 3.1

I was able to get this functioning i 3.1 but in order to do it I needed to basically remove all of those init scripts that you have.

I did not fully understand how they were being used.

I would think that many of the objects that you have created need to be converted into GDS classes now so that they are registered globally.

I did not make a pull request because I was not sure what your approach to fixing this is.

Behavior: Clear text when hitting enter even if not valid command

So if you type an invalid command and hit enter the invalid command sticks around.

From my experience (warning: anecdotal) hitting enter should clear the invalid command but add it to the history. If you want to recall the command you'd hit up and adjust it.

As this behavior can be created in 2 line changes in ConsoleLine.gd (091-092) I'd think that this is instead by design? Perhaps some sort of plugin option might be best if it's conflicting design with defacto standard?

Thanks,
Michael Brune

Split current CommandGroup in branches.

Move CommandGroup to other branch that until it's ready for some usage (autocomplete).
Return old code where regular Dictionary was used cause it used to work.

Optionally forward command name as first argument to command execution callback function

I am implementing this console add-on for a client in a networked server-client project.

When my client connects to the server, the client & console addon will dynamically register new commands that get sent from the server.

The problem is that I can only link all the callback functions to the same function as GDScript doesn't allow me to generate new function bodies and link those, see example below:

func consoleAddCommands(commandName : String, commandDescription : String, commandArguments : Dictionary) -> void:

  var functionName : String = "sendServerSideCommand" + str(commandArguments.size())
  var commandBuilder = Console.add_command(commandName, self,functionName)\
  .set_description(commandDescription)

  for argumentName in commandArguments:
	  commandBuilder.add_argument(argumentName,typeof(commandArguments[argumentName]))

  commandBuilder.register()




func sendServerSideCommand0(commandName) -> void:
	networkhound.send_message("serverSideCommand", [commandName])
func sendServerSideCommand1(commandName, arg0) -> void:
	networkhound.send_message("serverSideCommand", [commandName, arg0])
func sendServerSideCommand2(commandName, arg0, arg1) -> void:
	networkhound.send_message("serverSideCommand", [commandName, arg0, arg1])
func sendServerSideCommand3(commandName, arg0, arg1, arg2) -> void:
	networkhound.send_message("serverSideCommand", [commandName, arg0, arg1, arg2])
=> Etc..

This code does not work because the console add-on does not provide commandName to the callback functions, a way to circumvent that is to have the user input the same command twice, both as command name and as the 1st argument but this is not ideal.
So each time a callback fires from a dynamically added command, I get the correct variating arguments, but no way of identifying which exact command was executed.

Implementing a way to optionally register some commands that are expected to provide the commandName as the first argument to their callback functions would be really useful!

Optional arguments dont work in C#

I'm using:

  • Godot 3.4.4
  • godot-console 3.5.1

Given:

	public override void _Ready()
	{
		// ...
        wrapper.AddCommand("start_host", this, nameof(BeginServer))
            .SetDescription("beings a dedicated host on %port% with %maxPlayers%. \"")
            .AddArgument("port", Variant.Type.Int)
            .AddArgument("maxPlayers", Variant.Type.Int)
            .Register();
	}

    public Error BeginServer(int port = 25000, int maxPlayers = 2)
    {
        // ...
    }

the command is successfully registered. If i run the command with arguments provided:

start_host 25000 2

then the command successfully runs. However, if i run the command without some or any arguments provided:

start_host

then I get a runtime error:

E 0:00:04.577   callv: Error calling method from 'callv': 'Spatial(Game.cs)::BeginClient': Method not found..
  <C++ Error>   Method failed. Returning: Variant()
  <C++ Source>  core/object.cpp:829 @ callv()
  <Stack Trace> Callback.gd:58 @ call()
                Command.gd:72 @ execute()
                ConsoleLine.gd:112 @ execute()

Add Instancing functionality (e.g. console within a scene)

A console within a computer in our games!

It would be fantastic to implement this console into a screen within our games. For my use case, I'm building a text editor where the player writes code and submits it through this console, so instead of linking the console to the viewport of the player it would be fantastic if we can instance the console into a separate control node and format the console's UI from the individual scene.

Any help on this topic would be highly appreciated, I'll be working on this feature so feel free to reach out.

[Feature Request/Question] Is there a system to print back output on console commands without arguments

So my specific use case is say set_winowed or set_max_fps. Both these commands take arguments of what you are setting the max fps to or if the game should be windowed but in typical game consoles, a lot of times by just putting in set_max_fps without an argument the console will print the current max fps without setting it. Currently because of how the callback system works there doesn't seem like there is a good way to get this functionality but perhaps I am missing an obvious way to achieve this result?

Thanks.

[Resolved, User Error] [Godot 3.4.2, X11 Linux] Plugin cannot be properly loaded after install

### Steps:
1. Install godot-console from AssetLibrary or import from a zip file.
2. Open the Project settings and select "Plugins".
3. Enable quentincaffeino-console
4. Error seen below will print to console.

Error Message:

 Resource: 'res://addons/quentincaffeino/console/src/Console.tscn' is already being loaded. Cyclic reference?
 res://addons/quentincaffeino/console/src/ConsoleLine.gd:34 - Parse Error: The identifier "Console" isn't declared in the current scope.
 modules/gdscript/gdscript.cpp:566 - Method failed. Returning: ERR_PARSE_ERROR

### Project:
I've included the project in question for easy of re-creation. Please note that I have enabled dialogic and scatter in my plugin settings.
Demo.zip

System:

Model: Acer Aspire E5-576 V1.49
Distro: Arch Linux x86_64
Kernel: Linux 5.15.10-arch1-1
Desktop Environment: KDE
CPU: 4 x Intel(R) Core(TM) i3-8130U CPU @ 2.20GHz
GPU: Intel Corporation UHD Graphics 620 (rev 07)
RAM: 5811 MiB
Godot Version: 3.4.2.stable.official.45eaa2daf

Happy to provide any additional information as needed. Would love to use this in my project(s)

Well, that's egg on my face. I attached the Node to a scene (it's been a while since I've used Godot proper) and it works perfectly fine now... ๐Ÿคฆ๐Ÿป

Read the below message, I had the right idea but I hadn't realized that the console was loaded automatically as a singleton. Whoops.

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.