RPTools.net

Discussion and Support

Skip to content

It is currently Sat Feb 24, 2018 11:22 am 






Reply to topic  [ 12 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Tue Sep 29, 2015 3:22 am
Posts: 9
 Post subject: Quick Mass-Management/State Modifier
PostPosted: Tue Sep 29, 2015 3:42 am 
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.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9485
Location: Netherlands
 Post subject: Re: Quick Mass-Management/State Modifier
PostPosted: Tue Sep 29, 2015 6:47 am 
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.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
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


Top
 Profile  
 
 Offline
Kobold
 
Joined: Tue Sep 29, 2015 3:22 am
Posts: 9
 Post subject: Re: Quick Mass-Management/State Modifier
PostPosted: Tue Sep 29, 2015 7:44 am 
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.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9485
Location: Netherlands
 Post subject: Re: Quick Mass-Management/State Modifier
PostPosted: Tue Sep 29, 2015 8:13 am 
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:

Code:
[h: cond = json.set("{}", "range", json.set("{}", "upto", 1, "distancePerCell", 0, "metric", "NO_DIAGONALS"), "npc", 1, "unsetStates", json.append("[]","Dead"))] 


and change it lets say, range 10, state 'republic' you get.

Code:
[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)] 


If the result is too daunting you can also do

Code:
[h: names = getTokenNames(",", cond)] 

but this has the drawback of names with special characters like "," in them. You omit this mostly by using json.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
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


Top
 Profile  
 
 Offline
Kobold
 
Joined: Tue Sep 29, 2015 3:22 am
Posts: 9
 Post subject: Re: Quick Mass-Management/State Modifier
PostPosted: Tue Sep 29, 2015 8:51 am 
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.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9485
Location: Netherlands
 Post subject: Re: Quick Mass-Management/State Modifier
PostPosted: Tue Sep 29, 2015 9:07 am 
Quote:
'take something I know works, then modify it until it does what I want'


thats about exactly what i did in my former post :wink: And let me keep doing that below :mrgreen:

Quote:
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.


1. well...thats clicking a button, nothing special there
2. you need Wiki: input()

here again a copy paste from the wiki:
Code:
[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)] 

modify
Code:
[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 getTokenNamesnot with the "json" delimiter -->
 


3. the trickier part, loop through all 'names' and set the state. For this you need [foreach:]
again, grab example:
Code:
[FOREACH (enemyenemyList"<br>"): "You really hate " enemy

adapt:
Code:
[FOREACH (namenames): setState("Special State"1name)] 

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
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


Top
 Profile  
 
 Offline
Kobold
 
Joined: Tue Sep 29, 2015 3:22 am
Posts: 9
 Post subject: Re: Quick Mass-Management/State Modifier
PostPosted: Tue Sep 29, 2015 9:22 am 
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:
[if(ComAdv == 1), CODE: {
[foreach(blah) that enables the thing]
};{
[foreach(blah) that disables the thing]
}]


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.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9485
Location: Netherlands
 Post subject: Re: Quick Mass-Management/State Modifier
PostPosted: Tue Sep 29, 2015 9:25 am 
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:
[if(ComAdv == 1), CODE: {
[foreach(blah) that enables the thing]
};{
[foreach(blah) that disables the thing]
}]


yeah that would work. A bit smarter would be:

Code:
[FOREACH (name, names): setState("Special State", ComAdv, name)]  

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
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


Top
 Profile  
 
 Offline
Kobold
 
Joined: Tue Sep 29, 2015 3:22 am
Posts: 9
 Post subject: Re: Quick Mass-Management/State Modifier
PostPosted: Tue Sep 29, 2015 9:40 am 
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.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9485
Location: Netherlands
 Post subject: Re: Quick Mass-Management/State Modifier
PostPosted: Tue Sep 29, 2015 9:44 am 
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 :

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
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


Top
 Profile  
 
 Offline
Kobold
 
Joined: Tue Sep 29, 2015 3:22 am
Posts: 9
 Post subject: Re: Quick Mass-Management/State Modifier
PostPosted: Tue Sep 29, 2015 9:58 am 
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.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9485
Location: Netherlands
 Post subject: Re: Quick Mass-Management/State Modifier
PostPosted: Tue Sep 29, 2015 10:06 am 
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.


ok, good luck. Don't forget to read the 'READ THIS' article!!

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 12 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman