
I'm new to javascripting and after searching for hours I am admitting defeat. I have created a rollable table with the images I want to use for a token on the map layer. I've added the token to the map layer, and the functionality to randomly/selectively change the token image works great (r-click the token and under Multi-sided click either Random Side or Choose Side). However this requires the GM to be on the map layer.
What I want to do is use a macro to do the work so a GM/player can just click a button: /roll 1t[myTable], but there doesn't seem to be any parameter for specifying which token (such as by token name). So that leaves me with calling a script that finds the token by name, and then applies the image from the rollable table to that token.
I found a couple of related scripts (TokenNameNumber and RandomToken), but it's way over my head to even extract what I can use from them. So basically what I'm asking for is to be able to use a macro: !script /roll 1t[myTable] (on myToken) that utilizes a script that:
Thanks for your consideration. Cheers!
What I want to do is use a macro to do the work so a GM/player can just click a button: /roll 1t[myTable], but there doesn't seem to be any parameter for specifying which token (such as by token name). So that leaves me with calling a script that finds the token by name, and then applies the image from the rollable table to that token.
I found a couple of related scripts (TokenNameNumber and RandomToken), but it's way over my head to even extract what I can use from them. So basically what I'm asking for is to be able to use a macro: !script /roll 1t[myTable] (on myToken) that utilizes a script that:
- Gets the result of the /roll 1t[myTable] part of the macro
- Finds the token named "myToken"
- Changes the token image (applies the result to the token)
Thanks for your consideration. Cheers!