DeviantNull wrote:This reload issue is just nuts. I experimented with "onChangeImpersonated" thinking I could maybe help players out by not forcing theirs to redraw whenever they selected their token, and make it an optional thing for GM's... THAT even triggers a redraw when the same token is reselected even if the impersonation was never changed or stopped.
OK, I worked today, head spinning, trying to figure out something to help on this one, as it drives my players nuts. Finally, I thought, "Why not put the last token information on the sheet itself instead of storing it on a token?" So, what I did was to rewrite the Sheet macro and put a modified form of the sheet macro in a new macro called ShowSheet (in the same group).
Replace the code in Sheet on Lib:Sheet with this:
Code: Select all
<!--Sheet-->
<!--Sees if multiple tokens selected and whether token is the last token selected.-->
[h: selectedCount=listCount(getSelected())]
[h: lastToken=if(macro.args=="","None",macro.args)]
<!--If more than one selected, pull up sheet, which will give message for multiples.-->
[h, if (selectedCount>1), code:{[macro("ShowSheet@Lib:Sheet"):"Multiple"]}; {
[h: current=getSelected()]
<!--If token is not the last selected token, call up the sheet and attach the current token name. If not, do nothing-->
[if (lastToken!=current), code:{[macro("ShowSheet@Lib:Sheet"):current]}]
}]
Then create a new macro on Lib:Sheet called ShowSheet (put it in the SheetLoad group for easy reference later) and paste in this code:
Code: Select all
<!-- Main Character sheet page-->
<!--Checks to see if the token has the state Character and if it does, calls SheetType. Prevents non-character tokens that lack property values from causing errors and prompting for values.
SelectedCount checks to see if more than 1 token is selected to prevent multiple redraws of the Character sheet.
Uses onChangeSelection to reload the sheet when a different token is selected-->
[h: selectedCount=listCount(getSelected())]
[frame("Sheet"):{
<html>
<link rel="onChangeSelection" type="macro" href="[r: macroLinkText('Sheet@Lib:Sheet', 'none',macro.args,'selected')]"></link>
<head>
<link rel="stylesheet" type="text/css" href="SheetCSS@[r: getMacroLocation()]">
<title>Character Sheet</title></head>
[r, if(state.Character == 1 && selectedCount <= 1), code:
{
[r, macro("SheetType@Lib:Sheet"): macro.args]
};
{
<table width="100%">
<tr>
<td align="center">
<b>[r, if(SelectedCount <= 1): "This is not a character token."; "Multiple tokens selected."]</b>
</td>
</tr>
</table>
}
]
</html>
}]
If you look at the code, you'll notice that I have the last token selected's name as an argument that gets passed between the two macros and which stays in the onChange section of the page so that it doesn't have to be stored to a token.
Remember to always do a backup first before you try. It seems to speed things up for me, though, so give it a whirl.
Edit:
I had to revert to the original because I started getting json errors when I tried to switch to powers, feats, etc. Any ideas?