Page 1 of 1

GM Notes Style Tag

Posted: Sun Dec 11, 2016 3:53 pm
by Kasuko
Is it possible to specify CSS style in the GM Notes for a stamp on the object or hidden layer when viewed from the token layer?

E.g. I am trying to add nice box text to the notes from Lost Mines of Phandelver

I am setting the GM Notes to

Code: Select all

<style>
.box-text {
  background-color: #EEEEEE;
}
</style>

<p>Whether the characters follow Gundren's map or receive directions to Wave Echo Cave from another source, their initial approach leads them to a narrow tunnel whose entrance is hidden within the Sword Mountain foothills.</p>

<p class="box-text">The entrance tunnel leads into a large-cavern supported by a natural pillar of rock and containing three stalagmites. In the western part of the cave, behind the column ofrock, are three bedrolls and a heap of ordinary supplies-sacks of flour, bags of salt, casks of salted meat, lanterns, flasks of lamp oil, pickaxes, shovels, and other gear. Amid the supplies, you see the body of a dwarf miner, dead for at least a week. The northeastern section of the cavern has collapsed, forming a ten-foot-wide, twenty-foot-deep pit. A sturdy hemp rope is tied off around a nearby stalagmite and dangles down the side of the pit, at the bottom of which is a rough-hewn tunnel heading northwest and east.
</p>

<p>This was the campsite of the Rockseekers. The dead dwarf is Tharden, Gundren's brother, who was killed by the Black Spider. Gundren's other brother, Nundro, was here as well and is currently the Black Spider's prisoner in area 20. The dwarves' supplies are potentially useful, but not particularly valuable. </p>

<p><strong>Open Pit:</strong> Climbing up or down the wall of the pit without a rope requires a successful DC 15 Strength (Athletics) check. A character who fails the check by 5 or more falls and takes Id6 bludgeoning damage per 10 feet fallen, landing prone at the bottom. The tunnel at the bottom of the pit leads northwest toward area 2 and east toward area 3.</p>

<h3 class="">TREASURE</h3>
<p>Tharden wears a pair of boots of striding and springing. In his haste to explore the rest of Wave Echo Cave, Nezznar overlooked them.
</p>
However, I don't see the style, just the text from between the style show up in the note itself.

Am I doing this wrong, or are style tags not allowed? I know I can manually specify the style on the element itself but that's pretty annoying since I am not writing this by hand and I can get the style tags for free but if I want to do more than just the background color keeping track of all the CSS styles on the element will be very annoying, so I am hoping I am just doing something wrong.

Thanks
Kasuko

Re: GM Notes Style Tag

Posted: Mon Dec 12, 2016 12:05 am
by aliasmask
Textboxes have no html or css, but if you were copy the text from the gmnotes to a dialog or frame, then the css should work.

Re: GM Notes Style Tag

Posted: Mon Dec 12, 2016 12:44 am
by JamzTheMan
That's not true actually. I use HTML in my Notes/GM notes in my setup. I haven't used CSS though and that could be a limitation. But if you were to just specify <html> or <font> tags, they will work.

In fact, even the name can have HTML. I use <h2> tags and font=green for the name so, like <h2><font color=green>B4. Torture Chamber (CR5)</font></h2> works (as it also does in the notes.

I add number stamps to the hidden layer with all the room text and It makes for much easier readability on my screen. :)

Re: GM Notes Style Tag

Posted: Mon Dec 12, 2016 12:48 am
by aliasmask
JamzTheMan wrote:That's not true actually. I use HTML in my Notes/GM notes in my setup. I haven't used CSS though and that could be a limitation. But if you were to just specify <html> or <font> tags, they will work.

In fact, even the name can have HTML. I use <h2> tags and font=green for the name so, like <h2><font color=green>B4. Torture Chamber (CR5)</font></h2> works (as it also does in the notes.

I add number stamps to the hidden layer with all the room text and It makes for much easier readability on my screen. :)
I think we may be talking about 2 different things. If I put <html><b>Hello</b></html> in the GM Notes or a token, it shows only the text of the html code. If I print the GM Notes to the chat, dialog or frame, then the html will show the bold Hello from the notes.

Re: GM Notes Style Tag

Posted: Mon Dec 12, 2016 1:41 am
by JamzTheMan
Ok, if you "edit" the token, yes, you see the HTML/source code.

But, if you put said token on the Hidden layer, then hover over/click the stamp/object while on the token layer (what the user is trying to do) you get the text popup is in HTML.
HTML Source
Capture.JPG
Capture.JPG (61.51 KiB) Viewed 1972 times
Results
Capture2.JPG
Capture2.JPG (54.65 KiB) Viewed 1972 times

Note: You can place the style inline and it works. I think that's about the best you can get away with for now...

Code: Select all

<p style=" background-color: #EEEEEE;">The entrance tunnel leads into a large-cavern supported by a natural pillar of rock and containing three stalagmites. In the western part of the cave, behind the column ofrock, are three bedrolls and a heap of ordinary supplies-sacks of flour, bags of salt, casks of salted meat, lanterns, flasks of lamp oil, pickaxes, shovels, and other gear. Amid the supplies, you see the body of a dwarf miner, dead for at least a week. The northeastern section of the cavern has collapsed, forming a ten-foot-wide, twenty-foot-deep pit. A sturdy hemp rope is tied off around a nearby stalagmite and dangles down the side of the pit, at the bottom of which is a rough-hewn tunnel heading northwest and east.
</p>
FYI: I copy/paste all my text from PDF into the GM text and then run a macro to format/replace text to the HTML...

Code: Select all

<!-- Format PDF Text
Jamz: Currently based on the Emerald Spire module
-->
[h: heroLabToken = findToken("herolab")]
[h: levelLetter = getNotes(heroLabToken)]

[h: currentLocations="( " + levelLetter + "[0-9]+)( |\\.|,)"]

[h: pcNotesOrig = getNotes()]
[h: gmNotesOrig = getGMNotes()]
[h: output="Notes Updated:"]
[h: newLine="<br>    "]
 
[h: id = strfind(pcNotesOrig, "(^[A-Z][0-9]+\\. .*?(?=\\n))((\\n|.)*)")]
[h, IF(0<getFindCount(id)),CODE: {
  [h: newName=trim(getGroup(id, 1, 1))]
  [h: pcNotesOrig=trim(getGroup(id, 1, 2))]
  [h: setName(newName)]
  [h: output=output+"<br>Name: "+newName+", "]
}]

[h: pcNotes = replace(pcNotesOrig, "(?<=[^\\.])\\n", " ")]
[h: pcNotes = replace(pcNotes, "\\n", newLine)]
[h: pcNotes = replace(pcNotes, "(DC [0-9]+)", "<FONT COLOR=RED><b>\$1</b></FONT>")]
[h: pcNotes = '<HR><FONT COLOR=GREEN SIZE=5><I>    "' + pcNotes + '"</I></FONT><HR>']

[h: gmNotes = replace(gmNotesOrig, "(?<=[^\\.])\\n", " ")]
[h: gmNotes = replace(gmNotes, "\\n", newLine)]
[h: gmNotes = replace(gmNotes, "(Traps:|Trap:|Creatures:|Creature:|Development:)", "<b>\$1</b>")]
[h: gmNotes = replace(gmNotes, "(DC [0-9]+)", "<FONT COLOR=RED><b>\$1</b></FONT>")]
[h: gmNotes = replace(gmNotes, currentLocations, "<FONT COLOR=PURPLE><b>\$1</b></FONT> ")]
[h: gmNotes = replace(gmNotes, "(Treasure:)", "<FONT COLOR=BLUE><b>\$1</b></FONT>")]
[h: gmNotes = replace(gmNotes, "(Quest:)", "<FONT COLOR=MAROON><b>\$1</b></FONT>")]
[h: gmNotes = replace(gmNotes, "(Story Award:)", "<FONT COLOR=GREEN><b>\$1</b></FONT>")]
[h: gmNotes = "<FONT SIZE=4>    " + gmNotes + "</FONT>"]

[h: setNotes(pcNotes)]
[h: setGMNotes(gmNotes)]

[h: setLayer("HIDDEN")]

{output}
<br><br>
[r: strformat(pcNotes)]
[r: strformat(gmNotes)]

Re: GM Notes Style Tag

Posted: Mon Dec 12, 2016 1:53 am
by aliasmask
Ah, yeah, you're right. I wasn't thinking about the popup.

Re: GM Notes Style Tag

Posted: Fri Aug 16, 2019 3:42 am
by PinkRose
I would love for this to work, Jamz.
But I get the error
Error executing "getNotes": the token name or id "" is unknown.

How do I proceed?

Re: GM Notes Style Tag

Posted: Fri Aug 16, 2019 3:53 am
by aliasmask
You'll have to use the correct id for the token you want to get the notes from.

Re: GM Notes Style Tag

Posted: Fri Aug 16, 2019 2:14 pm
by Phergus
PinkRose - You probably didn't set the macro to Apply To Selected.