Code Monkey home page Code Monkey logo

Comments (6)

obiwankennedy avatar obiwankennedy commented on May 24, 2024

You can easily manage this 20th anniversary WoD but you need another approach.
I write down in multi line format with comment for better understanding.

4d10; # roll dice
$1c10; # count 10s
$1c1; # count 1s
$1c[>=6&<10]; # count success but does not count 10s
$2-$3; # substract the 1s count to 10s count
$5i:[>0]{$5}{0}; # useful if 1s take away only 10s
$6+$6+$4; # sum twice the 10s rest and the successes count.
$7i:[>0]{"$7 Successes [%2]"}{"You fail [%2]"} # display

so now in one line:

!4d10;$1c10;$1c1;$1c[>=6&<10];$2-$3;$5i:[>0]{$5}{0};$6+$6+$4;$7i:[>0]{"$7 Successes [%2]"}{"You fail [%2]"}

then you may want to make macro:

!macro ([0-9]+)w([0-9]+) \1d10;$1c10;$1c1;$1c[>=\2&<10];$2-$3;$5i:[>0]{$5}{0};$6+$6+$4;$7i:[>0]{"$7 Successes [%2]"}{"You fail [%2]"} 1

To call it:
!4w6
First parameter is the number of dice, the second is the difficulty.

from diceparser.

lekyryu avatar lekyryu commented on May 24, 2024

I think it isn't activating the $-2-$3 part as it's not taking away successes with ones

Iker LarreaToday at 6:44 AM
!4d10;$1c10;$1c1;$1c[>=6&<10];$2-$3;$5i:[>0]{$5}{0};$6+$6+$4;$7i:[>0]{"$7 Successes [%2]"}{"You fail [%2]"}
TroileBOTToday at 6:44 AM
2 Successes [9,5,1,9]

Edit: Further testing lands me this as well
!4d10;$1c10;$1c1;$1c[>=6&<10];$2-$3;$5i:[>0]{$5}{0};$6+$6+$4;$7i:[>0]{"$7 Successes [%2]"}{"You fail [%2]"}
DiceParserBOTToday at 10:05 AM

1 Successes [7,1,10,1]

Where it calculated 3 successes (one for the 7 and two for the 10), removed two for each 1, when it should have showed 0 successes by removing both the 7 and 10 before counting the 10 for two.

Edit 2: I've been working on this some more but it seems the real issue is that you can't activate an IF on a $X besides $1. Every other number it causes the command to be ignored. Also there doesn't seem to exist an & or AND command

Edit 3: I'm in a rabbit hole now. The IFs statement do work on $X and the & command does exist. What doesn't seem to work is an if statement that compares two previous results.
IE $3i:[>0&$4>0]

from diceparser.

obiwankennedy avatar obiwankennedy commented on May 24, 2024

yes, if only compare value in front of him.

I did not try my examples, I just make them as i would do it. But your second example, is normal because I was not sure 1s remove only 10s or 10s first and then normal successes.
I have to fix the command to manage that. Are there any other rules I should know about ?

from diceparser.

obiwankennedy avatar obiwankennedy commented on May 24, 2024

!4d10;$1c10;$1c1;$1c[>=6&<10];$2-$3;$5i:[>0]{$5}{0};$6+$6+$4;$7i:[>0]{"$7 Successes [%2][$1,$2,$3,$4,$5,$6,$7]"}{"You fail [%2][$1,$2,$3,$4,$5,$6,$7]"}

1 Successes [5,3,8,3][19,0,0,1,0,0,1

This example is correct, right ?

from diceparser.

obiwankennedy avatar obiwankennedy commented on May 24, 2024

2 Successes [8,5,1,8][22,0,1,2,-1,0,2]

This example is wrong given your rules.
Let's fix it.

from diceparser.

obiwankennedy avatar obiwankennedy commented on May 24, 2024

!4d10;$1c10;$1c1;$1c[>=6&<10];$2-$3;$5i:[>0]{$5+$5}{$5};$6+$4;$7i:[>0]{"$7 Successes [%2][$1,$2,$3,$4,$5,$6,$7]"}{"You fail [%2]"}

(I fixed the command)

1 Successes [1,8,10,3] -- Inner result [22,1,1,1,0,0,1]

it seems correct to me.

4 Successes [5,8,7,10] -- Inner result [30,1,0,2,1,2,4]

Right ?

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.