Rolisteam / DiceParser

Powerful dice Roller is used as discord bot, irc bot, cli tool and inside Rolisteam : 1d20+4, 1L[head,arm,leg,belly,chest], 1d6+1d8, 8+5*3

Home Page:http://www.rolisteam.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No valid value at index

PXL-C opened this issue · comments

commented

Hello,

I want to make a Discord diceParser macro for an RPG (Les héritiers).
Here is the D10 rolling dice macro:
!macro add ([0-99]+)p([0-99]+) "1d10+\1;$1i:[=1]{$1=-3}{$1};\2+7;\2-7;$1i:[>=$3]{"Critical success $2"}{i[>=\2]{"Success $2"}{i[<$4]{"Critical fail $2"}{"Fail $2"}}}" True
It return:

No valid value at index: $3

Could you help me to find how to resolve this issue, pls ?
The $3 and $4 syntaxes seem to be wrong but I can't find the right way.

Thx in advance

Hello, I didn't test anything but by looking at your command, you aren't using the same compare method in your ifs. The first one is a i:[>=$2] (on final value of $1) where the others are comparing the threshold with each dice value

commented

Thx for your answer.
Unfortunately, the error seems to be yet there. :'(
!macro add ([0-99]+)p([0-99]+) "1d10+\1;$1i:[=1]{-3}{$1};\2;\2+7;\2-7;$1i:[>=$4]{\"Critical success $2\"}{i[>=$3]{\"Success $2\"}{i[<$5]{\"Critical fail $2\"}{\"Fail $2\"}}}" True

Warning: Unexpected character at 50 - end of command was ignored "Critical success $2"}{i[>=$3]{"Success $2"}{i[<$5]{"Critical fail $2"}{"Fail $2"}}}""

No valid value at index: $4

!macro add ([0-99]+)p([0-99]+) 1d10+\1;$1i:[=1]{-3}{$1};\2;\2+7;\2-7;$1i:[>=$4]{"Critical success $2"}{i:[>=$3]{"Success $2"}{i:[<$5]{"Critical fail $2"}{"Fail $2"}}} True

It is better to use the Switch operator instead of ifs. See the documentation: https://invent.kde.org/rolisteam/rolisteam-diceparser/-/blob/master/HelpMe.md#switch-case-s

commented

Hello Obiwan & folks,

So, I tried the Switch/Case operator in many ways without successful full results.
Here is the last macro used:
!macro add ([0-9]+)a([0-9]+) \1;1d[-3..10]R[=-2|=-1|=0|=1];$1+$2;\2;$4+7;$4-7;$3S[>=$5]{"Critical success $3"}[>=$4]{"Success $3"}[<=$6]{"Critical fail $3"}[<$4]{"Fail $3"} true
I don't found how to have a successful macro with the following constraints:

The "\1" is the attribute + skill value
The "\2" is the value to success
Critical success with margin of success at 7+
Critical fail with margin of faillure at 7-
We roll 1d10 which has the "1" face replaced by a "-3" face

Could I have any help to find what I missed, pls?
Thx in advance.

The command is fine, There was some forgotten code on the Switch/case operator side. I just implemented it. It will be deploy soon.