HTML Question

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

Post Reply
User avatar
mfrizzell
Dragon
Posts: 762
Joined: Sat Feb 13, 2010 2:35 am
Location: California

HTML Question

Post by mfrizzell »

Is it possible to use the following type of command in Maptool. background-image.
If so how would you go about doing it.
I would like to use an image of old paper as the background in a frame with the text written over the top of it.

Thanks
DCI/RPGA# 7208328396 Skype ID mfrizzell77
Characters:
Strabor - Dwarf Avenger 5th Level
Tikkanan - Human Warlock 2nd Level
----------------------------------------------------
"People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs."

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

Re: HTML Question

Post by aliasmask »

Just use CSS and put the paper as a token somewhere on any map. You can put in a table or in a div.

Code: Select all

[H: bgImage = getImage("image:oldPaper")]
[H: text = "whatever"]
[H: text = replace(text,'"',""")]
[H: output = '<div width="400" style="background-image:url(' + stformat("'%{bgImage}'") + '">' + string(text) + "</div>"]
<!-- you may want to play with frame settings -->
[R, dialog("MyFrame","width=415;height=300;"): { [R: output] }]


Here's another example I use in my code:

Code: Select all

[H: output = strformat('
   <table style="padding:0px;border-style:solid;border-width:0pt;background-image:url(%{bgImage});background-color:%{bgColor};" width="100%">
      <tr style="padding:0px;border-style:solid;border-width:1pt;" valign=top>
         <td width="40" style="padding-right: 5px"><img src="%{tokenImage}-50" alt="%{playerName}" /></td>
         <td style="margin-right: 5px;" width="100%"><span id="icc">%{chatText}</span></td>
      </tr>
   </table>
')]

User avatar
mfrizzell
Dragon
Posts: 762
Joined: Sat Feb 13, 2010 2:35 am
Location: California

Re: HTML Question

Post by mfrizzell »

Thanks AM I'll give that a try asap.
DCI/RPGA# 7208328396 Skype ID mfrizzell77
Characters:
Strabor - Dwarf Avenger 5th Level
Tikkanan - Human Warlock 2nd Level
----------------------------------------------------
"People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs."

User avatar
mfrizzell
Dragon
Posts: 762
Joined: Sat Feb 13, 2010 2:35 am
Location: California

Re: HTML Question

Post by mfrizzell »

Hmm. I get an error when I try the first method. I put an oldPaper token on the map with the name of Image:oldPaper. When I run the first method in the chat window it gives me the following error.

Code: Select all

java.util.EmptyStackException
   at java.util.Stack.peek(Unknown Source)
   at javax.swing.text.DefaultStyledDocument$ElementBuffer.insertElement(Unknown Source)
   at javax.swing.text.DefaultStyledDocument$ElementBuffer.insertUpdate(Unknown Source)
   at javax.swing.text.DefaultStyledDocument$ElementBuffer.insert(Unknown Source)
   at javax.swing.text.DefaultStyledDocument.insert(Unknown Source)
   at javax.swing.text.html.HTMLDocument.insert(Unknown Source)
   at javax.swing.text.html.HTMLDocument$HTMLReader.flushBuffer(Unknown Source)
   at javax.swing.text.html.HTMLDocument$HTMLReader.flush(Unknown Source)
   at javax.swing.text.html.HTMLDocument.insertHTML(Unknown Source)
   at javax.swing.text.html.HTMLDocument.insertBeforeEnd(Unknown Source)
   at net.rptools.maptool.client.ui.commandpanel.MessagePanel$5.run(MessagePanel.java:230)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$400(Unknown Source)
   at java.awt.EventQueue$2.run(Unknown Source)
   at java.awt.EventQueue$2.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at net.rptools.maptool.client.swing.MapToolEventQueue.dispatchEvent(MapToolEventQueue.java:36)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)


The second method looks dependent on some of the code from the first method. Not sure if it's meant a a direct replacement for this line or not.

[H: output = '<div width="400" style="background-image:url(' + stformat("'%{bgImage}'") + '">' + string(text) + "</div>"]

Clarification would be much appreciated. Thank you.
DCI/RPGA# 7208328396 Skype ID mfrizzell77
Characters:
Strabor - Dwarf Avenger 5th Level
Tikkanan - Human Warlock 2nd Level
----------------------------------------------------
"People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs."

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

Re: HTML Question

Post by aliasmask »

The quotes were mixed up, but I tested this and it worked.

Code: Select all

[H: bgImage = getImage("image:oldPaper")]
[H: text = "whatever"]
[H: output = strformat('<div width="400" style="background-image:url(%{bgImage})">%{text}</div>')]
<!-- you may want to play with frame settings -->
[R, dialog("MyFrame","width=415;height=300;"): { [R: output] }]

User avatar
mfrizzell
Dragon
Posts: 762
Joined: Sat Feb 13, 2010 2:35 am
Location: California

Re: HTML Question

Post by mfrizzell »

Thanks AM that works sort of. I probably wasn't clear. I was looking to completely fill the background with the image and then be able to cover it with writing. As it stands it seems to only reveal the background as you put text up. I would like to be able to use other macros to generate writing including token properties etc.

Here is an example of what I'm looking for.
http://www.w3schools.com/cssref/tryit.a ... ound-image

Thanks.
DCI/RPGA# 7208328396 Skype ID mfrizzell77
Characters:
Strabor - Dwarf Avenger 5th Level
Tikkanan - Human Warlock 2nd Level
----------------------------------------------------
"People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs."

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

Re: HTML Question

Post by aliasmask »

You can set the background image in the body tag then rather than a div or table.

User avatar
mfrizzell
Dragon
Posts: 762
Joined: Sat Feb 13, 2010 2:35 am
Location: California

Re: HTML Question

Post by mfrizzell »

Ah thank you thank you thank you.
DCI/RPGA# 7208328396 Skype ID mfrizzell77
Characters:
Strabor - Dwarf Avenger 5th Level
Tikkanan - Human Warlock 2nd Level
----------------------------------------------------
"People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs."

User avatar
mfrizzell
Dragon
Posts: 762
Joined: Sat Feb 13, 2010 2:35 am
Location: California

Re: HTML Question

Post by mfrizzell »

Is there an example you can give me that does not include the use of strformat? I lack the skills to roll up all of my output into a concise package.
DCI/RPGA# 7208328396 Skype ID mfrizzell77
Characters:
Strabor - Dwarf Avenger 5th Level
Tikkanan - Human Warlock 2nd Level
----------------------------------------------------
"People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs."

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

Re: HTML Question

Post by aliasmask »

Code: Select all

<body style="background-image:url([r: getImage("image:oldPaper")])">
...
</body>

User avatar
mfrizzell
Dragon
Posts: 762
Joined: Sat Feb 13, 2010 2:35 am
Location: California

Re: HTML Question

Post by mfrizzell »

Thank you very much.
DCI/RPGA# 7208328396 Skype ID mfrizzell77
Characters:
Strabor - Dwarf Avenger 5th Level
Tikkanan - Human Warlock 2nd Level
----------------------------------------------------
"People are more violently opposed to fur than leather because it's safer to harass rich women than motorcycle gangs."

Post Reply

Return to “Macros”