I'm making a mod making full use of the custom command system, so I registered a bunch of custom command with a unique prefix to avoid mod incompatibilities: universe-<command>
When I try to autocomplete my commands though, only one is shown at first, universe-make-leader
if I type a little more, this becomes the only option and the auto-completion completes the command.
But it now also recognize the other various commands:
Writing /univ should have auto-completed to the only common prefix left "/universe-" and shown the remaining options instead of auto-completing the whole /universe-make-leader and ignoring the other /universe-<command> options.
Also it should not have matched /unignore or /unmute with the full /universe-make-leader.
also testing /uni does hide correctly /unban and other not matching commands, so there is a problem when matching commands of either, a certain size, containing certain characters("-" maybe ?) or the matching is not left-to-right, which could be problematic.
This happens on any game, the mod I'm writing is only registering custom commands at launch, nothing more, there is no modifications or functionality yet, only commands. There is no variations depending on the order of autocompletion calls on the commands /un, /uni, /univ and /universe-make-leader
To reproduce this, load the following mod and just type /un, /uni, /univ or /universe-make-leader and use tabulation each time to call the autocompletion message
[Rseding91] [0.16.51] Autocompletion is not working properly for multiple commands having the same prefix
-
- Burner Inserter
- Posts: 11
- Joined: Mon May 15, 2017 11:20 pm
- Contact:
[Rseding91] [0.16.51] Autocompletion is not working properly for multiple commands having the same prefix
- Attachments
-
- alone-together_0.0.1.zip
- mod registering the commands
- (45.51 KiB) Downloaded 167 times
-
- factorio-current.log
- logs of my last testing session
- (910.66 KiB) Downloaded 176 times
Re: [0.16.51] Autocompletion is not working properly for multiple commands having the same prefix
Thanks for the report. The problem comes from the fact that every one of your commands uses the same help key which currently is how the game batches aliased commands together (/c and /command being the same thing).
I'll see if there's a more reliable method to say "these group of strings are all the same command". Until then, if you use different help keys it should bypass the problem.
I'll see if there's a more reliable method to say "these group of strings are all the same command". Until then, if you use different help keys it should bypass the problem.
If you want to get ahold of me I'm almost always on Discord.
- TruePikachu
- Filter Inserter
- Posts: 978
- Joined: Sat Apr 09, 2016 8:39 pm
- Contact:
Re: [Rseding91] [0.16.51] Autocompletion is not working properly for multiple commands having the same prefix
Theoretically, in a group of identical commands (sans names), exactly one of them should be the "canonical" version (e.g. out of /c and /command, I'd consider /command to be the canonical version). If the canonical version is referred to by the non-canonical "alias" versions (e.g. by holding a pointer, reference, or name), that should be enough for grouping purposes, even if the field itself isn't used for dispatch purposes.
-
- Burner Inserter
- Posts: 11
- Joined: Mon May 15, 2017 11:20 pm
- Contact:
Re: [Rseding91] [0.16.51] Autocompletion is not working properly for multiple commands having the same prefix
True pikachu is right, just specifying the canonical version when creating aliases should be enough, this way you could even only specify the help string for a specific command once, for the canonical one
Specifying the canonical as
Add_command("canonical name", "help string", function)
and specifying aliases as
add_command_alias( "canonical name", "alias name")
Should be enough
Specifying the canonical as
Add_command("canonical name", "help string", function)
and specifying aliases as
add_command_alias( "canonical name", "alias name")
Should be enough
Re: [Rseding91] [0.16.51] Autocompletion is not working properly for multiple commands having the same prefix
It's now fixed for 0.17.
If you want to get ahold of me I'm almost always on Discord.