I've been using [wiki]Forms_tutorial[/wiki] and [wiki]Introduction_to_Dialogs_and_Frames[/wiki] quite a bit for this, and I now have a nice looking character sheet with editable fields and 3 tabs (at least so far, need to do something for armour and weapons still) using a [wroll]frame[/wroll]. However, I want to make it so that only those who have ownership of a token can view and edit the character sheet for the token.
I've been able to fanangle things in so that it won't let you open the character sheet when you don't have ownership of the selected token, however the [wiki]onChangeSelection[/wiki] seems to go around that as when the character sheet frame is open and another token is selected it updates with that token's data, and changes to take effect, even when they do not have ownership of the token. Or at least I think I managed to do that... it might be something unrelated to what I did as I didn't test as a player until I tried implementing it.
Obviously I won't be able to get assistance if I don't include the macros, so here they are.
[spoiler=openCharacterSheet]
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=charSheetcss]
Code: Select all
.odd { background-color: #FFFFFF }
.even { background-color: #EEEEAA }
th { background-color: #113311; color: #FFFFFF }
.page a {
background-color: #5555CC;
color: white;
}
.currentPage a {
background-color: #7777FF;
color: white;
}
[spoiler=charSheetHeader]
Code: Select all
[h: currentPage = macro.args]
[h: pages = "Main,GeneralSkills,SpecialisedSkills"]
<table>
<tr>
[foreach(page, pages,""), code: {
[h,if (page == currentPage): class="currentPage" ; class="page"]
[h: callback = "[email protected]:Combat"]
<td class="[r: class]">
[r: macroLink(page, callback, "none", "Page="+page)]
</td>
}]
</tr>
</table>
[spoiler=characterSheetMain]
Code: Select all
[h: id = macro.args]
[r, if(listCount(id)!=1), code: {};{
[h: link = macroLinkText("[email protected]:Combat", "all")]
<form action="[r:link]" method="json">
<input type="hidden" name="id" value="[r:id]">
<table>
<td>
<img src='[r,token(id): getTokenImage(75)]'></img>
</td>
<td>
<h1> [r:getName(id)]</h1>
</td>
</table>
<table>
<tr>
<table>
<td>
<table>
<tr>
<th colspan="*">Attribute</th>
<th colspan="*">Score</th>
<th colspan="*">Mod</th>
</tr>
[h: attributes = "Str, Dex, Con, Int, Wis, Cha"]
[h: row = "odd"]
[h: abilScores = getProperty("AbilityScores", id)]
[r,foreach(attrib, attributes, ""),code: {
<tr class="[r:row]">
<td><b>[r:attrib]</b></td>
<td><input type="text" name="[r:attrib]" value="[r:getStrProp(abilScores, attrib)]" size="3" align="right"></td>
<td>[r:getStrProp(getProperty("AbilityModifiers", id), attrib)]</td>
</tr>
[h: row = if(row=="odd", "even", "odd")]
}]
[h: savey = getProperty("SaveBonuses", id)]
[h: fort1 = getStrProp(savey, "Fort")]
[h: fort2 = fort1 + getStrProp(getProperty("AbilityModifiers", id), "Con")]
[h: ref1 = getStrProp(savey, "Ref")]
[h: ref2 = ref1 + getStrProp(getProperty("AbilityModifiers", id), "Dex")]
[h: will1 = getStrProp(savey, "Will")]
[h: will2 = will1 + getStrProp(getProperty("AbilityModifiers", id), "Wis")]
<th colspan="*">Save</th>
<th colspan="*">Total</th>
<th colspan="*">Mod</th>
<tr class="even">
<td><b>Fortitude</b></td>
<td>[r: fort2]</td>
<td><input type="text" name="reflexSave" value="[r: fort1]" size="3" align="right"></td>
</tr>
<tr class="odd">
<td><b>Reflex</b></td>
<td>[r: ref2]</td>
<td><input type="text" name="reflexSave" value="[r: ref1]" size="3" align="right"></td>
</tr>
<tr class="even">
<td><b>Will</b></td>
<td>[r: will2]</td>
<td><input type="text" name="reflexSave" value="[r: will1]" size="3" align="right"></td>
</tr>
</table>
</td>
<td>
<table>
<tr>
[h: hpVar = getStrProp(getProperty("HP", id), "Base")]
<th colspan="3">Secondary Attributes</th>
<tr class="even">
<td><b>Max Hit Points</b></td>
<td><input type="text" name="health" value="[r:hpVar]" size="3" align="right"><td>
</tr>
[h: forcey = getProperty("MaxFP", id)]
<tr class="odd">
<td><b>Max Force Points</b></td>
<td><input type="text" name="force" value="[r:forcey]" size="3" align="right"><td>
</tr>
</tr>
<tr>
[h: baseDef = getStrProp(getProperty("Defence", id), "Base")]
[h: flatDef = getStrProp(getProperty("Defence", id), "Flat")]
<th colspan="3">Defence</th>
<tr class="odd">
<td><b>Base</b></td>
<td><input type="text" name="baseDefence" value="[r:baseDef]" size="3" align="right"></td>
</tr>
<tr class="even">
<td><b>Flat-footed</b></td>
<td><input type="text" name="baseDefence" value="[r:flatDef]" size="3" align="right"></td>
</tr>
<tr>
[h: baseAB = getProperty("BAB", id)]
[h: numHD = getProperty("HitDiceCount", id)]
[h: forceLvl = getProperty("ForceLevel", id)]
[h: auraVal = getProperty("ForceAuraValue", id)]
<th colspan="3">Misc</th>
<tr class="even">
<td><b>Num. of Hit Dice</b></td>
<td><input type="text" name="charHD" value="[r:numHD]" size="3" align="right"></td>
</tr>
<tr class="odd">
<td><b>Base Attack Bonus</b></td>
<td><input type="text" name="baseAttack" value="[r:baseAB]" size="3" align="right"></td>
</tr>
<tr class="even">
<td><b>Force User Level</b></td>
<td><input type="text" name="forceHD" value="[r:forceLvl]" size="3" align="right"></td>
</tr>
<tr class="odd">
<td><b>Force Aura Value</b></td>
<td><input type="text" name="ForceAura" value="[r: auraVal]" size="3" align="right"></td>
</tr>
</tr>
</tr>
</td>
</table>
</table>
<input type="submit" name="edit_btn" value="Submit changes">
</form>
}]
I think that's all of the macros in the set needed for figuring out how to get it so only token owners can view and thus edit the character sheet for a token. If not I'll post the rest of it, but I don't think it'll have any influence on the aspect I want.
Oh, and here are the token properties being used:
[spoiler=properties]
Code: Select all
AbilityScores:Str=10 ; Dex=10 ; Con=10 ; Int=10 ; Wis=10 ; Cha=10 ;
AbilityModifiers:Str=0 ; Dex=0 ; Con=0 ; Int=0 ; Wis=0 ; Cha=0 ;
Experience
• Combat •
InitiativeModifiers:0
*@Def:{getStrProp(Defence, "Base")}, Flat {getStrProp(Defence, "Flat")}, CMD {CMD}
Defence:Base=13 ; Flat=13 ;
*@Hardness:0
ArmourCheckPenalty:0
HitDiceCount:1
*@HitPoints:{getStrProp(HP, "Current")}/{getStrProp(HP, "Base")}, nonlethal {getStrProp(HP, "NL")}
HP:Base=10 ; Current=10 ; NL=0 ;
CMD:10
CMB:0
ForceLevel
MaxFP
FP
*@ForcePoints:{FP}{if(MaxFP != "", "/", "")}{MaxFP}
SaveBonuses:Fort=0 ; Ref=0 ; Will=0 ;
DefensiveAbilities
BAB:0
*@Movement:Walk {getStrProp(Move, "Base")}, Run {getStrProp(Move, "Max")}
Move:Base=30; Max=120
*ForceAura:Neutral
ForceAuraValue:0
• Skill Modifiers Excluding Ability & Armour Mods •
Acrobatics:0
Appraise:0
Astrogate:0
Bluff:0
Climb:0
ComputerUse:0
Craft1:Mod=0 ; Speciality= ;
Craft2:Mod=0 ; Speciality= ;
Craft3:Mod=0 ; Speciality= ;
Craft4:Mod=0 ; Speciality= ;
Demolitions:0
Diplomacy:0
DisableDevice:0
Disguise:0
Enertain1:Mod=0 ; Speciality= ;
Enertain2:Mod=0 ; Speciality= ;
EscapeArtist:0
Gamble:0
HandleAnimal:0
Intimidate:0
Knowledge1:Mod=0 ; Speciality= ;
Knowledge2:Mod=0 ; Speciality= ;
Knowledge3:Mod=0 ; Speciality= ;
Knowledge4:Mod=0 ; Speciality= ;
Linguistics:0
Perception:0
Repair:0
Ride:0
SenseMotive:0
SleightOfHand:0
Stealth:0
Survival:0
Swim:0
TreatInjury:0
VehicleOperation:0
• Miscellaneous •
MaxShieldPoints
*@ShieldPoints
*@ShieldResistance
DeadlyAim:no
RapidShot:no
PointBlankShot:no
PreciseShot:no
Multishot:no
PowerAttack:no
Flurry:no
(Any suspicions about it looking like a Pathfinder based Star Wars game are correct, utilising a rules set I created and am beta-ing.)