Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Creating a dice roller

Featured Replies

Hi,

I am trying to make a dice roller, but have had no luck in working out how.

I need to be able to roll any number of dice.

I need to be able to choose the size of the dice - 4, 6, 8, 10, 12, 20

I need to be able to modify the dice rolls - remove lowest; remove 2 lowest, remove highest & lowest, or no modify.

Can anyone help me??

(i found one post using a recursion? but i didn't understand it.)

Thanks in advance

Sure thing.

Here is your roller, It inputs the results into a single Return Delimeted field. They results should be easy to minuplate like that. Two pull down menu's let you choose the # of dice to roll, and the # of sides each dice has.

DiceRoller.zip

  • Author

Ok... this is good...

But how would i go about the last part of my question?

How do i say, remove the lowest number from the result? And how would i add them up?

Use a script, create a variable, or use the current one, dump the first line into it. If its < the 2nd line, leave it there. Loop that as many times as you have dice. and it will give you the lowest number, remove or sub that from the results field. If you want to remove the lowest two, loop it twice. I'm sure there is a way to do this with a recursive function, but at the moment its beyond me how you would remove it.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.