Page 1 of 1

[MOD] Mod Report (MT1.3b82 r01) [Last update: 12/05/11]

Posted: Sun Apr 03, 2011 8:36 pm
by aliasmask
Here's a new mod for Mod Report, which is actually the ConditionReport macro.
  • Output is sorted, shows the token state images in the tooltips.
  • The "conditions" have been reformatted an include a tool tip.
  • Everything is on it's own line and in a table.
  • Items or mods with states, if active, are set in case they get turned off manually or through some other method.
  • All mods appears in a thin border box with header.
||| ConditionReport |||

Code: Select all

@@ @ConditionReport
[H: output = "" ]
[H: gTok = "Lib:GlobalsSRDPF" ]
[H: jTM = getLibProperty( "TempModToggleSets", gTok ) ]
[H: atms = json.get( PrivateJSON, "ActiveTempModSets" ) ]
[H, IF( json.isEmpty( atms ) ): activeMSList = ""; activeMSList = json.toList( json.unique( atms ) ) ]
[H: jPTM= json.get( PrivateJSON, "CustomModSetValues") ]

[H, FOREACH( m, activeMSList ), CODE: {
   [IF( json.isEmpty( jPTM ) ): jPM = ""; jPM = json.get( jPTM, m ) ]
   [IF( json.isEmpty( jPM ) ): tTip = json.get( json.get( jTM, m ), "tip" );tTip = json.get( jPM, "tip" ) ]
   [ tCat = json.get( json.get( jTM, m ), "cat" )]
   [ tState = json.get( json.get( jTM, m), "state")]
   [H, if(tState != "NA"), code: {
      [H: setState(tState,1)]
      [H: stateImage = strformat("<img src='%s' width=50 height=50>",getStateImage(tState))]
   };{
      [H: stateImage = " "]
   }]      
   [IF(tCat == ""): tCat = "Mod"]
   [H: tTip = strformat('<span title="<html><table><tr valign=top><td>%{stateImage}</td><td>%{tTip}</td></tr></table></html>">%{m}</span>')]
   [H: output = json.append(output,strformat('<tr id="%s"><td style="padding: 0px 2px 0px 5px;text-align:right" NOWRAP><b>%{tCat}:</b></td><td style="padding-right: 5px">%{tTip}</td></tr>',replace(lower(tCat+m),"[^a-z0-9._]","")))]
}]
[H: aitems = json.get( PrivateJSON, "ActiveItems" ) ]
[H, IF( json.isEmpty( aitems ) ): activeMSList = ""; activeMSList = json.toList( json.unique( aitems ) ) ]

[H, FOREACH( m, activeMSList ), CODE: {
   [IF( json.isEmpty( jPTM ) ): jPM = ""; jPM = json.get( jPTM, m ) ]
   [IF( json.isEmpty( jPM ) ): tTip = json.get( json.get( BonusTypedItems, m ), "tip" );tTip = json.get( jPM, "tip" ) ]
   [ tCat = json.get( json.get( BonusTypedItems, m ), "cat" )]
   [ tState = json.get( json.get( BonusTypedItems, m), "state")]
   [H, if(tState != "NA"), code: {
      [H: setState(tState,1)]
      [H: stateImage = strformat("<img src='%s' width=50 height=50>",getStateImage(tState))]
   };{
      [H: stateImage = " "]
   }]      
   [IF(tCat == "" || tCat == "Misc"): tCat = "Item"]
   [H: tTip = strformat('<span title="<html><table><tr valign=top><td>%{stateImage}</td><td>%{tTip}</td></tr></table></html>">%{m}</span>')]
   [H: output = json.append(output,strformat('<tr id="%s"><td style="padding: 0px 2px 0px 5px;text-align:right" NOWRAP><b>%{tCat}:</b></td><td style="padding-right: 5px">%{tTip}</td></tr>',replace(lower(tCat+m),"[^a-z0-9._]","")))]
}]

[H: numConditions = tbl("Conditions",0)]
[H, for(i,0,numConditions), code: {
   [H: conditionStr = tbl("Conditions",i + 1)]
   [H: curState = listGet(conditionStr,0,";")]
   [H, if(getState(curState)), code: {
      [H: conditionText = replace(listGet(conditionStr,1,";"),"%","%%")]
      [H: stateImage = "'"+getStateImage(curState)+"'"]
      [H: tTip = strformat('<span title="<html><table><tr valign=top><td><img src=%{stateImage} width=50 height=50></td><td>%{conditionText}</td></tr></table></html>">%{curState}</span>')]
      [H: output = json.append(output,strformat('<tr id="state%s"><td style="padding: 0px 2px 0px 5px;text-align:right" NOWRAP><b>State:</b></td><td style="padding-right: 5px">%{tTip}</td></tr>',lower(curState)))]
   };{}]
}]

[H: output = json.sort(output,"a")]
[R,S: '<table style="background-color:black"><tr><td style="padding:1pt"><table style="background-color:white"><tr><th colspan=2 style="color:blue;text-align:center">Mod Report</th></tr>' + json.toList(output,"") + "</table></td></tr></table>"]

!!
- Updated (12/05/11)

Re: [MOD] Mod Report (MT1.3b82 r01)

Posted: Sun Apr 03, 2011 8:55 pm
by neofax
I so wish the states showed up in the header of the character sheet as images as well. Would really love them to show up on the mouse over sheet.

Re: [MOD] Mod Report (MT1.3b82 r01)

Posted: Sun Apr 03, 2011 9:35 pm
by aliasmask
Character sheet wouldn't be a problem, but I don't think images work on mouseover sheet.

Re: [MOD] Mod Report (MT1.3b82 r01)

Posted: Thu Apr 28, 2011 2:35 pm
by Elorebaen
Nice and neat, I like it!

Re: [MOD] Mod Report (MT1.3b82 r01)

Posted: Thu Jun 30, 2011 10:08 am
by lmarkus001
Incorporated, thanks!

Re: [MOD] Mod Report (MT1.3b82 r01)

Posted: Thu Jun 30, 2011 2:38 pm
by aliasmask
Cool.

I was looking at my code again and for a sec I couldn't understand why I put id= in the <tr> of the output... until I realized I did that for the sort feature so the beginning of the strings are always the same except the condition name. Also, the name had to be in quotes and as part of a option variable.

Re: [MOD] Mod Report (MT1.3b82 r01)

Posted: Thu Jun 30, 2011 2:55 pm
by lmarkus001
I was toying with the idea of a full mod table for the report, but then that might be better for an additional page on the character sheet.

Code: Select all

                STRmod DEXmod etc...
Modname (Shaken)  -2    -2    etc...
Modname2           1
etc...

TOTAL             -1    -2
Could show the type in a tool tip and only show columns for items that are actually modded.

Re: [MOD] Mod Report (MT1.3b82 r01)

Posted: Thu Jun 30, 2011 3:02 pm
by aliasmask
lmarkus001 wrote:I was toying with the idea of a full mod table for the report, but then that might be better for an additional page on the character sheet.

Code: Select all

                STRmod DEXmod etc...
Modname (Shaken)  -2    -2    etc...
Modname2           1
etc...

TOTAL             -1    -2
What would the "Total" represent? Combat mods? Or will you list totals for things like stats, saves, AC...? I would say a new page on character sheet if doing it that way. But really, you could have it in both places. Just make one macro that builds the output, then you can output it as a tool tip or to its own page.

Re: [MOD] Mod Report (MT1.3b82 r01) [Last update: 12/05/11]

Posted: Mon Dec 05, 2011 5:15 pm
by aliasmask
I made a minor update adding NOWRAP to the first column for the category names.