Telling Table

Telling table for The One Ring RPG Strider Mode
 avatar
user_2840493
javascript
a month ago
2.4 kB
3
Indexable
Never
// MACRO NAME: TELLING TABLE
// MACRO TYPE: script

// REQUIRED TABLES: Telling-Certain, Telling-Likely, Telling-Middling, Telling-Doubtful, Telling-Unthinkable

// copy and paste from below this line:

let message;
async function printMessage(table) {
    let roll = await table.roll()
    let result = roll.results[0];
    let chatData = {
        content: `<div style="text-align:center">
        <h2>Telling Table</h2>
        <p>Your answer with <i>${message}</i> odds is:</p>
        <p style="color:#941b0c;font-size:20px;">${result.data.text}</p>       
        </div>`,
        whisper: [game.user],
    };
    ChatMessage.create(chatData, {});
}

let dType = new Dialog({
    title: "Telling",
    content: `<div style="text-align:center;font-size:24px;"><h3>What are the chances?<\h3><h2><\h2><\div>`,
    buttons: {
        button1: { 
            label: "Certain",
            callback: () => {
                message = "certain";
                printMessage(
                    game.tables.contents
                        .find((t) => t.name === "Telling-Certain")
                );
            },
        },
        button2: { 
            label: "Likely",
            callback: () => {
                message = "likely";
                printMessage(
                    game.tables.contents
                        .find((t) => t.name === "Telling-Likely")
                );
            },
        },
        button3: {
            label: "Middling",
            callback: () => {
                message = "middling";
                printMessage(
                    game.tables.contents
                        .find((t) => t.name === "Telling-Middling")
                );
            },
        },
        button4: {
            label: "Doubtful",
            callback: () => {
                message = "doubtful";
                printMessage(
                    game.tables.contents
                        .find((t) => t.name === "Telling-Doubtful")
                );
            },
        },
        button5: {
            label: "Unthinkable",
            callback: () => {
                message = "unthinkable";
                printMessage(
                    game.tables.contents
                        .find((t) => t.name === "Telling-Unthinkable")
                );
            },
        },
    },
}).render(true);
Leave a Comment