Commentary System (Chat Areas)
Chat with other players in various locations throughout Hogwarts. Use emotes, color codes, and custom talklines. From whispers in the Shrieking Shack to boasts in Hogwarts Grounds.
What Is the Commentary System?
The Commentary System is HogwartsLive's public chat feature - the magical equivalent of a town square bulletin board crossed with a lively tavern conversation. Each location in the game has its own commentary section where players can post messages, interact socially, roleplay, coordinate activities, or just gossip about who died in the forest most recently. Think of it as location-based chat rooms with personality.
Commentary appears at the bottom of most pages as a scrolling feed of recent messages (typically the last 10-30 comments depending on the area). Each commentary area has its own custom "talkline" - the verb used when you post. In Hogwarts Grounds you "say" things, in the Shrieking Shack you "whisper," in the Hog's Head Inn you might "slur" (depending on how much Butterbeer you've had). The system supports emotes, color codes, moderation tools, and various customization options.
Commentary Locations
Where You Can Chat:
Core Commentary Areas:
- Hogwarts Grounds (village): Main social hub, "says" talkline
- The Hog's Head Inn (inn): Tavern atmosphere, custom talkline
- Land of the Shades (shade): Dead players only, "moans" or similar
- Grassy Field (grassyfield): General area, "says" talkline
- Shrieking Shack (gardens): RP-focused area, "whispers" talkline
- Dumbledore's Army (veterans): Veteran players area, access restricted
- Prefect's Lounge (hunterlodge): Higher-level players, restricted access
- Common Room Waiting Area (waiting): For players seeking to join Houses
- MotD (motd): Message of the Day commentary (no bio links)
- Grotto (superuser): Staff-only area (requires staff permissions)
Module-Added Areas:
- Module Hook: "moderate" hook allows modules to add custom commentary sections
- Custom Talklines: Each area can have unique verbs for posting
- Access Control: Modules can block specific commentary areas based on conditions
How to Post Commentary
Basic Posting:
Standard Messages:
- Text Field: Input box at bottom of commentary section
- Prompt: Varies by location (e.g., "Interject your own commentary?", "Whisper here")
- Submit: Type message and press Submit/Say/Whisper button
- Talkline Format: "[Name] [talkline], \"[message]\""
- Example: "Harry Potter says, \"Hello everyone!\""
- Auto-Formatting: Quotes and talkline automatically added
Color Codes:
- Backtick System: Use ` (backtick) followed by color code letter
- Common Colors: `0 (default), `1 (bold blue), `2 (bold green), `3 (brown), `4 (red), `5 (purple), `6 (orange), `7 (gray), `@ (green), `# (green), `^ (purple), `& (green), `$ (brown), etc.
- Example: "`@Hello`0 `#everyone`0!" = Hello everyone!
- Color Limit: Config::maxcolors prevents spam (excessive color codes stripped)
- Reset Color: Use `0 to return to default color
Emotes (Action Text):
- Prefix with `:` - Single colon for third-person emote
- Example Input: `:waves to everyone`
- Example Output: "`3Harry Potter waves to everyone"
- Double Colon `::` - Alternative emote format (same effect)
- /me Command: "/me waves" also creates emote
- Custom Talkline Override: Emotes skip the area's custom talkline
- Color Coding: Emotes display in brown (`3) by default
Special Commands:
- /game Command: Gamemasters only - system announcements
- Format: "/game [message]" appears as system message
- No.
- Permission Required: SU_IS_GAMEMASTER superuser flag
- Use Case: Server announcements, event notifications, admin messages
Reading Commentary
Commentary Display:
Message Format:
- Player Name: Clickable link to bio.php
- Clan Tag: [Clanshort] tag if player is in a Common Room
- Clan Rank Colors: Different colors for Applicant/Member/Officer/Leader/Founder
- Timestamp: Relative time or date/time stamp
- Message Text: With color codes rendered
- Moderation: Delete link for staff members
Scrolling Through History:
- Default Display: Last 10-30 comments (configurable per area)
- Older Comments: "Older" or "Previous" link to scroll back
- Newer Comments: "Newer" or "Next" link to scroll forward
- Pagination: Scrolls by limit amount (e.g., 10 at a time)
- comscroll Parameter: Tracks current page in URL
- New Comments: System tracks and displays newly added comments
- Caching: Recent comments cached for performance (invalidated on new post)
Bio Links:
- Click Name: Opens player biography in bio.php
- Return Path: Bio includes return link back to commentary
- Disabled Areas: Some areas (like motd.php) don't link bios
- Locked Accounts: Comments from locked (banned) accounts hidden
Posting Rules & Safety
Automatic Protections:
Double Post Prevention:
- Check Last Comment: System compares your new post to last comment in section
- Identical Post: If exact match to your last post, blocked
- Warning Message: "`$`bDouble post?`b`0"
- Different Author OK: Only blocks if YOU posted the identical message
- Bypass: Change even one character to allow posting
- /game Exception: Gamemasters can double-post with /game command
Empty Post Detection:
- Blocks: Empty text, single ":", double "::", solo "/me"
- Warning Message: "`$`bWell, they say silence is a virtue.`b`0"
- Purpose: Prevents accidental blank submissions
- Color-Only: Posts with only color codes (no text) also blocked
Content Sanitization:
- soap() Function: Cleans commentary of malicious content
- Newline Removal: `n codes stripped (comments are single-line)
- Color Limit: Excessive color codes stripped after Config::maxcolors
- Word Breaking: Words longer than 45 characters automatically broken with spaces
- SQL Escaping: mysql_real_escape_string() prevents injection
- Stripslashes: Removes escape characters
Commentary Counter:
- Session Counter: Tracks commentary submissions
- Prevents Spam: Must match expected counter to post
- Refresh Protection: Prevents accidental re-posts on page refresh
- Auto-Increment: Counter increments with each legitimate post
Moderation Features
Staff Tools:
Removing Comments:
- Delete Link: Appears next to comments for staff with SU_EDIT_COMMENTS
- removecomment Parameter: Clicking delete passes commentid
- Archived: Deleted comments moved to moderatedcomments table
- Audit Trail: Stores moderator acctid, moddate, full comment data
- Serialized: Comment row serialized for complete record
- Cache Invalidation: Clears cached comments for section and moderation screen
- Redirect: Returns to returnpath after deletion
System Comments:
- injectsystemcomment(): Function for automated game messages
- No.
- Auto /game Prefix: Adds "/game" if not present
- Use Cases: Server restarts, event announcements, maintenance notices
- Untrackable: No record of who posted (be careful!)
Module Hooks:
- commentary Hook: Modify commentline and commenttalk before posting
- blockcommentarea Hook: Modules can block entire commentary sections
- viewcommentaryheader Hook: Customize header display
- moderate Hook: Add custom commentary sections to the list
Custom Talklines
Area-Specific Verbs:
How Talklines Work:
- Default: "says" for most areas
- Custom Examples: "whispers" (Shrieking Shack), "moans" (Shades), "slurs" (Inn)
- Auto-Wrap: Message wrapped in talkline + quotes: "[Name] [talkline], \"[message]\""
- Emote Override: Starting with `:`, `::`, or `/me` skips talkline
- Translation: Talklines use translate_inline() for multilingual support
- Schema: Can specify translation schema for context
Format Examples:
- Standard (says): "Harry Potter says, \"I'm going to the forest!\""
- Custom (whispers): "Hermione Granger whispers, \"Meet me in the library.\""
- Emote: "Ron Weasley waves to everyone" (no talkline)
- System (/game): "The server will restart in 5 minutes!" (no name)
Technical Details
Behind the Scenes:
Database Structure:
- Table: commentary (commentid, postdate, section, author, comment)
- Joins: LEFT JOIN accounts (for name, clanrank) and clans (for clanshort)
- Filtering: Excludes locked accounts (locked=0)
- Sorting: ORDER BY commentid DESC (newest first) for display
- Limit: Default 10 comments, configurable per area
Caching System:
- Cache Key: "comments-{section}" for recent comments
- Only First Page: com=0 uses db_query_cached(), others use db_query()
- Invalidation: invalidatedatacache() on new post or deletion
- Moderation Cache: "comments-or11" for moderation screen
- Performance: Reduces database load for frequently accessed areas
Scrolling Mechanism:
- comscroll Parameter: Page number in URL (0 = most recent)
- Offset Calculation: (com * limit) determines SQL LIMIT offset
- lastcom Session: Tracks last viewed page for new comment detection
- lastcommentid Session: Tracks last comment ID for continuity
- New Comment Count: Queries for comments > lastcommentid
- cid Parameter: Alternative ID-based scrolling
Clan Rank Colors:
- Array: $clanrankcolors = array("`!", "`#", "`^", "`&", "`$")
- Maps To: CLAN_APPLICANT (red), CLAN_MEMBER (green), CLAN_OFFICER (purple), CLAN_LEADER (green), Founder (brown)
- Display: Colors player names by their Common Room rank
Roleplay vs. Out-of-Character
Commentary Etiquette:
RP-Only Areas:
- Shrieking Shack: Designated roleplay-only, no OOC chat
- Other RP Areas: Godric's Hollow, Chapel, Barnabas Tapestry, Dark Alley
- Fairy Reminder: Gardens (Shrieking Shack) displays fairy message about RP focus
- Enforcement: Staff may delete OOC comments in RP-only areas
OOC-Friendly Areas:
- Hogwarts Grounds: Mixed RP and OOC acceptable
- Inn: Generally OOC-friendly
- Most Areas: Unless specifically marked RP-only, OOC is fine
- Respect Context: If others are RPing, be considerate
OOC Indicators:
- Double Parentheses: ((Like this)) indicates out-of-character
- Square Brackets: [OOC: message] also common
- Convention: Not enforced by code, but community standard
Strategy & Tips
Commentary Mastery
- Check Before Posting: Read recent comments to avoid repeating topics
- Use Emotes: `:waves` more engaging than "says, 'I wave'"
- Color Sparingly: Too many colors = hard to read, plus you hit the limit
- RP in Appropriate Areas: Shrieking Shack for RP, Hogwarts Grounds for OOC
- Click Names for Bios: Learn about players before interacting
- Scroll for Context: Use Older/Newer links to catch up on conversations
- Respect Talklines: Each area has its own flavor - embrace it
- No Double Posts: Even one character difference bypasses check
- Empty Posts: If you hit Submit accidentally, you'll get a snarky message
- Moderation Visible: Staff can see and delete inappropriate comments
- Archived Deletions: Nothing is truly gone - deleted comments saved
- System Messages: /game commands appear as announcements (staff only)
- Activity Updates: Posting updates your laston timestamp
- Clan Tags Visible: Common Room affiliation shows in brackets
- Word Break Feature: Long URLs/words auto-broken to prevent layout issues
- No Newlines: Commentary is single-line - `n codes don't work
- Bio Return Links: Clicking names to bios includes return path
- Cache Timing: New comments appear immediately (cache invalidates)
Common Questions
Commentary FAQ:
Q: Why does it say "Double post?" when my messages are different?
A: The double-post check compares your new message to the LAST comment in the section by ANY author. If you're trying to post "Hello" but someone else just posted "Hello", it'll block you. Change your message slightly to work around this.
Q: How many color codes can I use?
A: Config::maxcolors determines the limit (typically 10-20). Once you hit the limit, all remaining backticks and their color codes are stripped. Use color strategically for emphasis, not for every word.
Q: Can I edit or delete my own comments?
A: No. Once posted, only staff can delete comments. There's no edit feature. Double-check before hitting Submit. If you make a mistake, post a correction or ask a staff member to delete it.
Q: Why don't I see someone's comments?
A: Their account might be locked (banned). The commentary system filters out locked accounts automatically (locked=0 in WHERE clause). You can't see comments from banned players.
Q: What happens if I use /game without being a gamemaster?
A: Nothing. The /game command only works if you have the SU_IS_GAMEMASTER superuser flag. Regular players can type "/game whatever" and it'll just appear as a normal comment: "[Name] says, \"/game whatever\"" - embarrassing but harmless.
Commentary System Summary: Public chat system with location-specific sections. Core areas: Hogwarts Grounds (village), Inn, Shades, Grassy Field, Shrieking Shack (gardens - RP only), Dumbledore's Army (veterans), Prefect's Lounge (hunterlodge), Waiting Area, MotD, Grotto (staff). Custom talklines per area (says/whispers/moans). Emotes: `:` or `/me` prefix. Color codes: backtick + letter (limit enforced). Double-post prevention, empty post detection. Staff can delete (archived to moderatedcomments). /game command for gamemasters (system messages). Scrolling via comscroll parameter, displays 10-30 recent comments. Bio links on names (except motd). Clan tags and rank colors displayed. Caching for performance. Module hooks: commentary, blockcommentarea, moderate. Word breaking for 45+ char strings. SQL sanitization, content cleaned via soap().