Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Chatsetattr on all on map instead of all selected of all.

Is there a function for chatsetattr to affect all tokens that are currently on the token layer without having to select them all?

If not. Could there be?


August 03 (3 years ago)
timmaugh
Pro
API Scripter

ScriptCards as a function to get all of the tokens on a page, I believe, and then you could launch the ChatSetAttr call.

Alternately, if you knew all of the tokens ahead of time, you could add a {&select token1, token1, token3...} statement to the line (from SelectManager). That would select them virtually (just for the purposes of the message, nothing changing on the board).

I have a metascript in the works to make this work natively in any script, but as of now, those are the only ways I know of.

Does scriptcards work with Group Initiative?

August 03 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

It looks like the only out-of-the-box option is all characters in the game, but is there a reason you can't use Ctrl-A before issuing the command?

August 03 (3 years ago)
timmaugh
Pro
API Scripter


Peacekeeper B said:

Does scriptcards work with Group Initiative?


"Work with" in what way? It can launch a GroupInit call...beyond that, I'm not super familiar with SC. Maybe you can post what you want to do, specifically, and a practitioner of the ScriptCard arts can chime in.

August 03 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Actually, that's a good idea. Often someone posts a very specific thing they are trying to do, but if the goal were known, a better solution might exist.

Simply put, my Initiative and group initiative macros have setattr set in them to reset certain actions. I play Castles and Crusades, so things like charge, offensive focus, etc are good for one action. Instead of having a player constantly resetting these effects themselves they are toggled off by group initiative. I also have things like stun and spell durations worked into it (through generic attributes).

Yes I can ctrl A or otherwise select all but sometimes I forget. And I don't want to use all because it takes a while do everyone character in the game. 

I don't use scriptcards (too invested in powercards, and stubborn).
 

August 03 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Possibility: You could build some resetting macros and use the script On My Turn which runs them when a player reaches the top of the Turn Order.

August 03 (3 years ago)

Edited August 04 (3 years ago)
timmaugh
Pro
API Scripter

Ok, then you might want to use a {&select...} statement, and just make sure you have the list of all the tokens you want to include. The good thing about that route is that you can use their names, and SelectManager will look on the page where you are, so you don't have to worry about a token with a different ID for the same character on a different map when you transition.

Post your macro if you go this route and have difficulty

August 04 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

I'd assume trying to use "all" parameter makes the macro affect every token, regardless of layer. Guess layer-specific "all" selection options for tokenmod could make sense.

Using --all affects every character in the game, even if they aren't on the board/layer at all. Every character sheet in your folders will be affected and that takes time. It would considerably slow down the game.

If there were a way to add --layer token to the parameter of options for chatsetattr that would be great.


Andreas J. said:

I'd assume trying to use "all" parameter makes the macro affect every token, regardless of layer. Guess layer-specific "all" selection options for tokenmod could make sense.





keithcurtis said:

Possibility: You could build some resetting macros and use the script On My Turn which runs them when a player reaches the top of the Turn Order.


I would have to add that to every character in the game. And then the player would have to activate the maneuvers at the start of their action and not the start of the round.

August 05 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

Peacekeeper B said:

If there were a way to add --layer token to the parameter of options for chatsetattr that would be great.

Jakob, the original API author isn't active here these days, so is unlikely to update it, it will have to be someone else.


ChatSetAttr related

  • I notice today that the --sel option doesnt seem to work properly with inline rolls, so need to use --charid @{target|character_id} instead for those.
  • updated the wiki page a bit: https://wiki.roll20.net/ChatSetAttr