Page 1 of 1

Tool-tip Question

Posted: Sun Apr 26, 2015 4:33 pm
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.

Re: Tool-tip Question

Posted: Mon Apr 27, 2015 9:02 pm
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.

Re: Tool-tip Question

Posted: Tue Apr 28, 2015 3:15 am
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.

Re: Tool-tip Question

Posted: Wed Apr 29, 2015 8:13 pm
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.