Easy menu-driven reporting for TF2Center lobbies. Type !r to start
version 1.05 by naknak
This plugin corrects common mistakes and omissions when reporting players in a TF2Center lobby. Unambiguous reports are corrected and sent right away.
Incomplete reports trigger menus to extract the missing information.
The plugin deactivates when no lobby is running (indicated by match-start and match-end announcements from TF2Center; you may also tie actions and announcements to these events).
You can make reports like you always have, and let the plugin correct typos for you. You can say RED or BLU instead of our and their. You can abbreviate reports to a ridiculous degree. Any unambiguous abbreviation will work! Ambiguous abbreviations will also work (with menus)!
Regular use that is not so different from what you are used to
- !rep our soldier works just like it always did.
- !rep red solly does too. RED and BLU are translated to our and their on the fly.
Abbreviated use that will save you precious keystrokes
- !r o h reports our heavy.
- !r r r reports the red roamer in a 6v6 game. In Highlander, where there is no "r" class, you get a menu to pick which red class you meant.
- !r t p reports their pocket in 6v6, or pyro in Highlander/4v4.
- !r b sn or !r b snip or !re bl snipe all report the blu sniper. The classes starting with S need (at least) two letters, or you'll see a menu asking what you meant.
Lazy use that will show you a menu or two
- !r demo or just !r d will open a menu to ask which team you meant. !r their (or !r t) will open a menu to ask which class you meant.
- !r red will open a class selection menu.
- !r will open two menus, one to pick a team and one to pick a class.
Insane Extreme Abbreviation
- !rrsp will rep the red spy!
- !rohe will rep the enemy heavy! Insane Extreme Abbreviation always needs two characters for the class.
- !r oen ohe will rep our engy and heavy! Spaces are not so insane but you may use them!
- !rrscosotdebsn will rep the red scout (translating to our/their Scout depending on your current team), your ("our") soldier, the enemy demoman, and the blu sniper (again, translating to our/their automatically).
The plugin switches to 6v6 reporting style (!rep our roamer) automatically, using either the lobby announcement from TF2Center or the count of connected players.
Just drop ezrep.smx into your plugins folder (typically
tf/addons/sourcemod/plugins). Activate by restarting your server, or with
rcon sm plugins load ezrep.
If you'd prefer to compile it yourself, get the source. You can compile it with
spcomp (in the scripting directory of the SourceMod distribution), or with SourceMod's online compiler.
Ezrep was developed and tested with SourceMod version 1.5.3. Limited testing with v.1.5.2 found no problems. You should not use a version older than 1.5.2 because of bad stats.
No configuration is necessary. These cvars are available:
Event Hooks: On Lobby Launch
- ezrep_launch_announce is a message sent to all connected players soon after the lobby launches. The default is a help message for ezrep. You can use color codes in this text:
ezrep_launch_announce_delay is the time, in seconds, between launch and announcement. If too small, no one will be connected yet to see it! Default is 120 (2 minutes). 0 disables the announcement.
ezrep_launch_action is a server command to run on lobby launch. Default is
- ezrep_launch_action_delay is the time, in seconds, between lobby launch and invocation of ezrep_launch_action. Default 10. 0 disables the action.
Event Hooks: On Lobby Close
- ezrep_close_announce is a message to broadcast upon completion (or leader abortion) of the lobby. No default. Color codes work here too.
ezrep_close_announce_delay is time, in seconds, between lobby closure and the closing announcement. Unlike the announce delay, this value should be small if anyone is to see it. It should be large enough to allow the scoreboard to close. Default is 10 seconds. 0 disables the announcement.
ezrep_close_action is a server command to run on lobby close. No default. Useful possibilities include:
- any or all of the above, using
exec + a .cfg file you create
- ezrep_close_action_delay time, in seconds, before invocation of ezrep_close_action. Default 120. 0 disables.
- ezrep_always if 1, !rep correction and menus are always active. If 0, correction is (de)activated by lobby start/end messages from TF2Center. The action and announce hooks are always active, regardless of this setting. Default 0.
- ezrep_debug if 1, debugging info will appear on the console and in response to any chat. Default 0.
- ezrep_gametype decides the default reporting mode and is set on lobby launch, to 1 for 6v6 or 0 otherwise. Outside of a lobby, it's set to 9 (player counts determine the gamemode, if ezrep_always is on).
- ezrep_inlobby decides whether plugin is active. Is set on lobby launch, 0 on lobby close. If ezrep_always is nonzero, this value has no effect.
Everything Else: Troubleshooting, Limitations, To Do, Build Notes
If something doesn't work like you expect, please set convar
ezrep_debug 1 and send me the relevant parts of your server log.
It is not possible to include player names in the menus (accurately). TF2Center limits access to the lobby webpage when it launches, so this information is just not available to anyone except the players. Sorry. For the same reason, things like rep myself or rep last_guy_disconnected can't work. If TF2C ever exposes an API, I will include player names in the menus.
Some have suggested getting player names from in-game class roles: this will never happen. One team's composition is not supposed to be visible to the other team, and UGC has strict rules about what happens when a plugin affects gameplay (home team forfeits). Because I don't want accidental use of the plugin to cause problems for a server owner, the plugin will never make use of secret information.
Ditto reps (!r" or !r') to repeat the last rep would be nice.
The scanner is a large regular expression generated by Perl embedded in the .sp source. If you want to modify (or steal!) the grammar, read the comments in the source to see how to regenerate it.
version 1.05 2014-06-07
- bugfix !log etc. were masked by over-eager matching
version 1.04 2014-06-06
- bugfix all chats were made colorless by PrintToChatAll();
version 1.03 2014-06-05
say can create up to 4 reps
- added support for Insane Extreme Abbreviation
- say "our"/"their" instead of "red"/"blu"; if sayer is on a team then red/blu are aliases for our/their
- removed ability to select different gamemode through menus (too confusing and no clear benefit)
- lots more debugging output, when it's enabled
- scanner overhauled, is now a set of large auto-generated regexes. This allows complex parsing like distinguishing !r the (Their HEavy) from !r the eng (THEir ENGineer)
- plugin performs unit tests and benchmark at startup if ezrep_debug is on.
- extensive debugging added everywhere
- default to active on plugin load, regardless of ezrep_always setting, in case plugin is loaded mid-lobby (deactivates on map change or lobby end).
- flood protection in menu create (400 menus/sec globally) and chat (50 chats/sec/player) as a backstop against infinite loops or weird DOS exploits I didn't think of
version 1.02 2014-05-27
- more cvars: debug, gametype, inlobby
- 1/3 reduction in memory footprint (now 40KB) through string size adjustment
- bugfix "!rep red scout" was considered valid in 6v6 (isn't): remove IncrTokens and giant Tokenizer regex, use piecewise tokenization that can consume multiple words, repurpose the UNDEF regex to consume a token on match
- setting the action or announce cvars to empty will skip that thing instead of acting on an empty string
- doco update: images and stuff
- ezrep_always defaults to 0
- ezrep_close_action and close_announce default to nothing
version 1.01 2014-05-26
- added color codes to announce messages, e.g.
^1 this is normal ^3 this is green
- fixed some off-by-one errors in string length
- renamed cvars ("sm" prefix is for sourcemod core)
version 1.0 2014-05-25