In this old topic , Oosh said : - you can now use [img](@{selected|token_img}) in a macro to output the token art for any character where you've set the Attribute to the image location With this as a starting point, I found that it's even easier to accomplish this now that the character_token attribute is available. HTML: <input type="number" name="attr_combat" />
<button type="action" name="act_skilltest" value="combat"></button>
<rolltemplate class="sheet-rolltemplate-skilltest">
<div class="sheet-template-header">
{{#token}}
<div class="sheet-template-token">{{token}}</div>
{{/token}}
<div class="sheet-template-charname">{{charname}}</div>
<div class="sheet-template-skillname">{{skill}} ({{skilllevel}})</div>
</div>
<div class="sheet-template-body">
etc...
</div>
</rolltemplate>
<script type="text/worker">
on('clicked:skilltest', (event) => {
// name of the skill to test is stored in the button's value attribute
var skillname = event.htmlAttributes.value;
getAttrs([skillname, "character_token"], (values) => {
const skilllevel = parseInt(values[skillname])||0;
// Get the token image. Note we need to strip out any parameters from the url
const token = (values['character_token'] != "") ? "[alttext]("+values['character_token'].split('?')[0]+")" : "";
// build the roll string, passing the character token image
var roll = "&{template:skilltest} " + (token !== "") ? "{{token="+token+"}} " : "";
roll += "{{charname=@{character_name}}} {{skill="+skillname+"}} {{skilllevel="+skilllevel+"}} ";
roll += "{{skillroll=[[1d100<[[?{Modifier|0}+"+skilllevel+"]]]]}}"; startRoll(roll, (results) => {
finishRoll(results.rollId);
});
});
});
</script> CSS:
.sheet-rolltemplate-skilltest .sheet-template-token {
width: 60px;
height: 60px;
position: absolute;
margin-left: -48px;
margin-top: 10px;
} Result: I find it's much easier to scan test results when the character's token is displayed like this.