Page 1 of 1

Simple macro update request

Posted: Mon Mar 20, 2017 3:59 pm
by AidyBaby
[EDIT: Just realised this should have gone in the Macro subforum - maybe someone can move it?]

I hope I can get a simple solution to my very simple macro that I'm using in my framework. I'm sure I've borrowed most of this from elsewhere and as it's ages since I've done any macro writing (which always was very limited) I am hoping someone can easily set me straight on this and save me some frustration.

I have a simple next initiative macro that shows the GM a token handout in a frame for the next initiative token (a picture of the monster statblock). I'm trying to alter the macro to only update the frame for NPCs and not PC tokens, see the end of the code:

Code: Select all

[h:ID = getInitiativeToken()]
[h:switchToken(ID)]
[h:state.Current = 0]
[h:nextInitiative()]
[h:ID = getInitiativeToken()]
[h:switchToken(ID)]
[h,if (getLayer() == "TOKEN") : state.Current = 1]
[h:state.Delay = 0]
[h:state.Ready = 0]

[Frame("Statblock"): {
<img src="[r:getTokenHandout()]"></>
}]


I've tried using:

Code: Select all

[h,if (isNPC()), code : 
{
[Frame("Statblock"):{<img src="[r:getTokenHandout()]"></>]
}]
but can't get it to work. Anyone want to take pity on me and put me out of my misery for this simple request?

Cheers,

AidyBaby

Re: Simple macro update request

Posted: Mon Mar 20, 2017 4:55 pm
by aliasmask
Try removing the "h" from the if statement, adding ;{} to the if and get rid of the extra >/< and add } for the frame.

Code: Select all

[if(isNPC()), code: {
   [Frame("Statblock"):{<img src="[r:getTokenHandout()]" />}]
};{}]

Re: Simple macro update request

Posted: Mon Mar 20, 2017 6:28 pm
by wolph42
what AM said. The core issue though was a missing }

</>]

must be

</>}]

Re: Simple macro update request

Posted: Tue Mar 21, 2017 6:08 am
by AidyBaby
Thank you both for this - I don't know how many times I checked opening and closing brackets and still couldn't see it!