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

[Help] Round Counter...

1521968459
Finderski
Pro
Sheet Author
Compendium Curator
I'm working on a script that plays a "card" to chat and some cards have certain effects and some of those effects are different depending on the round. There is no need for the Turn Tracker, so I'd rather not have to worry about that if I can help it. What I'd like to do is have the "round counter" set to 0 when the deck is shuffled and each time a card is dealt to chat, have the counter increment. I can't seem to figure this out, because if I set the variable outside of the deal function, deal doesn't understand it, if I set it in deal it never changes. So, where would I need to create this variable, set it, and change it, so each round the correct value is displayed? I can post the entire code if necessary, but I'm hacking Pat Elwer's  Deal-Init script (I've just removed a bunch of stuff so it doesn't worry about Edges, or deal to the Turn Tracker).
1522002717
The Aaron
Pro
API Scripter
You can add a variable up there where the version is defined.  That will be accessible by all the functions.  However, you might want to store it in the state so that it persists across restarts of the API.  Alternatively, if you're using the new functions for deck management on Dev, you could just take a count of the total number of cards - the number of cards left in the deck to get the rounds. =D
1522088704
Finderski
Pro
Sheet Author
Compendium Curator
Awesome! Thanks.  I thought I'd tried that already and it kept coming up 0, but...it works, now. :) Thanks, again.