Frames and dialogs can call macros on some events. To do this place a <link> in the html-header of your frame/dialog-content. There are three events, on impersonation, on selection and on changes made on a token. The latter is said to work not perfectly.
Code: Select all
<link rel='onChangeImpersonated' type='macro' href='macroLink'>
<link rel='onChangeSelection' type='macro' href='macroLink'>
<link rel='onChangeToken' type='macro' href='macroLink'>
Example
openFrame
Code: Select all
[frame("showSelected"): {
[r, macro("frameContent@lib:token"):""]
}]
Code: Select all
<html>
<head>
<link rel='onChangeSelection' type='macro' href='[r:macroLinkText("open frame@lib:token")]'>
</head>
<body>
[h: selection = getSelected()]
[h: odd = 1]
<table width="100%">
[r, foreach( id, selection,"" ), code: {
<tr style='background-color:[r:if(odd, "#ffffff;","#aaffaa;")]'>
<td><img src='[r, token(id): getTokenImage(50)]'></td>
<td><b>[r:getName(id)]</b></td>
<td>[r: if(isPC(id), "PC", "NPC")]</td>
</tr>
[h: odd = if(odd, 0, 1)]
}]
</table>
</body>
</html>