Improve command discovery and welcome messages

This commit is contained in:
2026-10-19 14:37:24 -04:00
parent e93182cd02
commit a457cbe539
12 changed files with 378 additions and 26 deletions
+30 -8
View File
@@ -85,7 +85,9 @@ and the stock HUD are unaffected. `.hud` requires the HUD module.
Common provides one unboxed upper-right service area below the Plutonium tag.
Records are right aligned: `Map Record | Round N`, every tied holder on its own
line, then a blank row and a separate `Your Best | Round N` heading. The whole
record is shown at once for 12 seconds, with no pages, counter or footer. Help displays
record is shown at once for 12 seconds, with no pages, counter or footer. The
initial `Type .help for commands` hint uses the same private native message
area and style as unknown-command replies. Help displays
the installed command list in pages of nine rows in aligned rows. Services remain private, leave the
core in place and work without the HUD module installed. See the
[shared layout and validation guide](../../README.md#core-hud-and-service-window-t5-and-t6).
@@ -101,15 +103,15 @@ HUD `1.4.2` requires common `1.4.0+` and
`SetTextUnlimited` counter, updated only when the count changes. Deploy the
updated HUD script and restart the map on r5334+; no full server-process
restart is required. Older Plutonium revisions need client/server updates and
full restarts first. Leaderboard `1.3.1` requires common `1.6.1+` for its
full restarts first. Leaderboard `1.4.1` requires common `1.7.0+` for its
personal records and round-start reminders. AFK `2.0.0` requires the matching
plugin `1.4.0+` and EC reserve service; see the [AFK guide](../../docs/afk.md).
## Map record announcements
Copy `tws_t5_leaderboard.gsc` and the updated `tws_t5_common.gsc` to
`storage/t5/scripts/sp/`, then restart the map. Leaderboard `1.3.1` requires
common `1.6.1+`; this script update adds no native-plugin or backend dependency
`storage/t5/scripts/sp/`, then restart the map. Leaderboard `1.4.1` requires
common `1.7.0+`; this script update adds no native-plugin or backend dependency
and requires no full server-process restart. Leaderboard requires a
[t5-gsc-utils](https://github.com/alicealys/t5-gsc-utils) build exposing
`http::request`, `jsonParse`, `typeof` and `formatString`. A plugin upgrade
@@ -150,12 +152,12 @@ explicit row positions so T5 does not concatenate newline-separated text.
| Command | Effect |
|---|---|
| `.help`, `.commands` | List available commands |
| `.help`, `.commands`, `.info`, `.command` | List available commands |
| `.hud` | Hide or show your core HUD (AFK countdown stays visible) |
| `.afk` | Enter protected AFK using your time reserve |
| `.back` | Return from AFK |
| `.join` | Join mid-round (newcomers only) |
| `.leaders` | Show map and personal records (leaderboard module required) |
| `.leaders`, `.record` | Show map and personal records (leaderboard module required) |
| `.b` | Check bank balance (bank module required) |
| `.d <amount\|all>` | Deposit points (bank module required) |
| `.w <amount\|all>` | Withdraw points (bank module required) |
@@ -167,6 +169,15 @@ the order above; additional entries follow registration order. Removing a module
also removes its entries from `.help` after a map restart. Lock and extended AFK
commands appear on additional pages. Bank entries retain the full
`.d <amount|all>` / `.w <amount|all>` syntax. Removing HUD removes `.hud` from the list.
Unknown messages starting with `.` or `!` receive a private
`Unknown command. Type .help for the list` reply. Recognition compares the first
word with installed help registrations, including argument labels, so `.w 2000`
gets no false unknown-command reply. Ordinary chat is unaffected. `.info` and
`.command` alias `.help`; `.record` aliases `.leaders` only with the enabled
leaderboard module. Aliases are case-insensitive exact messages and add no help
rows. Run `node tools/check_commands.mjs` from the repository root.
The enabled leaderboard module registers `.leaders`, which replays the latest
map and personal records privately. Repeating it restarts the full 12-second
announcement; help pauses the record's remaining time and resumes it after the
@@ -260,7 +271,7 @@ connect listener anywhere else crashes the T5 SP handshake.
| `make_core_shader(p, x, y, w, h, c, alpha, sort)` | Retained legacy panel shader with `.hud` visibility |
| `set_core_alpha(p, elem, alpha)` | Preserve the element's intended alpha while applying the player's visibility choice |
| `toggle_core_hud()` | Toggle the player's registered core elements without stopping updates |
| `show_record(snapshot)` | Replace the player's record service request; an undefined snapshot shows unavailable |
| `show_record(snapshot, personal)` | Replace the player's record service request; an undefined snapshot shows unavailable |
| `destroy_on_disconnect(elems)` | Waits on `disconnect`, destroys the array |
| `int_dvar_or(name, fallback)` | Parse an integer dvar with default |
| `format_mmss(elapsed_ms)` | Format milliseconds as `M:SS` |
@@ -274,6 +285,13 @@ connect listener anywhere else crashes the T5 SP handshake.
the requesting player. Check explicit rows, full bank syntax and the absence
of a single-page counter. HP should appear beside the bottom health bar only
while injured.
Also try `.info`, `.INFO` and `.command`; each must open the same private help.
Send `.unknown` and `!unknown`: only the sender sees
`Unknown command. Type .help for the list`. Ordinary chat gets no reply.
With bank enabled, `.w 2000` reaches the bank handler with no unknown reply.
Try `.record` and `.RECORD`: both replay records like `.leaders`, including
while help is open. Disable leaderboard and restart: `.record` and `.leaders`
now get the private unknown reply. Restore the module afterward.
2. Remove AFK or join, restart the map, and verify its entries disappear while
`.help` and the remaining commands still work. Restore the scripts afterward.
3. Verify help closes after 12 seconds. Add custom registered commands to test
@@ -283,7 +301,11 @@ connect listener anywhere else crashes the T5 SP handshake.
4. Reopen after expiry, die/respawn and reconnect; verify no duplicate text or
leftover elements. Repeat without the HUD module. Follow the complete
[HUD validation guide](../../README.md#hud-validation) before rollout.
5. Watch the first automatic record announcement and its dismissal. Repeat
5. Watch the first automatic record announcement and its dismissal. Verify
`Type .help for commands` appears once in the same private message area and
style as the unknown-command reply, after the welcome delay, including when
record data is empty or still loading. It must not appear in the record HUD
or repeat on `.leaders`/`.record` replay or round reminders. Repeat
records, help and interrupted/resumed records alongside stock notifications.
Check that branding, the health bar, damage-only HP, zombie count and timers
remain correct during each view and after it closes.
+36 -1
View File
@@ -157,11 +157,46 @@ help_chat_listener()
continue;
command = toLower(message);
if (command == ".help" || command == ".commands")
if (command == ".help" || command == ".commands" || command == ".info" || command == ".command")
player show_help();
else if (help_unknown_command(command))
player iPrintLn("Unknown command. Type .help for the list");
}
}
// Compare command tokens, not help labels containing argument syntax.
help_first_word(message)
{
words = strTok(toLower(message), " \t\r\n");
if (words.size == 0)
return "";
return words[0];
}
help_unknown_command(message)
{
if (message.size == 0)
return false;
prefix = getSubStr(message, 0, 1);
if (prefix != "." && prefix != "!")
return false;
command = help_first_word(message);
if (command == ".help" || command == ".commands" || command == ".info" || command == ".command")
return false;
if (isDefined(level.tws_help_commands))
{
for (i = 0; i < level.tws_help_commands.size; i++)
{
registered = help_first_word(level.tws_help_commands[i].command);
// The record alias is available when the leaderboard registers itself.
if (command == registered || (command == ".record" && registered == ".leaders"))
return false;
}
}
return true;
}
// A single per-player controller owns service priority, pages and expiry.
show_help()
{
+3 -1
View File
@@ -168,6 +168,8 @@ lb_welcome()
wait 0.25;
wait 5;
self iPrintLn("Type .help for commands");
while (!isDefined(level.tws_lb_cache) && level.tws_lb_attempt == 0)
wait 0.25;
@@ -185,7 +187,7 @@ lb_chat_listener()
level waittill("say", message, player);
if (!isDefined(player) || !isDefined(message))
continue;
if (toLower(message) == ".leaders")
if (toLower(message) == ".leaders" || toLower(message) == ".record")
player thread lb_request(true);
}
}