Tool-tip 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
qcgreywolf
Cave Troll
Posts: 43
Joined: Mon Dec 09, 2013 10:23 pm

Tool-tip Question

Post by qcgreywolf »

While building my lightweight framework, for the longest time I struggled with hiding information from my players when manipulating NPC tokens with my macros. I ended up taking an extremely simplified approach just so I could move on and deal with verbose output later.

Example:
PC's do a perception check and they get a little chat output that says that they did so, and it looks pretty and has a tool-tip that breaks down the roll, individual modifiers and total roll. Swanky for my mediocre skills!

NPC's do a perception check and if I just hide the output text, the tool-tip code causes just a blank line of text to show up.

Result:
If the PC's are on one side of a door and listening to see what is on the other side, and I roll for the BBEG to do the same, the players get a meta-game message saying (Image of BBEG)Name of BBEG: (blank text line). It really eats the surprise!

My temporary solution involved simply removing the tool-tips from anything I wanted to be completely hidden, so the DM does not get the neat benefits of seeing roll breakdows but players do.

Is there a way that I am not seeing to have tool-tips visible only to GM's so I can benefit from my tool-tips but still completely hide the chat output to my non-GM players?

Example:(just one skill pulled out to show the code)
Spoiler

Code: Select all

[h: gmOnly = isNPC()]

[h: Random.Roller(20)]
[h: dieRoll = number(outputRoll)]
[h: skillRoll = dieRoll + Heal + TempSkillModifier]
[h: totalModifier = Heal + TempSkillModifier]


  [h: output.tip = strformat("<html>
   <table><tr><td colspan=2><b><center>Heal Check</center></b></td></tr>
      <tr><td>Skill Modifier:</td><td>%{Heal}</td><td>Temporary Modifiers:</td><td>%{TempSkillModifier}</td></tr>
      <tr><td>D20 Roll:</td><td>%{dieRoll}</td><td>Final Modifier: %{totalModifier}</td></tr>
   </table></html>")]

[h: outputText = strformat("<b>Heal</b> check = %{skillRoll}.")]

[ if(gmOnly == 1), CODE:
{
	[r: nad.lib.DisplayText(outputText, gmOnly)]
};{

	<td><span title="{output.tip}">
	[r: nad.lib.DisplayText(outputText, gmOnly)]
	</span></td>
}]
DisplayText code:

Code: Select all


					[h: '<--	arg 1 is npc or pc output
						arg 0 is the text to output -->']
[if(arg(1) == 1),CODE:
{
	[g,r: arg(0)]
};{
	[r: arg(0)]
}]

Thanks in advance, you forum peeps are pretty awesome.

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

Re: Tool-tip Question

Post by aliasmask »

I make all my macros UDFs with suppressed output and when I want to output something I use another macro that uses broadcast. I have a example lib token here: http://forums.rptools.net/viewtopic.php ... 31#p255459 with lots of notes. It has custom output function called output.basic where you have more options to set your output like owner and other.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Tool-tip Question

Post by wolph42 »

in case you do not (yet :D ) use UDF's you can also suppress macro output by ending it with [h:abort(0)]. Note that this will suppress ALL output, so here too you will need to use Wiki: broadcast() to get the message out. IRC you can broadcast to gm only.

qcgreywolf
Cave Troll
Posts: 43
Joined: Mon Dec 09, 2013 10:23 pm

Re: Tool-tip Question

Post by qcgreywolf »

Ok, so this was going to be a big long post of all the things I have tried, and I feel like an idiot. I had tried all these complicated things, JSON's, token properties, and every possible configuration of [g:] with [if] and more.

On a whim, I stripped away all the complications and went with bare-bones simplicity. And by God, it worked like a charm and I cannot possibly conceive how I have missed this. It just never dawned on me.

Here is the obnoxiously simple solution.

Sigh.
Spoiler
Calling code

Code: Select all

[h: gmOnly = isNPC()]

[h: output.tip = strformat("<html>
   <table><tr><td colspan=2><b><center>Heal Check</center></b></td></tr>
   <tr><td>Skill Modifier:</td><td>%{Heal}</td><td>Temporary Modifiers:</td><td>%{TempSkillModifier}</td></tr>
   <tr><td>D20 Roll:</td><td>%{dieRoll}</td><td>Final Modifier: %{totalModifier}</td></tr>
   </table></html>")]

[h: outputText = strformat("<b>Heal</b> check = %{skillRoll}.")]

[if(gmOnly == 1),CODE:
{
	[g: nad.lib.OutputTips(outputText,output.tip)]
};{
	[r: nad.lib.OutputTips(outputText,output.tip)]
}]
Called UDF

Code: Select all

<span title="{arg(1)}">
[r: arg(0)]
</span>
Shameful edit: Aliasmask and Wolph42; thanks for your input as always. I have learned a lot from both your guy's posts and posted code/maps/macros. I have incorporated a great many of your suggestions over the many months.

Post Reply

Return to “Macros”