Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // A system-agnostic macro for time-limited effects.
- // You can set custom start/end message and number of combat rounds.
- // Requires about-time.
- // This macro was written by @Phenomen#1337
- let applyChanges = false;
- new Dialog({
- title: `Timed Effect Configuration`,
- content: `
- <form>
- <div class="form-group">
- <label>What message will start the effect?</label>
- <input type="text" id="effect-start" name="effect-start" value="I'm blessed by Gods!">
- </div>
- <div class="form-group">
- <label>What message will end the effect?</label>
- <input type="text" id="effect-end" name="effect-end" value="The Gods have abandoned me...">
- </div>
- <div class="form-group">
- <label>How many combat rounds will the effect last?</label>
- <input type="number" id="effect-rounds" name="effect-rounds" min=0 value=1>
- </form>
- `,
- buttons: {
- yes: {
- icon: "<i class='fas fa-check'></i>",
- label: `Apply Changes`,
- callback: () => applyChanges = true
- },
- no: {
- icon: "<i class='fas fa-times'></i>",
- label: `Cancel Changes`
- },
- },
- default: "yes",
- close: html => {
- if (applyChanges) {
- let effectStartString = html.find('[name="effect-start"]')[0].value;
- let effectEndString = html.find('[name="effect-end"]')[0].value;
- let effectRounds = html.find('[name="effect-rounds"]')[0].value || 1;
- ChatMessage.create({
- user: game.user._id,
- content: effectStartString,
- speaker: ChatMessage.getSpeaker()
- }, {});
- game.Gametime.doIn({seconds:effectRounds*6}, () => {
- ChatMessage.create({
- user: game.user._id,
- content: effectEndString,
- speaker: ChatMessage.getSpeaker()
- }, {});
- });
- }
- }
- }).render(true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement