Dice Roll Chat Commands

Post suggestions for improvements here.
Post Reply
User avatar
Qui Chang
Baron
Baron
Posts: 59
Joined: Thu Aug 31, 2006 1:40 pm

Dice Roll Chat Commands

Post by Qui Chang »

Someone on the discord suggested adding dice rolls to the chat commands. An example:

Code: Select all

else if (GetStringLeft(sSaid, 7) == "/roll d" && StringToInt(GetSubString(sSaid, 7, GetStringLength(sSaid))) != 0)
        {
            //maybe add while loop to make sure all characters after '/roll d' are numbers
            int iDiceParsed = StringToInt(GetSubString(sSaid, 7, GetStringLength(sSaid)));
            string sDiceParsed = IntToString(iDiceParsed);
            int iDiceRoll = Random(StringToInt(sDiceParsed))+1;
            SetPCChatMessage(COLOR_GOLD+sName+" rolled a d"+sDiceParsed+". The result was: "+IntToString(iDiceRoll)+COLOR_END);
            return;
        }
This would allow anyone to roll literally and single dice at any time. IE, if you needed to roll a d2314, you could. Could also further parse it for multiple dice.
"When the student is ready.....the master appears" Old Zen Saying
User avatar
driller
Site Admin
Site Admin
Posts: 4792
Joined: Tue Jul 04, 2006 8:52 am
Contact:

Re: Dice Roll Chat Commands

Post by driller »

I already added this back on the 9th.

viewtopic.php?f=15&p=38620#p38620

Thanks.
User avatar
Qui Chang
Baron
Baron
Posts: 59
Joined: Thu Aug 31, 2006 1:40 pm

Re: Dice Roll Chat Commands

Post by Qui Chang »

driller wrote: Tue Apr 12, 2022 5:50 am I already added this back on the 9th.

viewtopic.php?f=15&p=38620#p38620

Thanks.
Oh I completely missed that update. Awesome!
"When the student is ready.....the master appears" Old Zen Saying
Post Reply