I had been using this as the code for opening the character sheet:
[spoiler=Old openCharacterSheet Macro]
Code: Select all
[h: link = macroLinkText("[email protected]:Combat", "none")]
[frame("CharacterSheet"): {
[h: page = getStrProp(macro.args, "Page")]
[h,if(page==""): page="Main"]
<html>
<head>
<link rel="onChangeSelection" type="macro" href="[r:link]">
<link rel="stylesheet" type="text/css" href="[email protected]:Combat"></link>
</head>
<body>
[r,macro("[email protected]:Combat"): page]
<br>
[r,macro("characterSheet"+page+"@Lib:Combat"): getSelected()]
</body>
</html>
}]
I found that I could then modify it with the following:
[spoiler=New openCharacterSheet Macro]
Code: Select all
[h: link = macroLinkText("[email protected]:Combat", "none")]
[frame("CharacterSheet"): {
[h: page = getStrProp(macro.args, "Page")]
[h,if(page==""): page="Main"]
<html>
<head>
<link rel="onChangeSelection" type="macro" href="[r:link]">
<link rel="stylesheet" type="text/css" href="[email protected]:Combat"></link>
</head>
<body>
[h: has.permission = 0]
[h: acting.token = getSelected()]
[h: acting.player = getPlayerName()]
[h,if(isOwner(acting.player, acting.token)): has.permission = 1]
[h,if(isGM()): has.permission = 1]
[if(has.permission == 0),code:
{
[r: "You do not have permission to view this token's character sheet."]
};{
[h: "<!-- Stuff -->"]
[h: id = getSelected()]
[h: header.args = strPropFromVars("page, id", "unsuffixed")]
[r,macro("[email protected]:Combat"): page]
<br>
[r,macro("characterSheet"+page+"@Lib:Combat"): getSelected()]
</body>
</html>
}]
This then still has the dialog box, but just informs the person they cannot view or edit the character sheet of tokens they don't have ownership of. They can still change which token is selected, and it will either display the text or the character sheet depending on whether or not they have ownership of that token. I'm very please I figured out how to do it, as it remains dynamic and easy for the GM to update NPC tokens while ensuring the PCs cannot see or alter what they shouldn't be able to, all in one macro.
