Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Dice Pool - Text As Results & Separate Dice For Damage

Hello guys, I have two questions. I have a macro which prompts for the number of dice to roll and then calculates if it was a success, a partial success, or a failure. The mechanic of the game is that it doesnt matter the size of your pool, if you get at least a 10 in one of the die, its a success, if you get at least a 9, is a partial success, the rest is failure (no need to add up the number of successes).

[[ ?{Dice Pool|1}d10>10cs>9cf<8kh2 ]]


  1. Is there a way to have the results display as "success" "partial success" or "failure" instead of 1s and 0s?
  2. Is there a way to make the macro use the second highest die in the pool and display it as damage along side the results?
    E.g. You roll 4d10 and get 10, 5, 4, 4. The macro would say something like: Success! (you got a ten) And you deal 5(value of second highest die) damage?

I went through the documentation, but it doesn't seem possible.


July 26 (4 years ago)

Edited July 26 (4 years ago)
Kraynic
Pro
Sheet Author

You can probably do stuff like that with the api, but regular macros won't (unless someone comes along with a trick I'm not aware of).

If that is a stand alone macro, have you thought about switching from an inline roll ( [[macro here]] )to a regular roll ( /r macro here ) ?  If you switch to a regular roll it will display all the dice rolled, making it easier to sort things just by looking.  You can even sort the dice so that the highest rolls are displayed first.  That might be easier/quicker than what you have going now.

/r ?{Dice Pool|1}d10sd>10cs>9cf<8kh2


Kraynic said:

You can probably do stuff like that with the api, but regular macros won't (unless someone comes along with a trick I'm not aware of).

If that is a stand alone macro, have you thought about switching from an inline roll ( [[macro here]] )to a regular roll ( /r macro here ) ?  If you switch to a regular roll it will display all the dice rolled, making it easier to sort things just by looking.  You can even sort the dice so that the highest rolls are displayed first.  That might be easier/quicker than what you have going now.

/r ?{Dice Pool|1}d10sd>10cs>9cf<8kh2

I will look into it and see if its worth it to go Pro for it.
Thank you for suggestion. I think it will do nicely for now! :D


July 29 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

This is too complex for standard dice rolls. There's no roll mechanic that is too complex for the APi though - it's just a matter of being able to write it. There are plenty of people on the forum able to do that for you if you have the API.



GiGs said:

This is too complex for standard dice rolls. There's no roll mechanic that is too complex for the APi though - it's just a matter of being able to write it. There are plenty of people on the forum able to do that for you if you have the API.



Alright, I got Pro in order to have access to the API and went through the documentation, but I am having a hard time. Would you be interested in getting hired to do that, plus a custom character sheet for a custom system?

July 31 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

No need to hire me for the script, we can do at least a basic version of that here on the forum.

I'm interested in the character sheet commission, though - send me a PM and we'll discuss it.

July 31 (4 years ago)

Edited July 31 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Here's a quick script to provide basic output. You need to send this to chat:

!partial [[?{Dice Pool|1}d10]] 

or

!partial [[?{Dice Pool|1}d10]] some text to display as a title

It will show the dice rolled, report whether its a success, partial success, or failure, and the damage done.


In your campaign's Settings -> API tab, create a new script, name it anything, and add this script:

/*
    PARTIAL:
    !partial [[?{Dice|2}d10]] any text

*/
on('ready', () => {

    const version = '0.1.0';
    const lastUpdate = 1589611397055;

    on('chat:message', msg => {
        if (msg.type !== 'api') {
            return;
        }
        if (!msg.content.toLowerCase().startsWith('!partial ')) {
            return;
        }
        if (!msg.inlinerolls) {
            sendChat('PARTIAL', 'You need to supply a dice roll.')
            return;
        }
        const args = msg.content.split(/\s+/);
        const title = args.length <2 ? '' : args.splice(2).join(' ');
        const dice = _.pluck( (msg.inlinerolls && msg.inlinerolls[0].results.rolls[0].results) || [], 'v');
        const dicehigh = dice.sort((a, b) => b - a);

        const level = dicehigh[0] === 10 ? 'Success' : (dicehigh[0] === 9 ? 'Partial Success' : 'Failure');
        const damage = dicehigh[1] || 0;

        const message = `&{template:default} ${title ? `{{name=${title}}}` : ''} {{Roll=**${dice.join(' ')}**}} {{Result=**${level}** ${dicehigh[0] >= 9 ? `(${damage} damage)` : ''}}}`;
        sendChat(`player|${msg.playerid}`, message);
    });
});