Editable Character Sheet For Token Owners Only - Solved

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

User avatar
Oriet
Cave Troll
Posts: 30
Joined: Mon Dec 05, 2011 10:58 am
Location: Somewhere that's not there, but not really here.
Contact:

Re: Editable Character Sheet For Token Owners Only

Post by Oriet »

I know it has been quite some time since I posted about this, as life things came up and bogged me down a bit (including tendosynovitis D: ). However, I solved it!

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>
}]
 
[/spoiler]

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>
}]
 
[/spoiler]

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. :D
Kill them all, and let the Game Master grant the exp!

ImageImage

Post Reply

Return to “Macros”