Dice/+check


  • Pitcrew

    Greetings coders. After a fifteen year hiatus I've been plugging away at someone's project with pretty good success.

    Working in: PennMUSH version 1.8.7 patchlevel 0 [08/10/2018]

    My next task is to code a +roll/+check system that will call functions in the +sheet to grab and calculate skills. This part seems manageable but I did have a question about arguments.

    The system in question is 5e based so I anticipate players doing things like:
    +check strength
    +check ranged+1
    +check melee-1

    QUESTION 1:
    Is there a way to code a command so it evaluates the formatting without having to switch everything?

    And what I mean is my knee-jerk is to do: "$+check *:" Then have it look for + and -. Evaluate as appropriate but is there a way to do a command like that is basically: $+check *[maybe +/-][and if one of those *]? To not have to take a single argument apart and re-assemble it?

    QUESTION 2:
    Optimally I'd like to be able to do something more complex like:
    +roll 2d8+5+1d4+2-3

    Where people can roll dice and chain dice rolls and integers together to infinity. Is there an easy way to do that without having to take a huge string and trying to chop it up since there's not a standard delimiter?

    Thanks.


  • Pitcrew

    I am not a coder and have something useful to say but it might be good to specify what codebase you're working on?



  • @Bob You're probably going to want to use regex here, but I'm not slick enough at that to sort out just what your pattern should be without spending more time and energy on it than I have right now, so I'm afraid that's as helpful as I'm going to be right now! 'help regex' should help most places though.


  • Pitcrew

    @Ninjakitten Thanks. I did not even know that was a thing.


  • Pitcrew

    @Roz Good point. Added.



  • My system should work on Penn. I know that @skew converted it to Rhost, but Penn and Mux are much more similar.

    If nothing else, you can see how I did it and extract the basic roller.

    https://github.com/thenomain/GMCCG

    Edit: Oh, did you mean D&D 5e or Vampire 5e?



  • @Bob

    I would also recommend going to MUSH - mush.pennmush.org:4201

    The experts are all there, still actively developing to their hearts content. I'm sure Mike (the guy still developing pennmush) could whip up an @assert liketly split that would allow any undetermined length string of dice math and bonuses. I'm too told to fathom @assert/@break but it sort of makes sense every time they tell me to use that instead of switch.

    If you're unfamiliar, there are other social mu's out there where the folks still developing the codebases still haunt, a few devoted to the specific codebase, but others where you can find the folks in the know-how; Puggy, Brazil, RhostMu Dev, PennMush are the ones I'd look at. This is a great place to ask and share knowledge, but you still get the live answer and can easily ask for more clarification on the mu's.

    ETA: To clean up my failure to proof read, as I always do.


Log in to reply