Macros for Lighting

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
Ricks
Cave Troll
Posts: 26
Joined: Tue Mar 12, 2019 11:19 pm

Macros for Lighting

Post by Ricks »

What I want are macros I can use to reset a token's lighting. Using ClearLights() resets ALL lighting, which is wiping out Auras. So I was to disable all lighting of the type.

So I think what I want is something like:
[h: activeLights = getLights("1e")]
[h: forEach(light, activeLights): setLight("1e", light, 0)]
[h: setLight("1e", "C. Light - 60", 1)]
Now using Continual Light

But it doesn't work.

On related notes, can someone point to me a tutorial on"
-What's different between h: h, r, r: ? (I know h: hides the result, but what's h, ?
-Why I can have a macro that works differently on PCs and NPCs (not how, why, because sometimes I get different results running a macro like this against an uninitialized PC or NPC token).
-What's the relevance of Auto Execute and Apply to Selected Tokens

Thx!
Last edited by Ricks on Sun Mar 31, 2019 2:21 am, edited 1 time in total.

User avatar
metatheurgist
Dragon
Posts: 364
Joined: Mon Oct 26, 2009 5:51 am

Re: Macros for Lighting

Post by metatheurgist »

":" indicates the end of your roll options. "," separates roll options.

So if I wanted to hide the output of an if I'd do [h,if():]. Which is also why your code doesn't work.

Autoexecute runs the macro immediately. Otherwise it fills the macro command box. Apply to selected means the code will run on each selected token in the context of each token. There are tooltips when you hover over each option.

Dunno about why you're experiencing differences with PC and NPC. Not enough context.

Ricks
Cave Troll
Posts: 26
Joined: Tue Mar 12, 2019 11:19 pm

Re: Macros for Lighting

Post by Ricks »

Thanks.

Changing that to a "," still errors:
Error in body of roll.       Statement options (if any): h, forEach(light, activeLights)       Statement Body : setLight("1e", light, 0)

for
[h: activeLights = getLights("1e")]
[h, forEach(light, activeLights): setLight("1e", light, 0)]
[h: setLight("1e", "C. Light - 60", 1)]
Now using Continual Light

User avatar
metatheurgist
Dragon
Posts: 364
Joined: Mon Oct 26, 2009 5:51 am

Re: Macros for Lighting

Post by metatheurgist »

I copied the code to a new campaign and changed it from "1e" to "D20" and it worked for me. So there must be some other issue at play.

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

Re: Macros for Lighting

Post by Phergus »

Ricks wrote:
Fri Mar 29, 2019 3:50 pm
On related notes, can someone point to me a tutorial on"
-What's different between h: h, r, r: ? (I know h: hides the result, but what's h, ?
You can have multiple Roll Options in a macro statement. The comma separates them.
Category:Roll_Option
Ricks wrote:
Fri Mar 29, 2019 3:50 pm
-Why I can have a macro that works differently on PCs and NPCs (not how, why, because sometimes I get different results running a macro like this against an uninitialized PC or NPC token).
Because the macro is looking at one or more token properties that aren't initialized.
Introduction_to_Properties
Ricks wrote:
Fri Mar 29, 2019 3:50 pm
-What's the relevance of Auto Execute and Apply to Selected Tokens
Auto Execute means you click on the button and it executes. Otherwise you have to call it.
Apply to Selected Tokens means that the macro will be run against all the selected tokens in turn.

Ricks
Cave Troll
Posts: 26
Joined: Tue Mar 12, 2019 11:19 pm

Re: Macros for Lighting

Post by Ricks »

Thanks! Very helpful.

Post Reply

Return to “MapTool”