Tooltips for roll expansion
Moderators: dorpond, trevor, Azhrei
Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior.
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior.
- Mr. Pokeylope
- Giant
- Posts: 118
- Joined: Mon Aug 11, 2008 9:24 pm
Tooltips for roll expansion
My group and I have been wanting a way to keep macro output concise while still being able to see detailed roll breakdowns. To that end, I added tooltip support to the message frame and added a new syntax for rolls. (I submitted a patch to Trevor a few days ago but haven't heard back; I assume he's still getting his donkey kicked by real life.)
In addition to using [ ] and { } for rolls, I added [[ ]]. When you use the new syntax, the expansion only shows the output, just like when using { } (except it's colored blue). However, when you mouseover that value, it'll display a tooltip showing the complete expansion of the roll like what [ ] would output. You can also display arbitrary tooltips: <span title="foo">bar</span> will display the text "bar" and, when you hover over it, a tooltip showing "foo".
So, hopefully people will find this useful. If you've got any feedback, think the syntax sucks, whatever, please let me know.
In addition to using [ ] and { } for rolls, I added [[ ]]. When you use the new syntax, the expansion only shows the output, just like when using { } (except it's colored blue). However, when you mouseover that value, it'll display a tooltip showing the complete expansion of the roll like what [ ] would output. You can also display arbitrary tooltips: <span title="foo">bar</span> will display the text "bar" and, when you hover over it, a tooltip showing "foo".
So, hopefully people will find this useful. If you've got any feedback, think the syntax sucks, whatever, please let me know.
Can't wait to try it. Hope it makes b41. That means I'll have to change all my macros, but I can deal with that. The arbitrary tooltips part is a bit confusing though. Would you type [[<span title="foo">bar</span>]] to get bar (with float over foo), cause normally you wouldn't enclose that sort of thing. There might be an issue with getting useless things in the float-over command area, like it telling you the color when you could care less. I don't think I'd ever use the <span title=> method, but maybe other people would? There is really no reason to use it for hidden calculations now that HTML commenting is more popular <!--roll=[1d20]-->. Would HTML comments be floatable also?
Quote from an underwater D&D fight:
Alright fighter, it's your turn. What do you do?
Fighter: What do you think I do? I FAIL MY F**KING SWIM CHECK
Alright fighter, it's your turn. What do you do?
Fighter: What do you think I do? I FAIL MY F**KING SWIM CHECK
- Mr. Pokeylope
- Giant
- Posts: 118
- Joined: Mon Aug 11, 2008 9:24 pm
The <span title="whatever"> is seperate from the [[ ]] syntax (and behind the scenes, the latter is implemented using the former). So just typing will give you the text with tooltip, while typing will give you, say, the text "14", and when you hover over it you'll get a tooltip displaying "d20 + StrBonus = 11 + 3".
You wouldn't be able to use this to display the contents of HTML comments, since they're removed from the output completely. Although you could use it as an alternative to comments, like: i.e. display some small amount of text that had a tooltip showing the hidden calculations.
Code: Select all
<span title="This is a tooltip!">Some text here</span>
Code: Select all
[[d20 + StrBonus]]
You wouldn't be able to use this to display the contents of HTML comments, since they're removed from the output completely. Although you could use it as an alternative to comments, like:
Code: Select all
<span title="[roll = d20]">*</span>
- UntoldGlory
- Great Wyrm
- Posts: 1649
- Joined: Sun Mar 16, 2008 8:12 pm
- UntoldGlory
- Great Wyrm
- Posts: 1649
- Joined: Sun Mar 16, 2008 8:12 pm
- Mr. Pokeylope
- Giant
- Posts: 118
- Joined: Mon Aug 11, 2008 9:24 pm
I did initially just modify { }, but there are circumstances in which you don't want the full expansion (sometimes it's just not necessary, sometimes you don't want the expression to be visible—for example, DMs may want to display results without exposing all of an NPC's modifiers). Also, by creating new syntax for this, we maintain backwards compatibility; any existing macros will continue to work as they do now without modification.
Makes perfect sense. I'd vote for this!Aria wrote:Why not just make the { } braces do the tooltip expanded roll? I don't see a need to add a third syntax for this.
D&D qualities are related inversely to those of Poker... and I love both.
http://www.yorkpoker.co.uk
http://www.yorkpoker.co.uk
I would say that more often than not you'd want the expansion. . . why not make { } for the tooltop and {{}} for the roll w/o the tooltip?Mr. Pokeylope wrote:I did initially just modify { }, but there are circumstances in which you don't want the full expansion (sometimes it's just not necessary, sometimes you don't want the expression to be visible—for example, DMs may want to display results without exposing all of an NPC's modifiers). Also, by creating new syntax for this, we maintain backwards compatibility; any existing macros will continue to work as they do now without modification.
- Naryt
- Dragon
- Posts: 517
- Joined: Fri Oct 26, 2007 8:55 am
- Location: Near a tree, in a cave, under a rock.
In cases where I don't want full expansion available, I'd just use the current <!-- [finalroll=blah] -->{finalroll} method.Mr. Pokeylope wrote:I did initially just modify { }, but there are circumstances in which you don't want the full expansion (sometimes it's just not necessary, sometimes you don't want the expression to be visible—for example, DMs may want to display results without exposing all of an NPC's modifiers). Also, by creating new syntax for this, we maintain backwards compatibility; any existing macros will continue to work as they do now without modification.
A wandering lost soul
- Brigand
- Read-only User
- Posts: 1623
- Joined: Thu Feb 14, 2008 8:57 am
- Location: Nosy GM's can go frak themselves!
How about { } = Tooltip, for use by players and GM's and [[ ]] is for GM's who don't want to expose the npc's stats?
Actually, making { } show the tooltip would be better for backwards compatibility, because this would mean all the macro's currently being used by players, would not have to be changed. Players are the ones who really need the tooltip, so that the GM can be sure the player isn't cheating.Also, by creating new syntax for this, we maintain backwards compatibility; any existing macros will continue to work as they do now without modification.
- UntoldGlory
- Great Wyrm
- Posts: 1649
- Joined: Sun Mar 16, 2008 8:12 pm