docs(protocol): P_ChatMessage detail page (Chr$(250-254) prefix dispatch)#290
Conversation
…tch) Documents the catch-all text-channel packet. The wire payload is free-form text -- discrimination happens via Left$ semantics on C->S (slash/backslash command vs. general chat) and first-byte colour escape on S->C (250 RGB- custom, 251 green, 252 magenta, 253 red, 254 yellow, anything else plain). Catalogues ~25 slash commands with their gates (DM-only vs. open), the chain-walk family per command (FirstOnlinePlayer for /yell//g//gm//pm// allplayers; FirstInZone for /me/general-chat; FirstSlave for /pet; Party array for /p), and the seven validation gates the handler relies on -- most importantly the Account-Null discipline that prevents server crash from a mid-logout DM typing a /command. Captures the privilege classification distinction: slash commands are dispatched directly from the packet handler (Account\IsDM is the only gate; BVM_RequirePrivileged is not in play here), and the /script command is the *only* path from chat that elevates a spawned ThreadScript to privileged=1. Cross-references the FirstOnlinePlayer / FirstSlave / FirstInZone work (PR #287, predecessors of #288), the Object.AreaInstance Null discipline sweep (#154/#155/#176/#182-#188), and the BVM_OUTPUT emitter at ScriptingCommands.bb:2785 -- the sole producer of Chr$(250) custom-RGB lines. Regenerated docs/protocol/index.md so row 16's Detail column now links to the new page. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… help Three doc corrections from the reviewer audit: 1. Chr$(250) is NOT exclusively emitted by BVM_OUTPUT -- the engine also uses it for critical-damage notifications at three sites in GameServer.bb:432/469/507 (one per CombatFormula variant). Updated the colour-escape table row and the "See also" footnote to acknowledge the second emitter. 2. /help line citation `ServerNet.bb:40-108` was wrong. The actual functions live at `:31-60` (SendChatHelp entry) and `:65-109` (SendChatHelpDetail per-topic dispatcher). Both ranges now cited. 3. "every command is localizable" was overstated. /help and /? are hardcoded at ServerNet.bb:680 (`Case "HELP", "?"`) pending an LS_SCHelp localization entry. Doc now calls out the exception. Bonus source bug the reviewer flagged: SendChatHelpDetail at ServerNet.bb:95 described /script as `/script <name>[,<params>]` -- the actual handler at :379-385 splits on comma into Name + Func, so the second arg is a function name, not params. Corrected the in-game help string to `/script <name>,<func> -- run script's function as self`. Compile verified clean across Server/Client/GUE/Project Manager (-t). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3404937cde
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| - **Self-only** notifications (errors, confirmations, `/players` results) — sent to `AI\RNID`. | ||
| - **Area broadcast** (`/me`, general chat) — walks `AInstance\FirstInZone` chain, sends per actor with `RNID > 0`. | ||
| - **Server-wide broadcast** (`/yell`, `/gm`, `/g`) — walks `FirstOnlinePlayer` chain. |
There was a problem hiding this comment.
Correct broadcast scope for /g and /gm
This bullet says /yell, /gm, and /g are all server-wide broadcasts, but in ServerNet.bb the /gm path filters recipients to DM accounts (A\IsDM = True) and /g filters to matching guild/team IDs (A2\TeamID = AI\TeamID). Describing them as server-wide misstates who receives P_ChatMessage and can mislead anyone building tooling or tests from this protocol doc.
Useful? React with 👍 / 👎.
| | `/warp <area>, <x>, <z>` | DM | Server-side warp. | | ||
| | `/warpother <name>, <area>, <x>, <z>` | DM | Warp another player. | |
There was a problem hiding this comment.
Fix /warp and /warpother parameter docs
The command catalog documents coordinate-style syntax (<x>, <z>), but the P_ChatMessage handler actually parses area plus an instance token (Split$(Params$, 2/3, ",")) and then calls SetArea(...) without reading X/Z values in this code path. This mismatch will cause admins/devs to use an unsupported command form and get behavior that ignores the documented coordinates.
Useful? React with 👍 / 👎.
Summary
Fourth per-packet detail page after P_InventoryUpdate, P_StandardUpdate, and P_AttackActor. Documents the catch-all text channel.
P_ChatMessageis the largest single packet handler in the codebase (~530 lines from ServerNet.bb:183 to :712). The wire payload is free-form text; discrimination happens via:Left$(M\MessageData$, 1)=/or\enters the slash-command parser; everything else falls into the general-chat broadcast.Chr$(250)–Chr$(254)) selects render colour; non-escape text falls into the chat-bubble or normal-text path.What's covered
Chr$(250)emitter (BVM_OUTPUT at ScriptingCommands.bb:2785).FirstOnlinePlayerfor/yell//g//gm//pm//allplayers;FirstInZonefor/me/general-chat;FirstSlavefor/pet;Party\Player[0..7]for/p), and their emit-target shape (self-only vs. area-broadcast vs. server-wide vs. party vs. single-target).A.Account = Object.Account(AI\Account) : If A <> Null And A\IsDM = True) that prevents server crash from a mid-logout DM typing a/command. Audit-comment at ServerNet.bb:200-202 is the canonical exemplar.Account\IsDMis the only gate,BVM_RequirePrivilegedis not in play. The/scriptcommand at ServerNet.bb:385 is the only chat path that elevates a spawnedThreadScripttoprivileged=1.AreaInstanceNull guard, unknown-command notify, ignore-list filter on every fan-out.PR history cross-references
/petwalks the per-leaderFirstSlavechain (replacing globalEach ActorInstancescan)./yell//g//gm//pm//allplayerswalk theFirstOnlinePlayerchain.Object.AreaInstanceNull discipline sweep covering/me,/players, and general-chat fallback.Test plan
docs/protocol/index.md— row 16's Detail column now links to the new page (verified)P_AttackActor.md,P_StandardUpdate.md,encoding.md,handler-conventions.md) resolve to existing filesServerNet.bb:200-202,:266-273,:385,:691,:705-710,:1213(ClientNet) — all accurate as of HEAD🤖 Generated with Claude Code