Giter VIP home page Giter VIP logo

Comments (6)

obiwankennedy avatar obiwankennedy commented on August 19, 2024

Sorry for the late answer.
It's easy to do that using macro.
You need to define something like that ( I'm assuming that the number of dice (1), the face count (d20) and the threshold (11) don't change at all).

Define this macro

!macro foo,([\s\w]+) 1d20i:[<11]{"\1 :|: Success: %1"}{"\1 :|: Fail: %1"} 1

Call it :

foo,Slough Perception (SV 10 + PER) Roll

The executed command:

1d20i:[<11]{"Slough Perception (SV 10 + PER) Roll :|: Success: %1"}{"Slough Perception (SV 10 + PER) Roll :|: Fail: %1"}

(be careful, with empty comment, it will not roll, as it will not match the macro)

from diceparser.

JoeGans avatar JoeGans commented on August 19, 2024

Brilliant, thanks oBi!!!

.... buttttt, it gives the following error with the () or [] brackets ...

Warning: Unexpected character at 78 - end of command was ignored "[SV10]"
Warning: Unexpected character at 78 - end of command was ignored "(SV10)"

Have you noticed that in other macro's, and is there a way round defined characters?

Thanks for all your effort! Walts.

from diceparser.

obiwankennedy avatar obiwankennedy commented on August 19, 2024

It is just because [\s\w]+ accept only letter and space, but adding (,),[,],+ should do the job

!macro foo,([\w\s\d\(\)\[\]\+\-]+) 1d20i:[<11]{"\1 :|: Success: %1"}{"\1 :|: Fail: %1"} 1

from diceparser.

JoeGans avatar JoeGans commented on August 19, 2024

Works a treat, thanks oBi!

Can i ask where the documentation is for macro building/ref? Give me something to play on
within our channels! ... Thanks, Walts

from diceparser.

obiwankennedy avatar obiwankennedy commented on August 19, 2024

It depends what you mean about documentation for macro.

There are three involved mechanisms, here:

  1. Add/Roll/Remove macro -> the bot's documentation
  2. Write macro command -> the bot's documentation
  3. Write macro pattern -> simple replacement or regular expression

If you want documentation about regular expression, take a look on perl regular expression.

from diceparser.

JoeGans avatar JoeGans commented on August 19, 2024

Thanks oBi, the Perl link is what I was looking for!

thanks for all your help, Walts

from diceparser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.