Macro Chat Output - Add line feed - and slow to fire sometimes?

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: Azhrei, dorpond, trevor, giliath, jay, Mr.Ice

Post Reply
ThermoDyn
Kobold
Posts: 10
Joined: Tue Apr 21, 2020 8:28 am

Macro Chat Output - Add line feed - and slow to fire sometimes?

Post by ThermoDyn »

Good morning - I have a bit of an issue I am wondering if there is a fix for.

I am running an online AP and my players are remote and we are playing via laptops. Some of the laptops are quite crappy so screen real estate is at a premium.

I have the tokens set up with macros and such for weapon attacks that output to hit and damage at the same time in a table.

My issue is that the table shows up beside the icon and the name of the character, getting all scrunched up and forcing the user to make the panel bigger.

I would like to know if it's possible to make this output appear below the name/picture.

Alternatively it would be nice to either disable the image display or the token name.

This screenshot should make clear what I am asking about. It's the yellow area that says wasted space.
https://nextcloud.thermo.strangled.net/ ... 6TKpaTXQ8g

This is the macro code I use for attacks.

[h: roll = d20]
[h,if(roll >= 20 && roll <= 20): color="red";color="blue"]
<table border='1' cellpadding='0' cellspacing='0' style='width:125x'>
<tr bgcolor='red'>
<td><span style='color:white'><b>+1 dwarven waraxe</b></span></td>
</tr><tr>
<td><font color=[r: color]>[e: d20 + 11]</font></td>
</tr><tr bgcolor='red'>
<td><span style='color:white'><b>Damage (Crit ×3)</b></span></td>
</tr><tr>
<td><font color=[r: color]>[e:1d10+4]</font></td>
</tr></table>

While I am at it - I have some players complaining that when they click on the macros on their own tokens - they don't fire and they end up clicking a bunch of times before it triggers.

I've been unable to duplicate myself even through remote testing. It appears to be an issue with the computer but I just wanted to double check just in case anyone has run into this before.

We are currently still running 1.5.14 - it's a pain to get all of them to upgrade to new versions so I am holding off until things settle. I may upgrade to 1.7 once things are finalized :) However if the new versions have something to help I will go ahead and upgrade everyone to 1.6.1.

Hope that's clear enough - thanks for your time!

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

Re: Macro Chat Output - Add line feed - and slow to fire sometimes?

Post by aliasmask »

You can customize your own output with Wiki: broadcast(). I have an example in my macro writing starter kit under the Lib:Token. (see signature)

ThermoDyn
Kobold
Posts: 10
Joined: Tue Apr 21, 2020 8:28 am

Re: Macro Chat Output - Add line feed - and slow to fire sometimes?

Post by ThermoDyn »

Ok, I worked with the broadcast function and it does throw text out to chat without the image and name.

So I could do something like this

Character Name
-----------------------------
Attack information

I do like the token image being there though - so I tried something like this:

[h: txt="Normal text"]
{txt}[/i]
[h: BroadcastText("this is broadcast text","all")]

But in this case - the broadcast text appears first.

Any ideas on how I can get character image and name to appear above the broadcast text?

Thanks!
Last edited by ThermoDyn on Thu May 21, 2020 8:44 pm, edited 1 time in total.

ThermoDyn
Kobold
Posts: 10
Joined: Tue Apr 21, 2020 8:28 am

Re: Macro Chat Output - Add line feed - and slow to fire sometimes?

Post by ThermoDyn »

Ahhhh - I see in your output function you do this:

[H: tokenImage = getTokenImage()]

And then in the output text you do this.
<img src="%{tokenImage}-40" alt="%{playerName}" />

ThermoDyn
Kobold
Posts: 10
Joined: Tue Apr 21, 2020 8:28 am

Re: Macro Chat Output - Add line feed - and slow to fire sometimes?

Post by ThermoDyn »

Brainlock - so I'm using broadcast to make the table and text the way I want it - how to do get it to evaluate the dice roll embedded in the text?

I have the code below but that just gives me [r: d20 + 2] - it doesnt actually roll the dice.
Last edited by ThermoDyn on Thu May 21, 2020 8:43 pm, edited 1 time in total.

ThermoDyn
Kobold
Posts: 10
Joined: Tue Apr 21, 2020 8:28 am

Re: Macro Chat Output - Add line feed - and slow to fire sometimes?

Post by ThermoDyn »

I managed to get this going - it's a bit kludgy because broadcast doesn't work with dice rolls. The red color for crits doesn't work either.

I'll clean it up tomorrow.

Code: Select all

[H: tokenImage = getTokenImage()]
[H: tokenName = getName()]

[H: atkRoll = d20]
[H: atkBonus = '+2']
[H: atkResult = atkRoll + atkBonus]
[H: atkString = concat('d20',strformat("%+d",atkBonus),": ",atkRoll, strformat("%+d",atkBonus),' = ',atkResult)]
[H,if(atkRoll >= 19 && atkRoll <= 20): color="red";color="blue"]

[H: dmgRoll = 'd8']
[H: dmgRolla = eval(dmgRoll)]
[H: dmgBonus = '-1']
[H: dmgExtra = ' plus 1 vs. bleeding foe']
[H: dmgResult = dmgRolla + dmgBonus]
[H: dmgString = concat(dmgRoll,strformat("%+d",dmgBonus),": ",dmgRolla, strformat("%+d",dmgBonus),' = ',dmgResult,dmgExtra)]

[H: output = strformat('
<table border="0" cellpadding="0" cellspacing="1" style="width:175px">
    <tr>
       <td width="20px" style="text-align:left;padding-right: 5px" valign="top"><img src="%{tokenImage}-40" alt="%{tokenName}" /></td> 
       <td width="155px" style="text-align:left;" valign="top">%{tokenName}:</td>
    </tr><tr bgcolor="red">
		<td colspan=2><span style="color:white"><b>Mwk crystal sabre</b></span></td>
	</tr><tr>
		<td colspan=2><font color=[r: color]>%{atkString}</font></td>
	</tr><tr bgcolor="red">
		<td colspan=2><span style="color:white"><b>Damage Crit 19-20/x2 </b></span></td>
	</tr><tr>
		<td colspan=2><font color=[r: color]>%{dmgString}</font></td>
		</font></td>
	</tr> </table>
 ')]

[h: outputTo("self",output)]

Phergus
Deity
Posts: 7108
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: Macro Chat Output - Add line feed - and slow to fire sometimes?

Post by Phergus »

You might want to move up to 1.7.0. The token names no longer space the output over but are instead on the first line of the output.
Screenshot 2020-05-22 10.19.03.png
Screenshot 2020-05-22 10.19.03.png (20.2 KiB) Viewed 148 times
You can also turn off showing the Avatar in Chat in preferences.
Screenshot 2020-05-22 10.19.22.png
Screenshot 2020-05-22 10.19.22.png (16.01 KiB) Viewed 148 times

bubblobill
Cave Troll
Posts: 97
Joined: Sun Jan 24, 2010 3:07 pm

Re: Macro Chat Output - Add line feed - and slow to fire sometimes?

Post by bubblobill »

The old fix was to start your output with </table> which placed the output under the icon on a new line.

ThermoDyn
Kobold
Posts: 10
Joined: Tue Apr 21, 2020 8:28 am

Re: Macro Chat Output - Add line feed - and slow to fire sometimes?

Post by ThermoDyn »

lol - really? That would have been way simpler then all the recoding I just did :)

I feel like I learned something though.

Also good to know about 1.7.0 - I'm going to hold off I think though until I get to a point where I can bring laptops over to fix them. It was murder getting everyone on 1.5.14 at the same time.

Thanks for the help!
Chris

Post Reply

Return to “Macros”