Abandoned Shortcodes for BbCode Substitution

Discussion in 'Support' started by Bloodcinder, Jun 6, 2015.

  1. Bloodcinder

    Bloodcinder Developer

    Likes Received:
    326
    Local Time:
    2:04 AM
    Our d, ds, and df tags are rather cumbersome to use even though the tag names are short. This is a hassle for a GM that has to enter them all the time and robs them of some of the convenience they need. The same thing applies to a lesser extent for note tags.
    Code:
    The arrow hit [ds=Attack Roll]20[/d] but missed the vitals [df=Critical Threat]6[/df] [d=Damage]4[/d].
    After long time planning and a weekend of programming, I've developed a preprocessor that allows me to create so-called shortcodes that get automatically converted into standard BbCodes. The following is what I have set up right now (although keep in mind that this is a proof of concept).
    Code:
    The arrow hit {+Attack Roll:20} but missed the vitals {!Critical Threat:6} {Damage:4}.
    Note that the shortcode syntax {_Option:Content} corresponding to [tag=Option]Content[/tag] in standard BbCode form (with the _ being a possibly-blank symbol corresponding to the appropriate tag) is only one of infinitely many ways it could be done. Virtually any conceivable pattern could work, although the final solution will need to have something representative of each of those parts: an enclosure, something to pick the correct tag, two (possibly more or fewer) pieces of data, and something to separate those pieces.

    Anyway, I've done all the heavy work already, so now I need your feedback, @chefTENGU, on what would be an easy syntax. It just has to be something that doesn't use square brackets and isn't ambiguous. Do you like what I propose, or do you have different ideas? Keep in mind that the syntax is not specifically just for the d, ds, and df tags but could be used for other useful RP-related tags in the future.
     
    Last edited: Jun 19, 2015
  2. Seegtease

    Seegtease Merciful Mage of Many Means Administrator

    Likes Received:
    330
    Local Time:
    11:04 PM
    I suggest you also allow shortening of common terms. Typing "crit" could display the full version, or "att" for attack, or "fort" for "Fortitude save"
     
  3. Bloodcinder

    Bloodcinder Developer

    Likes Received:
    326
    Local Time:
    2:04 AM
    That's a possibility. It would sort of be a second system, on top of the shortcodes, of recognized terms. If a piece of content (like the phrase before the colon) is a recognized term, then it would get substituted; otherwise it would use whatever was entered. Excellent idea.

    It's also possible to devise patterns that don't have a full enclosure as long as they don't have spaces. For example, perhaps !att:3 would expand to [df=Attack]3[/df] with a combination of the recognized term att and the opening ! symbol. For these you have to be careful not to make the symbols too common. It's a similar problem to accidental emoticons.

    By the way, when discussing codes in this thread, keep in mind that you can enclose a piece of code in the plain tag if you don't want the BbCode to be processed (or in the code tag if you also want to show it in a code box). That's how you can talk about BbCodes. For example...

    Code:
    [plain][ds=Attack]5[/ds][/plain]
     
    Last edited: Jun 6, 2015
  4. Seegtease

    Seegtease Merciful Mage of Many Means Administrator

    Likes Received:
    330
    Local Time:
    11:04 PM
    The first rule of BbCodes is that you do not talk about BbCodes.
     
  5. chefTENGU

    chefTENGU Does not approve Administrator

    Likes Received:
    377
    Local Time:
    1:04 AM
    I am intrigued. I hadn't mentioned this yet, but I was actually going to propose a change-up in how I've been using Damage tags in posts once I'm ready to start running things under 5e. I was going to limit myself to posting damage in the more neutral [d] code and reserve the [ds] and [df] I've been using to start illustrating situations in which Damage Resistance/Vulnerability applies.

    This kind of opens up a whole new set of possibilities.
     
  6. Bloodcinder

    Bloodcinder Developer

    Likes Received:
    326
    Local Time:
    2:04 AM
    Yes, although the backbone of all of this is still BbCode, which means appropriate tags for the different ways things are displayed still have to be made. That is, there needs to be a different BbCode tag for every color or format of result. But, yes, with shortcodes they'll be easier to use. For example, you could very easily show when advantage or disadvantage apply with as little as 1 extra symbol.
     
  7. Seegtease

    Seegtease Merciful Mage of Many Means Administrator

    Likes Received:
    330
    Local Time:
    11:04 PM
    Even though I don't DM, I really do like this. It's so simple and I just hate brackets.
     
  8. Bloodcinder

    Bloodcinder Developer

    Likes Received:
    326
    Local Time:
    2:04 AM
    It's like those simple codes we used to use (or at least see) in IRC chats. They usually started with an exclamation point. There are so many better ways to encode information than just the open-close tag system. (Trivial note, now that I see it again I'd probably prefer !atk:3 instead of !att:3.) It's also reasonable to use the # sign as an opener as it is historically the symbol for "hey we need a symbol to use for something new, let's use that."
     
  9. Bloodcinder

    Bloodcinder Developer

    Likes Received:
    326
    Local Time:
    2:04 AM
    By the way, unless you're testing in this thread, do not use the codes I mentioned in the first post. They're not settled yet, so if you use them elsewhere in the RP threads then they'll break as soon as changes are made.
     
  10. Seegtease

    Seegtease Merciful Mage of Many Means Administrator

    Likes Received:
    330
    Local Time:
    11:04 PM
    Well, we need multiple symbols to use different colors for success and failure. I wonder if there could be something intuitive, like > or <, less than for failure, greater than for success.
     
  11. Bloodcinder

    Bloodcinder Developer

    Likes Received:
    326
    Local Time:
    2:04 AM
    Also need to avoid those because they are special symbols in HTML and PHP and pose a problem for processing.
     
  12. Seegtease

    Seegtease Merciful Mage of Many Means Administrator

    Likes Received:
    330
    Local Time:
    11:04 PM
    Maybe. But shouldn't it work since it's looking for an exact string of characters? At least the shorthand ones.
     
  13. Bloodcinder

    Bloodcinder Developer

    Likes Received:
    326
    Local Time:
    2:04 AM
    It would interfere with other parts of the message parsing system. However, the symbols [ ], < >, and & should be the only ones that are completely off limits.

    Another format idea would allow you to specify multiple "bits" of information about a roll. For example, both success/fail/NA and advantage/disadvantage/NA could be done using two symbols. Perhaps +!atk:3 would be an "advantage failure attack roll of 3" and -#fort:4 would be a "disadvantage successful fort save of 4" or something like that, while ~dmg:4 would be "damage of 4" (since omitting both the +/- and the !/# would leave it dmg:4 which has no opening symbol and so the ~ would be the fallback or something like that).

    As long as the pattern either 1) starts with a rare symbol and prohibits spaces or 2) uses enclosure symbols like curly braces, it should work.
     
  14. Seegtease

    Seegtease Merciful Mage of Many Means Administrator

    Likes Received:
    330
    Local Time:
    11:04 PM
    Why did you keep the ! and #? Could it work with simply +atk:3 and -fort:4?
     
  15. chefTENGU

    chefTENGU Does not approve Administrator

    Likes Received:
    377
    Local Time:
    1:04 AM
    I'm actually glad you had mentioned advantage/disadvantage mechanics, because that's another new area of 5th edition that I haven't had to contend with so far in our current coding system. My intention under the present codes was simply to present both rolls and only color the one that ended up being considered.
     
  16. Seegtease

    Seegtease Merciful Mage of Many Means Administrator

    Likes Received:
    330
    Local Time:
    11:04 PM
    Could make a new type of box that has the roll type in black, but allows for two numbers, and colors the higher one green and the lower one red.
     
  17. Bloodcinder

    Bloodcinder Developer

    Likes Received:
    326
    Local Time:
    2:04 AM
    Well (in the format I described) that would only account for the advantage/disadvantage, not the success/failure.

    Not a bad idea, although I'd generalize it where you can provide a list of numbers and indicate which ones to emphasize with formatting, so it's general purpose. For example, like #sc:6,18*,5 would be a successful skill check for which the player got 3 rolls for whatever reason and the 18 was the one that worked Skill Check6 18 5 (which by the way is [ds=Skill Check]6 [u]18[/u] 5[/ds] in the old syntax, which is hideous).

    You could arbitrarily mark whatever things you wanted to, taking care of advantage, disadvantage, and any other scenario with multiple rolls.

    Also valid, given what you have to work with now. Then again, you could do that with the original syntax from earlier too, just by using ~atk:4 #atk:17 right next to each other, or something. But I think the list-with-indicators idea would be easier, whether or not with a syntax similar to what I used up above.

    So the big picture is that we need to determine what we actually need, then figure out a convenient syntax. Here's a list of needs.
    • Honestly, I don't think there's anything wrong with the current d, ds, and df blocks, except maybe they could use some revamped/prettier styling. The idea of success, failure, or neutral should capture pretty much every result/stat you could list in an RP. I mean, it's served us well for years.
    • Then what's needed after that is the quick terms that get replaced with their expanded version (atk becomes Attack Roll or whatever).
    • Then after that we need the ability to consolidate a bunch of rolls into a single block where you can indicate the one(s) that count.
    • Then ...?
    Once we have decided on the above actual needs, we can figure out what kind of patterns and syntax will get the job done. I can then program all the systems to work together for these goals (since I'm going to be making it modular so I can release this stuff on the XenForo add-on store), and then we can actually build up the list of quick terms, which is us-specific and can be edited over time as things come up.

    Also, in order to brand this on the XenForo market so people will actually consider looking at it, I'm going to start calling these "tokens." There's nothing else in the XenForo lexicon that really uses that word, and it's a word typically used to mean something small that is representative of something else.
     
    Last edited: Jun 12, 2015
  18. chefTENGU

    chefTENGU Does not approve Administrator

    Likes Received:
    377
    Local Time:
    1:04 AM
    I could start thinking up a "dictionary" of common terms and corresponding shorthand that we might need. This is reminding me (in a good way) of the way the various niche dice formulae work on rolz. A lot of them can be complex and esoteric, but there's no need to know of them unless they're especially pertinent to the system you happen to be using.
     
  19. Bloodcinder

    Bloodcinder Developer

    Likes Received:
    326
    Local Time:
    2:04 AM
    Yeah, the similarity had crossed my mind. The specific terms will be one of the last steps in the process, though, and they'll be something you can administer directly in the admin panel. For now, we know the need for the terms. It's the other needs that we haven't addressed.
     
  20. Bloodcinder

    Bloodcinder Developer

    Likes Received:
    326
    Local Time:
    2:04 AM
    Now that I've got some experience (from working with the Postbot triggers) of setting up an admin menu to configure lists of things, I'll be able to do that same work with tokens, so that in the admin panel we can set up arbitrary tokens.

    I think, however, that for reasons of efficiency and maintainability we'll need to go with a more generic syntax that might not be the best of all possible ideas but will be uniform and easy to implement. Basically, I'm going to implement it according to what's doable and then we can agree on how to use it within those confines. It's probably going to look like {id option,content,content,content} where id represents which token it is (which BbCode it gets converted to and how) and then there's the tag option and a list of contents separated by spaces.

    That is, to simplify our [ds=Attack]20[/ds] example from before, it would probably be like {+ atk 20} where the + represents that it's to be converted to the ds tag, the atk is an abbreviated term to be converted to Attack, and the 20 is the content that goes inside the tag. Depending on the options I make available for configuring tokens, there could be some slight variations, but that's the general structure. Like, you could use commas instead of spaces if you needed to use phrases with spaces like {+ Fire Damage,5} or keep the spaces and use underscores when you need a literal space like {+ Fire_Damage 5}.

    I'll work it out the best I can and then we'll fit our needs into it. I don't think it will be far off from the original goal.
     
  21. Bloodcinder

    Bloodcinder Developer

    Likes Received:
    326
    Local Time:
    2:04 AM
    Actually, I'm thinking that "shortcodes" would indeed be the better name, as I was originally calling them, because they are a short substitution for BbCode.
     
  22. chefTENGU

    chefTENGU Does not approve Administrator

    Likes Received:
    377
    Local Time:
    1:04 AM
    Shortcodes sounds better to me.
     
    Seegtease and Bloodcinder like this.