dice

https://carl.gg/t/87240 with some changes

Privateunrated

Content

31 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. Borrowed from carl.gg/t/87240 with some changes }
{=(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}}

{=(error):Syntax is `{prefix}{tagname} 2d6`.$Roll no more than 20 dice}

{=(numt):{if({t}=={m:trunc({t}/1)}):{t}|1}}
{=(nums):{and({s}=={m:trunc({s}/1)}|{in(d):{args}}==true):{s}|6}}
{=(n):range:1-{nums}}

{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(+{numt})}}}}
{=(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 {numt}d{nums}:{if({displayrolls}==1):
`[{join(+):{dice(+{numt})}}]`= } **{result}**
Raw JSON
{
  "id": 1633690,
  "created_at": "2023-01-09T18:37:08.000Z",
  "tag_name": "dice",
  "nsfw": false,
  "owner_id": "276735694624522240",
  "uses": 41,
  "description": "https://carl.gg/t/87240 with some changes ",
  "restricted": false,
  "shared": false,
  "deleted": false,
  "safe": "unrated",
  "hidden": false,
  "guild_id": "387644871386595349",
  "sharer": "276735694624522240",
  "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. Borrowed from carl.gg/t/87240 with some changes }\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\n{=(error):Syntax is `{prefix}{tagname} 2d6`.$Roll no more than 20 dice}\n\n{=(numt):{if({t}=={m:trunc({t}/1)}):{t}|1}}\n{=(nums):{and({s}=={m:trunc({s}/1)}|{in(d):{args}}==true):{s}|6}}\n{=(n):range:1-{nums}}\n\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(+{numt})}}}}\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 {numt}d{nums}:{if({displayrolls}==1):\n`[{join(+):{dice(+{numt})}}]`= } **{result}**",
  "embed": "{}",
  "last_fetched": "2026-10-20T19:07:38.200Z"
}