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

[API] drawCard(deck, card) API not working as expected with unlimited decks

Hi there, I created a Deck, created three different cards in it, and set the deck as unlimited. I created an API, that shall pick a given card from the deck and deal a certain amount of this card to a player. (It's for Savage Worlds, my deck are my bennies, each card is a different benny type, and I want my bennies supply to be unlimited. the script is to quickly deal bennies to players at the start of the session, usually 3 of a kind, and sometimes one or two of another kind, depends on the setting or the players' edges). Basically I did :  draw give draw give First draw works fine. First give works fine. Second draw tells me the card is not in the deck (message in sandbox console :  "That card is not in the deck.") . Even if I shuffle before. Since I use an unlimited deck, the given card should be given AND remain in the discard. Here is a sample code uploaded as Gist , that showcase what's not working. The script is an api command that draw twice a given card by id, and give both to a given player. Here is a screenshot of result of that command executed twice in a row (first call, first draw works, second fail, second call, both draw fail). Note that : shuffling after/before/inbetween doesn't change anything. After the give, the card is no longer in the deck nor discard. It's only in the player's hand. drawing and giving works with unlimited deck if you don't specify a card. e.g. If I create an unlimited deck of 3 cards, and draw and give 7 cards in a loop in a single command, everything behaves as expected, 7 cards are given to the player, 2 of each, and one "random" (the top after the last shuffle). giving a card to the player without drawing it, works fine (I included an example as the last times of my gist-uploaded code above) So : drawCard(deck) works drawCard(deck, card) is incomplete for unlimited decks giveCard(card, player) works even if the card wasn't drawn before. And so works fine for unlimited deck to give cards by name from the deck.
Hello Gronyon, I have moved your thread to the API forum.  Thanks!
Dragon Dreamer said: Hello Gronyon, I have moved your thread to the API forum.  Thanks! Hello, well ok, but why API Bugs are the API forum instead of the Bug Report forum ? (API forum description " The API Forum is intended to be used to discuss the Roll20 API by sharing tips and tricks as well as fully working scripts and examples with the community." does not mention bug reports. However Bug report forum doesn't clearly state it can handle API report either.) I had already posted a post in the API forum , it's a bit less detailed than this one, and include discussions with Keithcurtis helping me out with the issue. It can be help Dev understand/reproduce the issue.
Hi Gronyon -  Thank you for the detailed report. In addition, would you be able to share a screenshot of the settings you selected on your test card deck, please?
Hello,  yes sure. Hmm, it's in French, but that should not stop you from replicating the settings.
Hi Gronyon -  Thanks for the additional details! I have escalated this to the development team and they will take a look at it. Overall, we are aware of a few issues regarding the API and how it works with card decks, but it's a topic that we are still conducting further research on. As a result, we have no specifics on a timeline for a fix or how it might be implemented at this moment. However, we will try to keep you posted as soon as we have additional information. Our apologies for the inconvenience!