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
http://www.rolisteam.org/
GNU General Public License v3.0
125 stars 31 forks source link

Macros working only 50% of the time #73

Closed mprangenberg closed 4 years ago

mprangenberg commented 4 years ago

I have several regex-macros with lists on Discord. And last week they worked like a charm. Today they only sometimes give a result and sometimes they just don't do anything. Is there a known issue? Is the bot maybe just overworked?

These are the affected macros: id: 3 Pattern: ([0-9]*)[f,F]ertigkeit Command: " Fertigkeitswürfel: ";\1L[1,2,3,4,5,⚔️] Regexp: True

id: 4 Pattern: ([0-9]*)[w,W]affe Command: " Waffen-/Ausrüstungswürfel: ";\1L[💀,2,3,4,5,⚔️] Regexp: True

id: 5 Pattern: ([0-9]*)[a,A]rtefakt8 Command: " 8-seitiger Artefaktwürfel: ";\1L[1,2,3,4,5,⚔️,⚔️,⚔️⚔️] Regexp: True

id: 6 Pattern: ([0-9]*)[a,A]rtefakt10 Command: " 10-seitiger Artefaktwürfel: ";\1L[1,2,3,4,5,⚔️,⚔️,⚔️⚔️,⚔️⚔️,⚔️⚔️⚔️] Regexp: True

id: 7 Pattern: ([0-9]*)[a,A]rtefakt12 Command: " 12-seitiger Artefaktwürfel: ";\1L[1,2,3,4,5,⚔️,⚔️,⚔️⚔️,⚔️⚔️,⚔️⚔️⚔️,⚔️⚔️⚔️,⚔️⚔️⚔️⚔️] Regexp: True

id: 8 Pattern: ([0-9]*)[a,A]ttribut Command: " Attributswürfel: ";\1L[💀,2,3,4,5,⚔️] Regexp: True

id: 9 Pattern: ([0-9])[b,B]asis(?!) Command: " Basiswürfel: ";\1L[💀,2,3,4,5,⚔️] Regexp: True

SaltatorMortis commented 4 years ago

regex wise i don't see an error.. except a few unnecessary additions ie the [A.a] etc don't need the , to work you could call now with ,rtefact12 or the last command doesn't need the (?!)

SaltatorMortis commented 4 years ago

looks like string ; stringifyed number isn't displayed ie;

i have the feeling that is whats reported here... can you clearyfy it

a working workaround for you is to move the dice to the front ie REMOVED UNTESTED COMMAND editing it back in if its working

EDIT; jeah the command isnt working as intended you cant mix numbers+string use a number lookalike


1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9

here is a testcase for the bug;

!"12-seitiger Artefaktwürfel: ";1L[2,⚔️];"$1;%1;%2;%3;@2" results in: 12-seitiger Artefaktwürfel: ; 2;2;;2; 12-seitiger Artefaktwürfel: ; ⚔️ ; 1;1;;1;

!"12-seitiger Artefaktwurfel: ";1L[2,striiing];"$1;%1;%2;%3;@2" results in: 12-seitiger Artefaktwurfel: ; striiing ; 1;1;;1; 12-seitiger Artefaktwurfel: ; 2;2;;2;

edit added 2 working samples. !1L[5,⚔️]#2-seitiger Artefaktwürfel:

2-seitiger Artefaktwürfel:
> > ⚔️
2-seitiger Artefaktwürfel: 
> > # 5
> > Details:[1L[5,⚔️]# ()]

!"12-seitiger Artefaktwürfel: ";1L[5,⚔️] results in: 12-seitiger Artefaktwürfel: ; 5 12-seitiger Artefaktwürfel: ; ⚔️

mprangenberg commented 4 years ago

Yeah, sorry my regfoo isn't that strong ^^ The Problem is what you described, i'll try using the lookalikes, thanks.

Here's an example of what i meant, just for completeness:

!4basis;3fertigkeit;1waffe;1artefakt12 results in Basiswürfel: ; 5,4,⚔️,3 ; Fertigkeitswürfel: ; Waffen-/Ausrüstungswürfel: ; 12-seitiger Artefaktwürfel: ; ⚔️

SaltatorMortis commented 4 years ago

nah the regfu wasnt that bad :-)

found another string related but by trying: !"string"+"before";$1;$2;$3;"second";$4+"try" before ; string ; second ; try ; second

question @obiwankennedy wouldnt it be more logical to keep the die seperated? d for numbers l for string atm the l die now does not accept the range .. operator and the die don't accept the comma separated values or the repeat [1..x] command this would also reduce the problems that a i;f;c could produce with mixed values

obiwankennedy commented 4 years ago

I changed the behaviour of the L operator in order to make it more generic. You have an issue because you have number and not number in the same list of value. Now number in list result are treated as number result so you can add value (+19) or use other operator. But in your case, it should work with normal value but the emoji break the thing or the opposite, I guess. I will fix it.

mprangenberg commented 4 years ago

Thanks for the help. I've now made it all emojis and it works great.