Rpg with dice

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Ideas Centre
Post Reply
User avatar
jd-Fairo
Registered User
Posts: 24
Joined: Fri Oct 17, 2014 4:08 am
Contact:

Rpg with dice

Post by jd-Fairo » Fri Nov 07, 2014 7:00 pm

I'm looking for an extension that allows you to roll dice and the dice mod viewtopic.php?f=434&t=1816135 , maybe you appended a life bar or something like that allows you to have battles. for RPG forums

koraldon
Registered User
Posts: 483
Joined: Sat Jun 30, 2007 12:42 pm

Re: Rpg with dice

Post by koraldon » Mon Dec 08, 2014 7:46 pm

A dice roller extension for phpbb 3.1 will be great.
Arandom number generator for d4,d6,d8,d10,d12,d20 and allowing the user to select a combination of will be awesome!

User avatar
TraXy
Registered User
Posts: 39
Joined: Sat Feb 12, 2005 11:46 pm
Location: Nottingham
Contact:

Re: Rpg with dice

Post by TraXy » Tue Dec 09, 2014 12:13 am

+1
[DON'T PANIC]

User avatar
alicia86
Registered User
Posts: 75
Joined: Sat Oct 10, 2009 10:10 pm
Name: Alicia
Contact:

Re: Rpg with dice

Post by alicia86 » Tue Dec 09, 2014 8:11 pm

Getting an updated version of the old DiceMod would be great!
I haven't yet tested to see if the old dice mod can be used with 3.1, but I'm betting it's not going to.

koraldon
Registered User
Posts: 483
Joined: Sat Jun 30, 2007 12:42 pm

Re: Rpg with dice

Post by koraldon » Fri Dec 12, 2014 6:44 am

Well I assume the algorithm and php for the actual dice rolling can be reused, but the interface with phpbb (events) needs to be rewritten...

TWEagle
Registered User
Posts: 273
Joined: Sat Dec 10, 2005 2:50 pm
Contact:

Re: Rpg with dice

Post by TWEagle » Fri Dec 12, 2014 6:16 pm

+1
Image

zhavier
Registered User
Posts: 5
Joined: Fri Mar 05, 2010 3:30 am

Re: Rpg with dice

Post by zhavier » Tue Jan 13, 2015 9:08 pm

+1

lagame
Registered User
Posts: 16
Joined: Sun Mar 28, 2010 5:00 pm
Name: Cristiano Lagame

Re: Rpg with dice

Post by lagame » Wed Feb 04, 2015 2:42 pm

+1

koraldon
Registered User
Posts: 483
Joined: Sat Jun 30, 2007 12:42 pm

Re: Rpg with dice

Post by koraldon » Wed Feb 04, 2015 4:37 pm

Maybe it will help a developer but I found here - http://support.zathyus.com/topic/5079712/3/ a Javascript file for a roller for another board software

Code: Select all

/* Dice Rolling Script (v3.0)
by Reid of ZNR (resources.zetaboards.com)
Feel free to edit/redistribute */

(function () {
    var dr = {
        roll_dice: function (sides, times) {
            var result = [], result_num = 0, result_holder;
            while (times--) {
                result_holder = Math.ceil(Math.random() * sides);
                result_num += result_holder;
                result[result.length] = result_holder;
            }
            return [result_num, result];
        },
        
        regex: /\[result\](.+?)\[\/result\]/gi,
        old_regex: /\[result=(.+?)\](.+?)\[\/result\]/gi,
        
        // Intended to be used as an event handler
        update_post: function (event_handler) {
            // Malformed post checker
            var somebody_set_up_the_bomb = false,
                t = $('textarea[name=post]')[0];
            
            if (dr.regex.test(t.value) && !$('#menu_acp').length) {
                $("<p id='cheat'>Please do not attempt to cheat.</p>").hide().insertBefore(t).fadeIn();
                return false;
            } else if (!dr.regex.test(t.value) && $('#cheat').length) {
                $('#cheat').fadeOut(function () {
                    $(this).remove();
                });
            }
            
            $('#malformed').remove();
            
            t.value = t.value.replace(/\[roll\](.+?)\[\/roll\]/gi, function (total, to_roll) {
                var tr = to_roll.toLowerCase().replace(/ /g, "").split('+'),
                    result = [], result_num = 0, result_holder, i, k, c, excess_holder;
                
                if (/[^d+\d]|([+d])\1/.test(to_roll)) {
                    $('#malformed').remove();
                    $("<p id='malformed' style='display: none'>You appear to have a malformed roll. Please correct it and try again.</p>").insertBefore(t).fadeIn();
                    somebody_set_up_the_bomb = true;
                    event_handler.preventDefault ? event_handler.preventDefault() : event_handler.returnValue = false;
                    return total;
                }
                
                for (i = 0, k = tr.length; i < k; i++) {
                    if (tr[i].indexOf('d') === -1) continue;
                    
                    c = tr[i].split('d');
                    
                    excess_holder = tr[i + 1] && tr[i + 1].indexOf('d') === -1 ? +tr[i + 1] : 0;
                    
                    result_holder = dr.roll_dice(+c[1], +(c[0] || 1));
                    result_num += result_holder[0] + excess_holder;
                    result[result.length] = [result_holder[1].join(':'), tr[i], excess_holder, result_holder[0] + excess_holder].join();
                }
                
                return "[result]" + result_num + "&" + result.join("|") + "&" + to_roll + "[/result]";
            });
            
            
            // Malformed roll check
            if (somebody_set_up_the_bomb) {
                t.value = t.value.replace(dr.regex, "[roll]$1[/roll]");
            }
        },
        
        insert_roll: function () {
            $('textarea[name=post]').val(function (i, v) {
                return v + '[roll]' + prompt("Type the roll you which to use\n(Format: [num]d[sides]+[extra(opt.)])") + '[/roll]';
            });
        },
        
        // Used as an event handler
        // 'this' is the span result clicked
        roll_display: function () {
            var information = $(this).next().html().split('%'),
                dice_used = information[1].split('|'),
                i, k, tmp, each_die, excess,
                formatted = ["Original dice used: " + information[0] + "\n\nDissected rolls:"];
            
            for (i = 0, k = dice_used.length; i < k; i++) {
                tmp = dice_used[i].split(',');
                each_die = tmp[0].split(':');
                excess = tmp[2] !== '0' ? " (+" + tmp[2] + ")" : "";
                formatted[formatted.length] = tmp[1] + excess + (each_die.length > 1 ? "  => " + each_die.join(' + ') + excess : "") + "  => " + tmp[3];
            }
            
            formatted[formatted.length] = ["\nResult: " + information[2]];
            alert(formatted.join("\n"));
        }
    };
    
    if (location.href.indexOf('/post') !== -1) {
        $('form:has(textarea[name=post])').submit(dr.update_post);
        $("<button type='button' id='d_roll'>Roll</button>").insertAfter('#c_bbcode button:last').click(dr.insert_roll);
    } else if (/topic|single/.test(location.href)) {
        $('td.c_post').each(function () {
            if (dr.regex.test(this.innerHTML)) {
                this.innerHTML = this.innerHTML.replace(dr.regex, function (t, result) {
                    // t[0] should be the result in number format
                    // t[1] should be the dice used to roll and their results, separated by |
                    // t[2] should be the entire dice used
                    var t = result.split(/&(?:amp;)?/);
                    return "<span style='cursor: pointer; border-bottom: 1px dotted gray' title='Dice used to roll: " + t[2] + "; click for details' class='roll_results'>" + t[0] + "</span><span style='display: none'>" + t[2] + "%" + t[1] + "%" + t[0] + "</span>";
                });
                
                // Remove edit button unless admin
                if (!$('#menu_acp').length) {
                    $(this).parents('tr').next().next().find('a[href*=mode=3]').remove();
                }
            }
            
            // Support old result format (yuck)
            if (dr.old_regex.test(this.innerHTML)) {
                this.innerHTML = this.innerHTML.replace(dr.old_regex, "<a href='javascript:;' class='old_roll_results'>$2</a><div style='display:none'>$1</div>");
                if (!$('#menu_acp').length) {
                    $(this).parents('tr').next().next().find('a[href*=mode=3]').remove();
                }
            }
        });
        
        // Bind the results function
        $('span.roll_results').click(dr.roll_display);
        $('a.old_roll_results').click(function () {
            alert("Rolled with: " + $(this).next().text());
        });
        $('form:has(textarea[name=post])').submit(dr.update_post);
    }
}());
And here is a dice roller for proboard - http://support.proboards.com/thread/446 ... oboards-v5

I would be willing to donate for such an extension.

lagame
Registered User
Posts: 16
Joined: Sun Mar 28, 2010 5:00 pm
Name: Cristiano Lagame

Re: Rpg with dice

Post by lagame » Thu Feb 26, 2015 6:17 pm

I'll try to create one for me, if I do, I will post here.

Shepskii
Registered User
Posts: 27
Joined: Mon Feb 23, 2015 10:51 pm

Re: Rpg with dice

Post by Shepskii » Fri Mar 06, 2015 10:47 pm

I would love a dice extension for 3.1, currently I am using an external roller and have setup the dice images as smilies for players to put into posts or if they use this one:

http://orokos.com/roll/

It produces BBcode for forums which result in this:

Test: 2eP+3eA 6 successes, 2 advantage
ImageImageImageImageImage

Main complication from my perspective is the fact that Edge of the Empire uses custom dice but just having a roll extension for standard dice alone would be fantastic.

koraldon
Registered User
Posts: 483
Joined: Sat Jun 30, 2007 12:42 pm

Re: Rpg with dice

Post by koraldon » Thu Apr 16, 2015 7:15 pm

Hi All,
HanelyP creating a dice roller extension for 3.1 :)
viewtopic.php?f=456&t=2306161

It is working great in my testing, but you can also test it so it can proceed to beta.
I'm loving it :)

Post Reply

Return to “Extension Requests”

Who is online

Users browsing this forum: No registered users and 9 guests