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
This post has been closed. You can still view previous posts, but you can't post any new replies.

[Help] New Card API Functions

1522289770

Edited 1522326912
Finderski
Pro
Sheet Author
Compendium Curator
I'm messing around with the new Card functions and not sure if this a bug or a feature, but I can't seem to get get some of the functions to work with a deck with infinite cards. shuffleDeck("-L7yqhH0jfyDMASWYXdu") The above command seems to put all the cards in the same order, which happens to be the order the cards were entered in the deck. playCardToTable(drawCard("-L7yqhH0jfyDMASWYXdu"), {left: "350", top: "350",layer:"map"}); The above command doesn't play a card, because it doesn't draw a card. The log receives this message:  "Unable to locate card with id: " If I change the deck to non-infinite, then the cards are mixed up and a card is played to the map layer. Am I doing something wrong, or is this just not implemented for infinite cards? Also, this may be a stupid question, but is there a way for the API to get the Deck ID? If I wanted to create an API script that others could use that used different decks, it would be a little bit of a pain to have to use the Developer Tools to find the deck ID...
1522322571
The Aaron
Forum Champion
API Scripter
Those sound like bugs. You can get the deck's id from the deck object with something like: deckid = findObjs({type:'deck',name:'Some Deck Name'})[0].id; if(deckid){ /* do something decky */ } See:&nbsp; <a href="https://wiki.roll20.net/API:Objects#Deck" rel="nofollow">https://wiki.roll20.net/API:Objects#Deck</a>
1522327087

Edited 1522327218
Finderski
Pro
Sheet Author
Compendium Curator
Thanks! I've posted this in the Bugs forum (this thread can be closed). You can get the deck's id from the deck object with something like: deckid = findObjs({type:'deck',name:'Some Deck Name'})[0].id; if(deckid){ /* do something decky */ } See: <a href="https://wiki.roll20.net/API:Objects#Deck" rel="nofollow">https://wiki.roll20.net/API:Objects#Deck</a> I'll have to give that a whirl and see if I can get it to work... :)