Show all states on a token

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

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

Re: Show all states on a token

Post by aliasmask »

Ah, you have some bad state names. Use valid variable names. If you change the "+1" state to something like "plus1" or "d+1". Also, remove any spaces in state names.

User avatar
Dielzen
Cave Troll
Posts: 85
Joined: Mon Nov 29, 2010 3:50 am
Location: Waterdeep
Contact:

Re: Show all states on a token

Post by Dielzen »

Ah, that explains everything, and now my macro works.

Thanks to all involved so far, and pardon my n00bness. :D

User avatar
Dielzen
Cave Troll
Posts: 85
Joined: Mon Nov 29, 2010 3:50 am
Location: Waterdeep
Contact:

Re: Show all states on a token

Post by Dielzen »

OK, I'm almost there, just a few minor tweaks and I'm done with this, thanks for the help so far.

Firstly, my macro outputs the person who "has next" before the output of the macro itself, is there any way to fix this? For explanation, here's my macro

Code: Select all

<b><i>completes their turn.</i></b>

[h: list = getTokenStates()]
[h: activeList = ""]
[h, foreach(current, list, "<br>"), CODE:
{
[h,if(getState(current)): activeList = listAppend(activeList,current);""]
}]

[h: textOut=""]

[h,foreach(affliction, activeList, ""), CODE:
{
    [h: savingThrow = input(
    "junkVar|"+getStateImage(affliction)+"|"+affliction+"|LABEL| TEXT=FALSE ICON=TRUE SPAN=FALSE",
    "makeSave|0|Save for this condition?|CHECK",
    "modifier|0|Modifier to this roll|TEXT| Width=3")]
    [h: abort(savingThrow)]

    [h,if(makeSave), CODE:
    {
        [h: saveRoll = 1d20]
        [h: totalRoll = 1d20+modifier]
        [h,if(totalRoll>=10): setState(affliction, 0)]
        [h,if(totalRoll>=10): textOut=
            listAppend(textOut,"<br>Roll = "+saveRoll+"+"+modifier+" - Successful save against "+affliction);""]
        [h,if(totalRoll<10): textOut=
            listAppend(textOut,"<br>Roll = "+saveRoll+"+"+modifier+" - <b>Failed</b> to save against "+affliction);""]
    }]
}]
[r: textOut]
[h:nextInitiative()]
[h: offset = getCurrentInitiative()]
 
And here's my output

Code: Select all

Gromp has received initiative.
 
Cha`Ka: completes their turn. 
        Roll = 12+0 - Successful save against Immobilized,
        Roll = 6+0 - Failed to save against Prone
Obviously, I'd love to have the received initiative portion AFTER the saving throw resolutions.

User avatar
Dielzen
Cave Troll
Posts: 85
Joined: Mon Nov 29, 2010 3:50 am
Location: Waterdeep
Contact:

Re: Show all states on a token

Post by Dielzen »

Am I stuck with this output order?

User avatar
zEal
Dragon
Posts: 944
Joined: Sun Mar 22, 2009 2:25 am

Re: Show all states on a token

Post by zEal »

It'll require another macro, but you might be able to use Wiki: execLink() to defer the execution of nextInitiative(), thereby having it output afterwards.

Post Reply

Return to “Macros”