-
-
Save antonioeduardofernandes/3d1ab814cc93570472ac67517a4a09e3 to your computer and use it in GitHub Desktop.
await Dialog.prompt({ | |
content: ` | |
<h1>Current Weather</h1> | |
<select id="currentWeather"> | |
<option value="noWind">No Winds</option> | |
<option value="lowWind">Low Winds</option> | |
<option value="highWind">High Winds</option> | |
</select> | |
`, | |
callback: html => { | |
let currentWeather = html.find('[id="currentWeather"]').val() | |
game.tables.getName(currentWeather).draw() | |
}, | |
}) |
I've also just had a look in the console to check what's going on when I run the Macro, and this is what I get:
"Promise" is a character in our game and I had their token selected when I executed the macro, so maybe that's why it's saying in promise
?
Although I also just deselected all tokens, so had nothing selected in the scene and the message returned the same.
No problem, it's better to discuss it here!
Be sure you get the options "Draw with Replacement?" and "Display Roll to Chat" marked on your tables (noWind, lowWind and highWind)!
Since you want to display the result on the public Chat, I've removed unused and unnecessary code.
It's not storing the values yet.
Let me know if it works properly now.
Sorry it's taken me so long to test it, I've been busy with other things.
That seems to work now!
I've got two thoughts:
- The dialog is changed slightly to be "Fine Weather", "Fair Weather", "Foul Weather". Each of those options makes a roll against two tables - Wind and Rain (Fine = noWind + noRain; Fair = lowWind + lightRain; Foul = highWind + heavyRain); OR
- Get rid of the dialog and the first execution of the Macro just rolls randomly against Wind and a Rain table.
Is it possible to concatenate the results, so that it rolls both a Wind and Rain in the background, and then presents them both together as a single result?
`let currentWind = html.find('[id="currentWind"]').val()
game.tables.getName(currentWind).draw()
let currentRain = html.find('[id="currentRain"]').val()
game.tables.getName(currentRain).draw()`
await Dialog.prompt({
content:
<h1>Current Weather</h1>
<select id="currentWind">
<option value="noWind">No Winds</option>
<option value="lowWind">Low Winds</option>
<option value="highWind">High Winds</option>
</select>
<select id="currentRain">
<option value="noRain">No Rain</option>
<option value="lightRain">Light Rain</option>
<option value="heavyRain">Heavy Rain</option>
</select>
,
callback: html => {
let currentWind = html.find('[id="currentWind"]').val()
game.tables.getName(currentWind).draw()
let currentRain = html.find('[id="currentRain"]').val()
game.tables.getName(currentRain).draw()
},
})
Hello, I've created an account here so that I can comment on the stuff here rather than in Reddit - hope that's ok?
So I've copied all of the above into a Macro, and for some reason it still isn't presenting the roll of the table into chat. I went in and changed the
ChatMessage.create
section to just
{content}
on the basis that it might not be showing posting it in the chat.What's weird though is I'm not getting any obvious error messages when I execute the macro, which makes me think there isn't an issue with it, but for whatever reason it doesn't know what to post to chat, or doesn't have anything to post to chat?