Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No valid value at index #144

Closed
PXL-C opened this issue Apr 28, 2022 · 5 comments
Closed

No valid value at index #144

PXL-C opened this issue Apr 28, 2022 · 5 comments

Comments

@PXL-C
Copy link

PXL-C commented Apr 28, 2022

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

@obiwankennedy
Copy link
Member

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

@PXL-C
Copy link
Author

PXL-C commented Apr 28, 2022

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

@obiwankennedy
Copy link
Member

!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

@PXL-C
Copy link
Author

PXL-C commented May 2, 2022

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.

@obiwankennedy
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants