MU Soapbox

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Muxify
    • Mustard

    Dice/+check

    MU Code
    5
    7
    460
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      Bob last edited by Bob

      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.

      Ninjakitten 1 Reply Last reply Reply Quote 0
      • Roz
        Roz Banned last edited by

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

        B 1 Reply Last reply Reply Quote 0
        • Ninjakitten
          Ninjakitten @Bob last edited by

          @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.

          B 1 Reply Last reply Reply Quote 0
          • B
            Bob @Ninjakitten last edited by

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

            1 Reply Last reply Reply Quote 0
            • B
              Bob @Roz last edited by

              @Roz Good point. Added.

              1 Reply Last reply Reply Quote 0
              • Thenomain
                Thenomain last edited by Thenomain

                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?

                “If you wish to make an apple pie from scratch, you must first invent the universe.”
                ― Carl Sagan, Cosmos

                1 Reply Last reply Reply Quote 0
                • Lotherio
                  Lotherio last edited by Lotherio

                  @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.

                  I'm just a surge protector doing my job, sir.

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post