Non-threaded

Forums » Feature Wishing Well » Read Thread

Suggestions for improvements and additions to the site.
This feature was rejected 8/19/2019: This is a good suggestion but modifying the scripting engine is off the table for now.

Variable Dice Script

5 years ago

Can we set up a means of assigning variables to dice rolls for scripting?  Something along the lines of

%RESULT := [%X]D[%Y]

e.g., if %X = 4 and %Y = 17,  it would make a 4D17 roll.

Variable Dice Script

5 years ago
The only way I know of to do this would be:

IF %X = 1 AND %Y = 1 then %RESULT := 1D1
IF %X = 2 AND %Y = 1 then %RESULT := 2D1
IF %X = 3 AND %Y = 1 then %RESULT := 3D1
IF %X = 4 AND %Y = 1 then %RESULT := 4D1

... (etcetera etcetera)...

IF %X = 4 AND %Y = 15 then %RESULT := 4D15
IF %X = 4 AND %Y = 16 then %RESULT := 4D16
IF %X = 4 AND %Y = 17 then %RESULT := 4D17

.....

It'll work, but there are a few problems with it. It's long and would involve a lot of copy-pasting, especially if you want those variables to go up to rather high numbers. Hopefully someone else has a better solution.

Variable Dice Script

5 years ago

I'll brute force some scripting here and there, but in this case, the set of conditional statements would be far bulkier than just hard coding each instance.  I'm hoping that there is a graceful implementation that can be put in place to alleviate the need for that.  Dynamically changing the values would make a system much more flexible, as well.

e:  Thank you for taking the time to present a workaround.

Variable Dice Script

5 years ago
That is a great suggestion, I'm not sure what it would take to implement...