Code Monkey home page Code Monkey logo

Comments (4)

obiwankennedy avatar obiwankennedy commented on May 24, 2024

I will say it is normal but diceparser should display warning when you run this kind of command.

The C operator computes how many dice fit the condition. It is useless on scalar number.

The main issue with this command is that !d20+3 as for final result a number, when "!d20" has a dice result array as final result.

!d20c[>0]+3 works.
I don't know what you want to do but I think the If operator may help you. As It can compare any kind of result.

from diceparser.

vcrini avatar vcrini commented on May 24, 2024

Hi obiwankennedy thanks for your answer that helped me to sourt out the problem!
I'd like to explain what I'm trying to obtain:
I used (wrongly) this form because my goal is to 'script' on a single roll a hit to roll and if enemy is hit to roll the damage.
This what I was trying to do:

!d20+3c[>11]; d10+3; $2*$3; "damage inflicted is: $4"

this should ouput 0 if enemy is missed (it has AC 12) otherwise d10+3 damage is displayed.

I could use the

!d20c[>8]+3

but is not optimal because I've to recalculate condition to be hit (from >11 to >8).

Maybe I'm doing in the wrong way there is a more convenient way to obtain this?

from diceparser.

obiwankennedy avatar obiwankennedy commented on May 24, 2024

The command you want to do is this:

!1d20+3;$1i:[>11]{1d10+3}{0};"inflicted damage: $2 details:[%2]"

First instruction, I roll the dice and add 3.
Second instruction, I compare the result of the first instruction to 11 and if it is greater I roll damage (1d10+3) or return 0 otherwise.
Then, I finally print out the result.

Be careful, that the default parameter of 1 in d10 does not work inside if instruction.
So, it is important to write {1d10+3}; because {d10+3} won't work.

from diceparser.

vcrini avatar vcrini commented on May 24, 2024

Thanks a lot for the solution!

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.