Images as tooltips on images in chat - can it be done?

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
bubblobill
Giant
Posts: 167
Joined: Sun Jan 24, 2010 3:07 pm

Images as tooltips on images in chat - can it be done?

Post by bubblobill »

I have been bashing my head against this for about five hours, so now I turn to you.

What I am trying to achieve is something like this.
In chat:
My PC does this awesome thing using this card -->(small picture of power card)
My PC does this awesome thing using this card --> *mousehover for big

Now I want the picture of the card to be a small rendering of the card, and on hover, have the fill-size image of the card show as a tooltip.

I can get the resized image in chat, I can get images in tooltips, but I cannot get tooltips on images.
I suspect I am a victim of the alt= component of the image tag.
Am I right that the alt= predefines a text only tooltip that overrides whatever I want? Can I work around it?

Dr Bubb
Bubblobill on the forum.
@Reverend on the MapTool Discord Server

Responsible for less atrocities than most... I do accept responsibility for these though: SmartDoors, Simple d20 Framework - barebones, Drop-in: All 3.5 SRD Monsters, Drop in: Simple Character Editor, Battletech Framework

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Images as tooltips on images in chat - can it be done?

Post by aliasmask »

Tooltip text is a little tricky. You have to surround the text with <html>...</html> for it to process html like an image tag. Also, use " instead of " inside, for example:

Code: Select all

[H: img = getImage(imageName)]
[H: tip = strformat('<html><img src="%{img}" height="400" width="400" /></html>')]
[H: tip = replace(tip,'"',"%quot;")]
[R: strformat('<img src="%{img}" height="50" width="50" alt="%{tip}">')] 

User avatar
bubblobill
Giant
Posts: 167
Joined: Sun Jan 24, 2010 3:07 pm

Re: Images as tooltips on images in chat - can it be done?

Post by bubblobill »

Thanks heaps for the assist, but it did not fly.

although it is much closer than I have managed to get so far.

The tooltip does appear, but it does so with a broken image icon.

Thus:
Broken img link
Broken img link
Untitled.png (4.47 KiB) Viewed 1262 times
Still beating my head around it fruitlessly.
Bubblobill on the forum.
@Reverend on the MapTool Discord Server

Responsible for less atrocities than most... I do accept responsibility for these though: SmartDoors, Simple d20 Framework - barebones, Drop-in: All 3.5 SRD Monsters, Drop in: Simple Character Editor, Battletech Framework

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Images as tooltips on images in chat - can it be done?

Post by aliasmask »

I'll check the code, could be something minor. I think it has something to do with the \\ in the asset link and how strformat processes it.

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Images as tooltips on images in chat - can it be done?

Post by aliasmask »

Hmm, I'm sure this worked before, but after changing the quotes I got it to work.

Code: Select all

[H: img = getImage(tokenName)]
[H: tip = strformat("<html><img src='%{img}' height='400' width='400'></html>")]
[R: strformat('<img src="%{img}" height="50" width="50" alt="%{tip}">')]  

User avatar
bubblobill
Giant
Posts: 167
Joined: Sun Jan 24, 2010 3:07 pm

Re: Images as tooltips on images in chat - can it be done?

Post by bubblobill »

Win!

I thought I had tried every possible combination between ' and " but apparently not.

+1 vote for Aliasmask's godhood.

You rock
Bubblobill on the forum.
@Reverend on the MapTool Discord Server

Responsible for less atrocities than most... I do accept responsibility for these though: SmartDoors, Simple d20 Framework - barebones, Drop-in: All 3.5 SRD Monsters, Drop in: Simple Character Editor, Battletech Framework

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Images as tooltips on images in chat - can it be done?

Post by aliasmask »

Something's been bugging me about my first post that didn't work, so I went back and found what I did wrong. I put % instead of & when using the quote entity, oops.

Code: Select all

[H: img = getImage(tokenName)]
[H: tip = strformat('<html><img src="%{img}" height="400" width="400" /></html>')]
[H: tip = replace(tip,'"',""")]
[R: strformat('<img src="%{img}" height="50" width="50" alt="%{tip}">')] 

Post Reply

Return to “Macros”