[STAT SHEET] Alternate View (update 3/25/13)

Discussion concerning lmarkus' campaign framework for D&D3.x and Pathfinder.

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

Forum rules
Discussion regarding lmarkus001's framework only. Other posts deleted without notice! :)
User avatar
aliasmask
Deity
Posts: 8579
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

[STAT SHEET] Alternate View (update 3/25/13)

Post by aliasmask »

I tweaked the stat sheet properties for DnD35 to be more compact and added a couple of extras in there. All you have to do is put this at the top and then go through the rest of properties and remove the * and *@. Also, delete any duplicates like Languages,MoveRemain,AC,AllSaves and SaveMisc (basically anything that doesn't start with "sheet.". When fiddling with the token type variables, I would save a backup first before committing to the changes just in case something is messed up or you don't like it.

The same can be done for the Pathfinder token type with a minor adjustment to AC name.

Code: Select all

*@sheet.creature (Creature):[r: strformat("%{CreatureType} (%{LevelsInfo})")]
*@Languages:[R: json.get(getProperty("Race"), "notes")]
*@sheet.hpstatus (Hit Points):[r: strformat("%s/%s%s",HP+HPtemp-HPNonLethalDMG,HPmax,if(HPtemp || HPNonLethalDMG," (+"+HPtemp+"/-"+HPNonLethalDMG+")",""))]
*sheet.distance (Distance):[R: distanceStatSheet(currentToken())]
*sheet.appearance (Appearance)
*sheet.moveReach (Tactical):[r: strformat("Move:%{Movement} Reach:%{Reach} Elev:%{Elevation}")]
*@MoveRemain
*AC (AC/TH/FF)
*@sheet.specialA (Attacks):[r, if(SpecialATK == "NA" || SpecialATK == ""): ""; substring(SpecialATK,0,min(length(SpecialATK),50))]
*@sheet.specialD (Defenses):[r, if(SpecialQual == "NA" || SpecialQual == ""):""; substring(SpecialQual,0,min(length(SpecialQual),50))]
*@sheet.resistances (Resistances):[r, if(! json.isEmpty(spellResistance)): "SR: "+spellResistance+" "][r, if(! json.isEmpty(DR)): "DR: "+DR]
*@sheet.physical (Body):[R: strformat("Str:%s(%+d) Dex:%s(%+d) Con:%s(%+d)",Strength+StrMod,StrB,Dexterity+DexMod,DexB,Constitution+ConMod,ConB)]
*@sheet.mental (Mind):[R: strformat("Int:%s(%+d) Wis:%s(%+d) Chr:%s(%+d)",Intelligence+IntMod,IntB,Wisdom+WisMod,WisB,Charisma+ChaMod,ChaB)]
*@AllSaves (Saves):[R: strformat("Fort:%+d Ref:%+d Will:%+d",Fort+ConB+FortBonus,Reflex+DexB+ReflexBonus,Will+WisB+WillBonus)]
*@SaveMisc


Add this function to your Lib:libDnD35Pathfinder token as "distanceStatSheet" and make sure to uncheck "Player Editable" in options.

Code: Select all

<!-- distanceStatSheet(currentToken): distance token list -->
<!-- created by AM, modified by W42 -->
[H: sheet.target        = arg(0)]
[H: sheet.source        = getSelected()]
[H: sheet.doDistance    = if(listCount(sheet.source) > 0 && sheet.target != sheet.source,1,0)]
[h: sheet.output        = ""]

[H, if(sheet.doDistance), CODE:{
    [foreach(tok, sheet.source): sheet.output = listAppend(sheet.output,strformat("%s (%s)",getName(tok),getDistance(sheet.target,1,tok)))]
};{}]

[H: macro.return        = sheet.output]

Code: Select all

<!-- onCampaignLoad -->
[H: defineFunction("distanceStatSheet","[email protected]"+getMacroLocation(),1)]

*Updated Above Code - Apparently there was a permissions problem with players for distance macro, so I created a UDF on the core token.

The main reason I did this is to avoid the statsheet from covering up the majority of the screen when special abilities are too long. The above limits the output to 50 characters. If that line is really important to you and you would like to list more, then I have an update for additional lines for special abilities and special defenses upon request.

I put a line in there for appearance, in case gm wants to list token's armor type, weapon and shield. I added a Distance tool. If you select a token, any other token will tell you the distance to the selected token. I combined the reach, movement and elevation in to one line called Tactical. HP are displayed as "current/max (temp/nonlethal)" where current is your effective hit points (+temp,-nonlethal). The rest is just formatting preference for me.

edit: Modified by Wolph42 to actually work :| and list all selected token distances on moused over targets.

User avatar
wolph42
Deity
Posts: 9706
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [STAT SHEET] Alternate View

Post by wolph42 »

you made a small mistake in the macro:

this line:

Code: Select all

[H: sheet.doDistance   = if(listCount(sheet.target) == 1 && sheet.target != sheet.source && sheet.source != "",1,0)]

should be:

Code: Select all

[H: sheet.doDistance   = if(listCount(sheet.source) == 1 && sheet.target != sheet.source,1,0)]


you *can* select multiple targets, but you *can't* hover over multiple targets

also the name of the 'hovered' token is shown, my guess is that you should show the name of the selected token... and while I was at it, this works with multiple selected tokens:

Code: Select all

[h:'<!-- ------------------------------- distanceStatSheet --------------------------------------------- -->']
<!--
 created by AM, improved by W42 -->
[
H: sheet.target        = arg(0)]
[
H: sheet.source        = getSelected()]
[
H: sheet.doDistance    = if(listCount(sheet.source) > 0 && sheet.target != sheet.source,1,0)]
[
h: sheet.output        = ""]

[
H, if(sheet.doDistance), CODE:{
    [foreach(tok, sheet.source): sheet.output = listAppend(sheet.output,strformat("%s (%s)",getName(tok),getDistance(sheet.target,1,tok)))]
};{}]

[
H: macro.return        = sheet.output]
 

User avatar
aliasmask
Deity
Posts: 8579
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: [STAT SHEET] Alternate View

Post by aliasmask »

The first one was when I was selecting multiple tokens and needed to have a blank check, but that's not needed in the second version, so it's okay to remove that check. The name is also from when I had multiple tokens selected, so that's not needed either. After changing the mechanic of the code from the 1st incarnation, those 2 bits didn't really matter.

User avatar
wolph42
Deity
Posts: 9706
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [STAT SHEET] Alternate View

Post by wolph42 »

aliasmask wrote:The first one was when I was selecting multiple tokens and needed to have a blank check, but that's not needed in the second version, so it's okay to remove that check. The name is also from when I had multiple tokens selected, so that's not needed either. After changing the mechanic of the code from the 1st incarnation, those 2 bits didn't really matter.


It was not only the check. You also checked the wrong variable and it resulted in an error. If you implement your code as Is it renders an error when two tokens are selected.

User avatar
aliasmask
Deity
Posts: 8579
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: [STAT SHEET] Alternate View

Post by aliasmask »

I see. Thanks for the update. I actually do like listing the selected targets better. That could be useful to determine who in a group is 30ft apart or more.

User avatar
Sereptus
Giant
Posts: 122
Joined: Tue Jun 07, 2011 12:08 pm
Location: Canada

Re: [STAT SHEET] Alternate View (update 3/25/13)

Post by Sereptus »

I realize this is an old post but I was wondering if there was a way to reduce the number of lettering (characters) in the stat sheet output on mouse over?

I tried this in my NPC properties but it didn't work;

*@Resistance:[min(length(Resistance),30)]

Because some of the NPCs have a LOT of resistances etc. and it takes up the whole screen, also, could I not have it continue on the next line to keep the mouse over more compact and not soooo wide?

Acid, cold, fire, lightning, thunder, bludgeoning, piercing, and slashing from nonmagical weapons.

Thanks guys!
OOOHH RegEx....YOU BITTER-SWEET BEAST!!!

bobifle
Giant
Posts: 217
Joined: Thu Oct 19, 2017 12:36 pm

Re: [STAT SHEET] Alternate View (update 3/25/13)

Post by bobifle »

Try

Code: Select all

*@dResistance (Resistance):{substring(Resistance, 0, 30)}

User avatar
Sereptus
Giant
Posts: 122
Joined: Tue Jun 07, 2011 12:08 pm
Location: Canada

Re: [STAT SHEET] Alternate View (update 3/25/13)

Post by Sereptus »

bobifle wrote:Try

Code: Select all

*@dResistance (Resistance):{substring(Resistance, 0, 30)}


That did not work, had to shut down for error loop. :?

Edit- I tried inserting it without the d before *@dResistance as I thought that might be a typo. Didn't cause a crash this time but didn't work either :?

Edit- This didn't work either :? *@Resistance (Resistance):{substring(Resistance, 0,min(length(Resistance), 30))}
Last edited by Sereptus on Thu Nov 23, 2017 5:44 pm, edited 1 time in total.
OOOHH RegEx....YOU BITTER-SWEET BEAST!!!

User avatar
aliasmask
Deity
Posts: 8579
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: [STAT SHEET] Alternate View (update 3/25/13)

Post by aliasmask »

dResistance is the variable name and Resistance is the alias for the stat sheet.

User avatar
Sereptus
Giant
Posts: 122
Joined: Tue Jun 07, 2011 12:08 pm
Location: Canada

Re: [STAT SHEET] Alternate View (update 3/25/13)

Post by Sereptus »

aliasmask wrote:dResistance is the variable name and Resistance is the alias for the stat sheet.


Ok, but I'm no further ahead! :P

Sorry guys, haven't spent a lot of time fleshing out the stat sheet nuances but it looks like I'm about to get a learning curve. I'll look into it further.
OOOHH RegEx....YOU BITTER-SWEET BEAST!!!

User avatar
aliasmask
Deity
Posts: 8579
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: [STAT SHEET] Alternate View (update 3/25/13)

Post by aliasmask »

Code: Select all

*@sheet.Resistance(Resistance):[r: if(! json.isEmpty(Resistance)): substring(Resistance,0,min(length(Resistance),30)); ""]


Where "Resistance" is the string where you hold the Resistance info. I use sheet.Resistance to hold the modified version of resistance where the max length is 30 characters. If it's empty, then nothing is shown.

User avatar
Sereptus
Giant
Posts: 122
Joined: Tue Jun 07, 2011 12:08 pm
Location: Canada

Re: [STAT SHEET] Alternate View (update 3/25/13)

Post by Sereptus »

aliasmask wrote:

Code: Select all

*@sheet.Resistance(Resistance):[r: if(! json.isEmpty(Resistance)): substring(Resistance,0,min(length(Resistance),30)); ""]


Where "Resistance" is the string where you hold the Resistance info. I use sheet.Resistance to hold the modified version of resistance where the max length is 30 characters. If it's empty, then nothing is shown.


Ok thanks AM, I see now, I got it working but I had to change the r: to an r, and I've also decided that 30 is a little short and will bump it to 40 or 50.

It would be interesting to know if you could "expand" the line it's written into two lines. I suppose I could change the RegEx in my importer to separate the groups I'm capturing into separate properties i.e. Resist1, Resist2 etc. Come to think of it, there's probably a lot of ways of achieving this. Hope I won't have to go back and change the 100 or so tokens I've already done! :roll:

Thanks for clearing that up for me!
OOOHH RegEx....YOU BITTER-SWEET BEAST!!!

User avatar
aliasmask
Deity
Posts: 8579
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: [STAT SHEET] Alternate View (update 3/25/13)

Post by aliasmask »

Oops, my bad. I added the if in later as a second thought and didn't change the : to a ,.

Yeah, you can add more lines. I do this in my PF framework:

Code: Select all

*@sheet.specialA (Attacks):[r, if(SpecialATK == "NA" || SpecialATK == ""): ""; substring(SpecialATK,0,min(length(SpecialATK),50))]
*@sheet.specialA2 (A -):[r, if(SpecialATK == "NA" || SpecialATK == "" || length(SpecialATK) <= 50): ""; substring(SpecialATK,50,min(length(SpecialATK),100))]
*@sheet.specialA3 (A --):[r, if(SpecialATK == "NA" || SpecialATK == "" || length(SpecialATK) <= 100): ""; substring(SpecialATK,100,min(length(SpecialATK),150))]

User avatar
Sereptus
Giant
Posts: 122
Joined: Tue Jun 07, 2011 12:08 pm
Location: Canada

Re: [STAT SHEET] Alternate View (update 3/25/13)

Post by Sereptus »

I'm now assuming that Maptool property values do not like a space,

Code: Select all

Condition Immunities:()
*@sheet.Condition Immunities (Condition Immunities):[r, if(! json.isEmpty(Condition Immunities)): substring(Condition Immunities,0,min(length(Condition Immunities),50)); ""]


This does not work. and this does...

Code: Select all

Resistance:()
*@sheet.Resistance (Resistance):[r, if(! json.isEmpty(Resistance)): substring(Resistance,0,min(length(Resistance),50)); ""]


It just ends up showing me; [r, if(! json.isEmpty(Condition Immunities)): substring(Condition Immunities,0,min(length(Condition Immunities),50)); ""]
in the stat sheet line.
OOOHH RegEx....YOU BITTER-SWEET BEAST!!!

User avatar
aliasmask
Deity
Posts: 8579
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: [STAT SHEET] Alternate View (update 3/25/13)

Post by aliasmask »

Yes, a token property is a variable and has to follow variable naming rules if you want to reference them as such. You can make the alias name with a space though because it's only for display.

Post Reply

Return to “[D&D3.5 + Pathfinder] Campaign Macros”