Created
June 20, 2022 02:58
-
-
Save bloy/4176ab83bc1dff22dc5222b6fc63a6eb to your computer and use it in GitHub Desktop.
SWADE challenge tracker macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SOCIAL = "Social Conflict (6 tokens, 3 rounds)"; | |
const DRAMATIC_CHALLENGE = "Challenging Dramatic Task (4 tokens, 3 rounds)"; | |
const DRAMATIC_DIFFICULT = "Difficult Dramatic Task (6 tokens, 4 rounds)"; | |
const DRAMATIC_COMPLEX = "Complex Dramatic Task (8 tokens, 5 rounds)"; | |
const CUSTOM = "Custom (see below)"; | |
let dialogData = [ | |
{type: 'radio', label: SOCIAL, options: ['choice', false]}, | |
{type: 'radio', label: DRAMATIC_CHALLENGE, options: ['choice', false]}, | |
{type: 'radio', label: DRAMATIC_DIFFICULT, options: ['choice', false]}, | |
{type: 'radio', label: DRAMATIC_COMPLEX, options: ['choice', false]}, | |
{type: 'radio', label: CUSTOM, options: ['choice', true]}, | |
{type: 'number', label: "Custom tokens", options: "6"}, | |
{type: 'number', label: "Rounds", options: "3"}, | |
{type: 'info', label: 'Multi person dramatic tasks assume "fair" is 1 success per participant per round'}, | |
]; | |
let dialogResult = await warpgate.dialog(dialogData, "Challenge"); | |
let radioResult = dialogResult[0] || dialogResult[1] || dialogResult[2] || dialogResult[3] || dialogResult[4]; | |
let tokens = dialogResult[5]; | |
let rounds = dialogResult[6]; | |
switch (radioResult) { | |
case SOCIAL: tokens = 6; rounds = 3; break; | |
case DRAMATIC_CHALLENGE: tokens = 4; rounds = 3; break; | |
case DRAMATIC_DIFFICULT: tokens = 6; rounds = 4; break; | |
case DRAMATIC_COMPLEX: tokens = 8; rounds = 5; break; | |
default: break; | |
} | |
ChallengeTracker.open(tokens, rounds); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment