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

For Loop

December 08 (7 years ago)

Edited December 08 (7 years ago)
Good evening,

I am trying to Create a Do loop.  In a macro, specifically for initiative tracker...  In Virtual basic the code would look something thing like

For Each Token in Initiative tracker

If token.Initiative>0 then
token.Initiative= token.Initiative-10
end if

next loop

But, I cannot see an easy way to do a loop.  Specifically I want to create a macro that subtracts 10 from everyones initiative for a shadow run game.  I know you can do it manually, but when you have a bunch of drones and PC and spirits and NPCs 

Pheonix
December 08 (7 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
This is not possible with macros. This would require a custom API script. You could do &{tracker} syntax to do this for a single token at a time.
December 08 (7 years ago)
Conditional statements (including for loops) would require use of the API, a pro subscription feature.
December 08 (7 years ago)
Pat S.
Forum Champion
Sheet Author
It would take an api script to do what you. That takes a pro subscription.
December 08 (7 years ago)

Edited December 08 (7 years ago)
If you (or the Creator of the Game, if you're a player) acquires the aforementioned API access, the script GroupInitiative can accomplish this handily:
!group-init --adjust -10 0