Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
limbonaut authored Oct 28, 2024
1 parent a977e87 commit 8f43b71
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ This plugin is currently in development, so expect breaking changes.

> 🛈 LimboConsole can be added as a Git submodule
Place the source code in the `res://addons/limbo_console/` directory, and enable this plugin in the project settings, then reload the project. Toggle the console with the `grave accent` key (the key to the left of the `1` key). This can be changed in the Input Map tab in the project settings.
Place the source code in the `res://addons/limbo_console/` directory, and enable this plugin in the project settings, then reload the project. Toggle the console with the `GRAVE ACCENT` key (aka backtick - the key to the left of the `1` key). This can be changed in the Input Map tab in the project settings.

Adding a new command is quite simple:

```gdscript
func _ready() -> void:
LimboConsole.register_command(multiply)
LimboConsole.register_command(multiply)
func multiply(a: float, b: float) -> void:
LimboConsole.info("a * b: " + str(a * b))
LimboConsole.info("a * b: " + str(a * b))
```

The example above adds a command that multiplies two numbers and prints the result (type `multiply 2 4`). Additionally, you can specify a name and a description:
Expand All @@ -45,15 +45,15 @@ Autocompletion works for both command names and history. It can also be implemen
```gdscript
LimboConsole.register_command(teleport, "teleport", "teleport to site on this level")
LimboConsole.add_argument_autocomplete_source("teleport", 1,
func(): return ["entrance", "caves", "boss"]
)
func(): return ["entrance", "caves", "boss"]
)
```
For a dynamically generated list of autocomplete values, the code could look like this:
```gdscript
LimboConsole.add_argument_autocomplete_source("teleport", 1,
func(): return get_tree().get_nodes_in_group("teleportation_site").map(
func(node): return node.name)
)
func(): return get_tree().get_nodes_in_group("teleportation_site").map(
func(node): return node.name)
)
```

### Methods and properties
Expand Down

0 comments on commit 8f43b71

Please sign in to comment.