dice

Privateunrated

Content

32 lines
{=(comment):Change displayrolls to 1 to show the dice roll breakdown at the end (the total is always shown). Change to 0 to hide.}
{=(displayrolls):1}

{=(comment):Set prefix and tagname here to change error statement output}
{=(prefix):!}
{=(tagname):dice}

{=(largs):{join( ):{replace(+, +):{replace(-, -):{lower:{args}}}}}}
{=(la1):{largs(1)}}
{=(t):{la1(1):d}}
{=(s):{la1(2):d}}
{=(a):{replace(+,):{largs(2)}}}
{=(n):range:1-{s}}

{=(numt):{if({t}=={m:trunc({t}/1)}):{t}|0}}
{=(nums):{if({s}=={m:trunc({s}/1)}):{s}|0}}
{=(numa):{if({a}=={m:trunc({a}/1)}):{a}|{if({a}=={m:{a}/1}):{a}|0}}}

{=(error):Syntax is `{prefix}{tagname} 2d6 -3`.$Roll no more than 20 dice}
{break({numt}<1):{error(1):$}}
{break({nums}<1):{error(1):$}}
{break({numt}>20):{error(2):$}}

{=(dice):{{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}}}

{=(result):{m:{join(+):{dice(+{t})}}+{numa}}}
{=(comment):The following line checks to see if the truncated result is equal in value to the result. If it is it truncates it.} 
{=(comment): == checks for identical strings, but if result is 24.0 and truncated result is 24, it would return not equal. The method below compares value}
{=(tr):{m:trunc({result})}}
{=(result):{all({result}>={tr}|{result}<={tr}):{tr}|{result}}}
{user} rolls {t}d{s}{if({numa}!=0): {if({a}>0):+}{a}}:{if({displayrolls}==1):
`[{join(+):{dice(+{t})}}{if({numa}!=0):+({numa})}]`= }**{result}**
Raw JSON
{
  "id": 704733,
  "created_at": "2021-03-25T22:46:43.000Z",
  "tag_name": "dice",
  "nsfw": false,
  "owner_id": "329028412632989697",
  "uses": 11,
  "description": null,
  "restricted": false,
  "shared": false,
  "deleted": false,
  "safe": "unrated",
  "hidden": false,
  "guild_id": "793215364095541260",
  "sharer": "329028412632989697",
  "content": "{=(comment):Change displayrolls to 1 to show the dice roll breakdown at the end (the total is always shown). Change to 0 to hide.}\n{=(displayrolls):1}\n\n{=(comment):Set prefix and tagname here to change error statement output}\n{=(prefix):!}\n{=(tagname):dice}\n\n{=(largs):{join( ):{replace(+, +):{replace(-, -):{lower:{args}}}}}}\n{=(la1):{largs(1)}}\n{=(t):{la1(1):d}}\n{=(s):{la1(2):d}}\n{=(a):{replace(+,):{largs(2)}}}\n{=(n):range:1-{s}}\n\n{=(numt):{if({t}=={m:trunc({t}/1)}):{t}|0}}\n{=(nums):{if({s}=={m:trunc({s}/1)}):{s}|0}}\n{=(numa):{if({a}=={m:trunc({a}/1)}):{a}|{if({a}=={m:{a}/1}):{a}|0}}}\n\n{=(error):Syntax is `{prefix}{tagname} 2d6 -3`.$Roll no more than 20 dice}\n{break({numt}<1):{error(1):$}}\n{break({nums}<1):{error(1):$}}\n{break({numt}>20):{error(2):$}}\n\n{=(dice):{{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}} {{n}}}\n\n{=(result):{m:{join(+):{dice(+{t})}}+{numa}}}\n{=(comment):The following line checks to see if the truncated result is equal in value to the result. If it is it truncates it.} \n{=(comment): == checks for identical strings, but if result is 24.0 and truncated result is 24, it would return not equal. The method below compares value}\n{=(tr):{m:trunc({result})}}\n{=(result):{all({result}>={tr}|{result}<={tr}):{tr}|{result}}}\n{user} rolls {t}d{s}{if({numa}!=0): {if({a}>0):+}{a}}:{if({displayrolls}==1):\n`[{join(+):{dice(+{t})}}{if({numa}!=0):+({numa})}]`= }**{result}**",
  "embed": "{}",
  "last_fetched": "2026-10-21T00:49:43.237Z"
}