[How To] Dice Roller!


Item has a rating of 5 (Liked by Chris Graham)
#4060 (In Topic #807)
Standard member
mythus is in the usergroup ‘Community saint’

Dice Roller for RP communities

Want to make a RP forum community and allow dice rolls in your forum posts and chats? Or perhaps you just want to have a fun dice number guessing game? Then read on, for this tutorial will help you to have a dice roller in your Composr/Coversr powered site!

NOTICE: This requires changing / replacing php files. Please make a backup before continuing. We are not responsible if this code causes your hamsters to mutate and your computers to randomly melt.

Now that the important disclaimer is out of the way, lets get started. This change to your site will allow you to have a dice roller that works in forum posts AND chat / shoutbox messages - giving you a fair and useful way to run stat-based rp's where dice rolls are needed.




To make this happen first we need to replace sources/comcode_renderer.php

Replace it with the following file.


Please Note: The changes to comcode_renderer.php are being implemented in the next patch release. It is likely that you will not need to update/replace your file with this one. Check first to see if you can complete the next steps and have a working dice roller before replacing comcode_renderer.php.

Next you will need  to add a file. First you may need to create the folder "comcode" under "sources_custom/hooks/systems/" and enter that folder so that you are in "sources_custom/hooks/systems/comcode/".

You will upload the attached roller.php  file to that folder/location.


Once those files are changed go ahead and clear your caches and refresh your site. You should now have a working dice roller!

In order to use the dice roller, you will use the following syntax:



The "some_id" is important as it is what saves the dice  roll so that the number doesn't change when the page is refreshed. It must be different with each use of the roller tag.

The 3 is the number of dice you want rolled.

The 10 iis how many sides of dice you want.  This is basically how many numbers it will randomize.

The result will have each dice rolled seperated by "&".

If you want a simple regular d6, you could use either of the following for example:



[roller="d6 2"]1,2,3,4,5,6[/roller]

Here's a screenshot of it working!


Special thanks to Chris Graham for making this possible!

Like ocPortal? Want to thank Chris and gang somehow? Then help out in the chat room! It really needs your help! Just open it in a tab everytime you open your web browser, and when you hear a "ding", check it out!
"Those who want help should first be willing to give help."
Online now: No Back to the top
1 guest and 0 members have just viewed this.


Users online:

John Connor, Vaiva, babu, deepu_ms, MVLipwig, mytracker, Manu

Forum statistics:
  • 1,296 topics, 5,829 posts, 7,064 members
  • Our newest member is flour2door
Back to Top