Quick Mass-Management/State Modifier
Moderators: dorpond, trevor, Azhrei, Gamerdude
Quick Mass-Management/State Modifier
Long story short I've been bodging together macros for a thing for a while now, but I need something that seems a little out of reach of my own skills.
Simply put; I'd like to, with the aid of a check box, apply various modifiers to all selected tokens at once, without clicking through a dozen input boxes. This is primarily to apply (or remove) the effects of a kind of 'aura of command' on a group of tokens that increases their stats (mostly their attack bonus/modifiers) by a certain amount when they're near a friendly officer/commander.
This could either be a macro on the officer token (grab all NPCs (possibly of the correct faction) within command range, apply or disable buff) or a general global/campaign 'prompt for enable/disable'. At the very least I know it's going to need an if and an input, but the rest eludes me.
I mean, yes, I could bodge this by just using two seperate macros, but my macro panels are overflowing as-is.
A similar setup for applying one or more values to many tokens at once using one or more dropdowns/inputs/etc. would also be very useful. Like I said, panels are overflowing and could do with some housekeeping/condensing.
Simply put; I'd like to, with the aid of a check box, apply various modifiers to all selected tokens at once, without clicking through a dozen input boxes. This is primarily to apply (or remove) the effects of a kind of 'aura of command' on a group of tokens that increases their stats (mostly their attack bonus/modifiers) by a certain amount when they're near a friendly officer/commander.
This could either be a macro on the officer token (grab all NPCs (possibly of the correct faction) within command range, apply or disable buff) or a general global/campaign 'prompt for enable/disable'. At the very least I know it's going to need an if and an input, but the rest eludes me.
I mean, yes, I could bodge this by just using two seperate macros, but my macro panels are overflowing as-is.
A similar setup for applying one or more values to many tokens at once using one or more dropdowns/inputs/etc. would also be very useful. Like I said, panels are overflowing and could do with some housekeeping/condensing.
Re: Quick Mass-Management/State Modifier
seems doable (everything you mention). When you say 'faction' is that delimited by name, state or something else?
Anyway, you would need: Wiki: getTokenNames() here you can set range and state for filters and it results in a list of token names through which you can loop and set or unset anything you like.
Anyway, you would need: Wiki: getTokenNames() here you can set range and state for filters and it results in a list of token names through which you can loop and set or unset anything you like.
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Quick Mass-Management/State Modifier
It could be either, to be honest - they all have an identifying string in the token name (e.g. "Republic Soldier", where Republic is the faction), but it could just as easily be changed to an iconless/invisible status.
I did take a brief crack at using either getTokenNames or getTokens, but the exact formatting of the json eluded me and I didn't save my changes, so whatever half-baked code I was working with has since vanished into the mists of time. Not a huge surprise or significant loss, seeing as it wasn't working to begin with.
I did take a brief crack at using either getTokenNames or getTokens, but the exact formatting of the json eluded me and I didn't save my changes, so whatever half-baked code I was working with has since vanished into the mists of time. Not a huge surprise or significant loss, seeing as it wasn't working to begin with.
Re: Quick Mass-Management/State Modifier
you could have posted it here and ask us to have a look at it. Anyway, if I copy paste the given example from the wiki:
and change it lets say, range 10, state 'republic' you get.
If the result is too daunting you can also do
but this has the drawback of names with special characters like "," in them. You omit this mostly by using json.
Code: Select all
[h: cond = json.set("{}", "range", json.set("{}", "upto", 1, "distancePerCell", 0, "metric", "NO_DIAGONALS"), "npc", 1, "unsetStates", json.append("[]","Dead"))]
Code: Select all
[h: cond = json.set("{}", "range", json.set("{}", "upto", 10, "distancePerCell", 0, "metric", "NO_DIAGONALS"), "npc", 1, "setStates", json.append("[]","republic"))]
[h: names = getTokenNames("json", cond)]
Code: Select all
[h: names = getTokenNames(",", cond)]
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Quick Mass-Management/State Modifier
Kinda hard when I closed it well over six hours ago! It may just have been that I wasn't running it as a trusted macro at the time, I was half-asleep.
Moving on - okay, so that's a start, but I'm not quite seeing how to go from there to hooking up the input and then passing the modifiers/etc. on to the tokens that the names output returns. Bear with me here, I don't always do too well with tutorials and explanations; my usual process is 'take something I know works, then modify it until it does what I want'.
Ideally the process is this;
1. Use macro on officer token.
2. Prompt appears with checkbox (and/or listbox/input field/radio buttons/whathaveyou) to enable/disable/modify various values.
3. Hit 'OK', modifies appropriate values on all the soldier/selected tokens at once using the values provided for the input.
Moving on - okay, so that's a start, but I'm not quite seeing how to go from there to hooking up the input and then passing the modifiers/etc. on to the tokens that the names output returns. Bear with me here, I don't always do too well with tutorials and explanations; my usual process is 'take something I know works, then modify it until it does what I want'.
Ideally the process is this;
1. Use macro on officer token.
2. Prompt appears with checkbox (and/or listbox/input field/radio buttons/whathaveyou) to enable/disable/modify various values.
3. Hit 'OK', modifies appropriate values on all the soldier/selected tokens at once using the values provided for the input.
Re: Quick Mass-Management/State Modifier
thats about exactly what i did in my former post And let me keep doing that below'take something I know works, then modify it until it does what I want'
1. well...thats clicking a button, nothing special there1. Use macro on officer token.
2. Prompt appears with checkbox (and/or listbox/input field/radio buttons/whathaveyou) to enable/disable/modify various values.
3. Hit 'OK', modifies appropriate values on all the soldier/selected tokens at once using the values provided for the input.
2. you need Wiki: input()
here again a copy paste from the wiki:
Code: Select all
[h:status=input(
"junkVar|"+powerClicked+"|Selected Power|LABEL",
"ComAdv|0|Combat Advantage|CHECK",
"MarkPenalty|0|Marked by an enemy other than your target|CHECK",
"TargetConcealed|0|Target has Concealment|CHECK",
"MiscBonus|0|Miscellaneous BONUSES to your attack roll",
"MiscPenalty|0|Miscellaneous PENALTIES to your attack roll",
"mdb|0|Miscellaneous BONUS to Damage")]
[h:abort(status)]
Code: Select all
[h:abort(input(
"junkVar|"+names+"|Selected Tokens|LABEL",
"ComAdv|0|Set the special state?|CHECK"
))]
<!-- note that 'names' in there only works with the "," delimiter in getTokenNames, not with the "json" delimiter -->
again, grab example:
Code: Select all
[FOREACH (enemy, enemyList, "<br>"): "You really hate " + enemy]
Code: Select all
[FOREACH (name, names): setState("Special State", 1, name)]
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Quick Mass-Management/State Modifier
I figured a foreach might come into things somewhere - I assume it's possible to nest that within an if/switch or vice-versa? e.g.
Excusing the pseudocode/shorthand, of course.
I've used input() to great effect before for my 3.5 and pathfinder attack macros, so I know plenty well how that works at least, and I've also made use of if() and switch() a fair amount as well for various purposes.
Code: Select all
[if(ComAdv == 1), CODE: {
[foreach(blah) that enables the thing]
};{
[foreach(blah) that disables the thing]
}]
I've used input() to great effect before for my 3.5 and pathfinder attack macros, so I know plenty well how that works at least, and I've also made use of if() and switch() a fair amount as well for various purposes.
Re: Quick Mass-Management/State Modifier
yeah that would work. A bit smarter would be:Arcalane wrote:I figured a foreach might come into things somewhere - I assume it's possible to nest that within an if/switch or vice-versa? e.g.
Code: Select all
[if(ComAdv == 1), CODE: { [foreach(blah) that enables the thing] };{ [foreach(blah) that disables the thing] }]
Code: Select all
[FOREACH (name, names): setState("Special State", ComAdv, name)]
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Quick Mass-Management/State Modifier
That works. I am however still getting code output in the chat window, which obviously isn't ideal if this is something I need to disable in combat because the officer bought the farm, and I'm not seeing how to easily turn that off...
I have at least figured out how to use getProperty in combination with name from the list output in order to provide an armour/health/etc. bonus to all the goons in the aura at least, so that's another milestone down.
I have at least figured out how to use getProperty in combination with name from the list output in order to provide an armour/health/etc. bonus to all the goons in the aura at least, so that's another milestone down.
Re: Quick Mass-Management/State Modifier
there are many ways to suppress output. The 'final' (best) method would be making it a Wiki: defineFunction() and simply set the 'ignore output' flag to 1. and then call the defined function instead.
other simpler ways are simply putting a
h: or h, option in front of the code. So
[h:abort(input(....))]
or
[h,foreach:()]
check the 'READ THIS' link in my sig for better instructions on the , and :
other simpler ways are simply putting a
h: or h, option in front of the code. So
[h:abort(input(....))]
or
[h,foreach:()]
check the 'READ THIS' link in my sig for better instructions on the , and :
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Quick Mass-Management/State Modifier
I figured it would be something like that - I tried h: but forgot h, was a thing.
I think I can get things going along from here at least, with a little more tweaking. Thanks for the help.
I think I can get things going along from here at least, with a little more tweaking. Thanks for the help.
Re: Quick Mass-Management/State Modifier
ok, good luck. Don't forget to read the 'READ THIS' article!!Arcalane wrote:I figured it would be something like that - I tried h: but forgot h, was a thing.
I think I can get things going along from here at least, with a little more tweaking. Thanks for the help.
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS