Comments (8)
Exemple for critical strike :
!7+ABS(1D10-1D10)
RESULT : #7, #7 = CRITICAL STRIKE ON #7
!7+ABS(1D10-1D10)
RESULT : #0, #0 = CRITICAL FAIL ON #0
from diceparser.
Hello, I worked on that in order to make it work without abs function but to make it with if.
I finally make it work but I discover a bug about it. I have to deploy this bug fix in order to make the if replacement a working command.
It should work with this:
!1d10;1d10;$1-$2;$3i:[<0]{$3*-1}{$3};$1S[=7]{"Critical Strike"}[=0]{"Critical Fail"}{" "};7+$4;"Result: $5 #$1, #$2 = $6 [details: $4]"
But due to a bug the $3*-1 does not work. I fixed it but it is not deploy yet. It will be done soon. Adding the abs function can be done but function are not manage like that in the diceparser. I have to check that.
from diceparser.
Thanks for your answer.
I may be misreading your expression, but I understand that you output a "critical strike" when diff=0 & roll=7. That's not how critical strike work : any even result except 0 is a critical strike
- if $1=$2=0 then critical fail on #0 (or $1=0 & $3=0, same result)
- else if $1=$2 then critical strike
- else if $1<$2 then normal dice $2-$1
- else normal dice $1-$2
you can also sort it this way if easier to write :
- if $1=$2 (or $3=0, same result)
-- if $1=0 then critical fail
-- else critical strike - else if $1<$2 then normal dice $2-$1
- else normal dice $1-$2
Also the 7 is hardcoded in your expression, while it's an input for me (7 is carac + talent as a base, on which I'll add the dice result). Note we can ignore this input for simplification sake.
from diceparser.
Ok, I found a workaround for your *-1 bug, : just make the substraction the other way instead of negativing the result
Here is my workaround :
!1d10;1d10;$1-$2;$3i:[<0]{$2-$1}{$3};$3S[=0]{$1S[=0]{"CRITICAL FAIL"}{"CRITICAL STRIKE"}}{$3S[<0]{"NEGATIVE STRIKE"}{"POSITIVE STRIKE"}};"Result: $5 #$1, #$2 = $4"
I also added the positive/negative result for damage bonus (negative result make no dmg bonus, while positive make it)
from diceparser.
mfffff, the command work fine, but now I'm unable to add it into a macro.
Here is the command :
!macro add yy !1d10;1d10;$1-$2;$3i:[<0]{$2-$1}{$3};$3S[=0]{$1S[=0]{"CRITICAL FAIL"}{"CRITICAL STRIKE"}}{$3S[<0]{"NEGATIVE STRIKE"}{"POSITIVE STRIKE"}};"Result: $5 #$1 - #$2 = $4" False
The bot acknowledge the command, and I can see it in !macro list, but it doesn't run on !yy (others macro works)
Me : !macro list
DiceParser BOT
id: 0 Pattern: yy Command: !1d10;1d10;$1-$2;$3i:[<0]{$2-$1}{$3};$3S[=0]{$1S[=0]{"CRITICAL FAIL"}{"CRITICAL STRIKE"}}{$3S[<0]{"NEGATIVE STRIKE"}{"POSITIVE STRIKE"}};"Result: $5 #$1 - #$2 = $4" Regexp: False
Me : !yy
(nothing)
from diceparser.
No need of leading !
on the command part (before the 1d10).
This should works:
!macro add yy 1d10;1d10;$1-$2;$3i:[<0]{$2-$1}{$3};$3S[=0]{$1S[=0]{"CRITICAL FAIL"}{"CRITICAL STRIKE"}}{$3S[<0]{"NEGATIVE STRIKE"}{"POSITIVE STRIKE"}};"Result: $5 #$1 - #$2 = $4" False
from diceparser.
Hi @obiwankennedy I'm sorry to revive this thread but I didn't try the macro earlier.
I don't see any error in the macro, but I got this error messages : Error: No value fits the Switch/Case operator
Supposedly when getting dice1 == dice2
I have decomposed/documented the macro and really didn't see any switch error :
!macro add yy
1d10; //1 YIN dice
1d10; //2 YANG dice
$1-$2; //3 DIFF
$3i:[<0]{$2-$1}{$3}; //4: always positive diff
$3S[=0]{ //5: if diff is 0, it's a critital
$1S[=0]{"CRITICAL FAIL"}{"CRITICAL STRIKE"} // if YIN(&YANG) equals 0 then it's a crit fail. else crit are successes
}
{$3S[<0]{"NEGATIVE STRIKE"}{"POSITIVE STRIKE"}}; //5 : else if diff is inf to 0, there will be no damage bonus. Else a positive YIN-YANG will give bonus damage
"Result: $5 #$1 - #$2 = $4" False // echo TEXT, YIN - YANG = POSITIVEDIFF
from diceparser.
I believe this is the issue: $1S[=0]{"CRITICAL FAIL"}{"CRITICAL STRIKE"}
I don't get why using $1 = 0 it can't be. As $1 refers to the result of 1d10.
Perhaps it is recommended to defined a condition for the other part.
from diceparser.
Related Issues (20)
- Macros activated from comment (#) and sentence display ("") HOT 1
- Exploding Doubles HOT 1
- No valid value at index HOT 5
- Question re: Syntax for an IF statement based on an Entered Number and a Dice Roll. HOT 2
- Bot stopped working with Discord's latest version HOT 6
- Prefix not working HOT 3
- All dice prefix commands not working HOT 3
- Diceparser not working with webhook
- DiceParser not working September 2022 HOT 1
- /r works but ! does not HOT 5
- Help Noob please! Bot Setup steps for RPG HOT 2
- Weird handling of numbers in lists
- Bot frequently does not respond
- Bot Not Responding In Any Server
- bot does not allow users below the rank of admin to roll HOT 3
- Broken example in HelpMe.md HOT 1
- List weight doesn't seem to work
- Dice Parse offline? HOT 2
- Ambiguous licensing HOT 1
- Discord bot privacy information
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diceparser.