DICE PACKS BUNDLE
  1. #1

    Slash handlers in table extension

    A proof of concept for improving the utility of the slash command. By replacing the onSlashCommand function with one that draws from a table, ruleset and extension creators can easily add their new commands to the list.

    I'd be happy if this made its way directly into the CoreRPG ruleset, but this can also be implemented in individual rulesets.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    I've moved this to its own thread so that questions can be asked etc..

    Interesting concept. Could you please provide info on how it works, what benefits it has over the current slash handlers, etc.. Thanks.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    1. It overrides the ChatManager.onSlashCommand() function.
    2. It creates a hashtable, GameSystem.slashcommands, which stores info on all of the commands available.
    3. It demonstrates how to add new items to GameSystem.slashcommands from a ruleset or extension, and how to add a basic new command.

    In the CoreRPG (original) version of onSlashCommand(), the list of slash-commands that get shown when a user types '/?' is hardcoded, and cannot be easily added to. There's a list of host-only commands, and a list that are available to all users.

    In ImprovedSlashCommand.ext, the list is moved out of the function into a hashtable. I chose a hashtable instead of an array because it allows developers to look up and override an individual key. If, for instance, a ruleset or extension registers '/table' to roll on a table, and '/roll' to roll dice the same way '/die' does, they could replace the '/?' listing for '/roll' simply by using

    GameSystem.slashcommands["roll"] = {GMonly=false, message="/roll [NdN+N] <message>"}

    (That's my preference, since /roll intuitively makes more sense and has been the convention since IRC was a thing.)

    (Edit: /roll currently does not appear in the list, which is part of the reason I chose it; it should be added at some point, so I took the opportunity to slide that in here. It's so very minor, but since I've already broached the general topic...)

    GMonly sets whether the command is only available to the GM, or should be shown to the players. message is the text content you wish to add to what is output when a user types /?
    Last edited by kavaliro; June 30th, 2016 at 16:19.

  4. #4
    This also would pave the way for /? <command> functionality. A
    verbose = "longer, more in-depth explanation"
    key could be added to an entry in GameSystem.slashcommands. Then the slash interpreter would look for a match from the table, preferring the verbose entry but falling back on the message entry, and if the key is not present, displaying the normal list of commands.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
STAR TREK 2d20

Log in

Log in