New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Chat Commands #1165
Add Chat Commands #1165
Conversation
One thing I noticed when checking this out was that when using the commands from the lobby panel's chat (is this even intended?) there is some strange behavior:
|
Ignore my previous comments, ILocalize was using templates in strange way. I refactored ILocalize's string construction, so it is more flexible and now covers all standard types. Should I make this a PR, or I can give you patch file. |
You can PR into this yeah. |
Are you using it from the main menu while not in a map? Which command are you doing? Is it during a run?
This one's odd. I'll look into this more. |
Regarding the first one: It happens both in the main menu and on a map, it happens with every valid command (for example, writing !abc submits to chat fine, while !b does invoke the concommand (although twice) but doesn't go into the history or chat panel) and being on a run has no effect on the issue. (But only for the drawer's chat panel, the hud chat works fine). |
I have enabled safeguards and they prevent commands from executing, ie when I type |
This is what it looks like to me: https://streamable.com/vibiv9 , I disabled the blur for clarity but to be sure I did a clean build with a fresh checkout, checked GameUI was symlinked properly, but still the same. This can't be OS-dependent, can it? |
In |
@SCell555 @bltech If you have time, try out the latest code and let me know if you're still seeing problems. I think the safeguard case is just because there's no good safeguard warning, though I might just put it inside a ClientPrint instead of a console message... |
Crash is gone now, and commands in lobby chat panel work correctly. The warning in console is kind of annoying when restarting over and over. ClientPrint would be probably better, or print it somewhere where it doesn't stick around. |
Yep, I no longer get double commands and it gets cleared correctly now. |
Microsoft does some funky business with their widechar print functions so yay macros
Same code between server and client
Allows for commands that were using IDs to use partial name matching as well now
Brilliant 2014 code design to have it piggyback off of the Chat panel in the first place
This also allows for using partial string name matches for players in the lobby, and jumping to a new target if already spectating
Allows partial name matching Attempts to spectate player if spectating
Kinda gross hack, not sure why clicking the close button doesn't relinquish the focus already on the drawer and its children
Users will be able to filter out the "X is now spectating" and "X has now respawned" messages with this
Now only updates on update from others when typing, instead of every single frame forever Localized as well!
Saves the last 20 unique messages you input Use up arrow when empty text to start from the most recent message you entered, and to iterate further into history Use down arrow when empty text to start from the least recent message you entered, and to iterate towards the most recent message You can do partial deletes and iteration will still work
Has some nice utility functions like Trim()
Chat messages are validated against a 0.66 sec spam delay both locally and for incoming messages Specspawn ("X is spectating" / "X has respawned") are also on a 0.5 sec spam cooldown as well, and can now be filtered out in the chat as well
And specspawn needs a string, gave it one too
Chat commands are only being added as a more user-friendly and backwards-compatible way to do console commands. It is recommended that end users still do console commands or use the dedicated UI for things, and we will not be adding every command, but most power users may find them useful. A fear I have is that people make "say" binds instead of command binds...
Good catch SCell, only happened when there were public lobbies available to join though so I couldn't reproduce it locally at time of coding this Closes #1167
Allows the menu chat to clear properly; the HUD one was just stopping message mode which automatically clears the input
Escape in the menu closes the menu drawer Do not manually call OnKeyCodeTyped for parent Change OnKeyCodeReleased -> OnKeyCodeTyped for consistency with the rest of the menu overrides
I don't think commands will ever overlap, and the Operate should just early return with a fail message if it fails
Although it uses the same as the !r command, it has a distinct requirement of passing the number of the bonus to go to. Restart still does it too. Also print out a lovely usage command when it fails
Much more visible than the Warning console error message
Controlled by mom_run_safeguard_warning_delay
dfcb083
to
65f244d
Compare
Closes #278
Closes #1067
Closes #1167
Closes 2 cards in 0.8.7 release board
This PR adds initial command parsing and logic in the Chat panel. Chat commands are only being added as a more user-friendly and backwards-compatible way to do console commands. It is recommended that end users still do console commands or use the dedicated UI for things, and we will not be adding every command, but most power users may find them useful. (A fear I have is that people make "say" binds instead of command binds.)
Added:
mom_run_safeguard_warning_delay
that controls how long between warnings that a command is safeguardedAdded the following chat commands:
Note that all command triggers are prefixed with either "/" or "!"
"b", "bonus"
mom_restart <bonus>
(or"!r <bonus>"
)"r", "restart"
mom_restart
"s", "stage"
mom_restart_stage
"setstart"
mom_start_mark_create
"clips", "showclips"
r_drawclipbrushes (0, 1, 2)
(it cycles through these)"triggers", "showtriggers"
showtriggers_toggle
"spec", "spectate"
mom_spectate
"stopspec", "specstop", "spawn", "respawn"
mom_spectate_stop
"goto"
mom_lobby_teleport
Improved:
mom_spectate
mom_spectate beet
will spectate beetle179)mom_lobby_teleport
mom_lobby_teleport beet
will teleport you to beetle179)Checklist
momentum_english_ref.res
file with the changes, rantokenizer.py
to generate an up-to-date localization file, and have committed both the.res
file changes and the new localization.txt
fileserver_momentum.vpc
/client_momentum.vpc
/ etc)