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

[Script] Dealer

1565754117

Edited 1591717563
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I have significantly updated my Inspire script to the point where I think it would cause less confusion to start a new thread. Once again, thanks to Scott C. The Aaron and GiGs for their time an patience. The new script is called "Dealer" and uses the following syntax: !deal --[give,take] [#] --[deck name] If give/take is not specified, it gives a card to the player controlling the selected token If deck name is not specified, it defaults to "Playing Cards". You can specify a number of cards to give or take. After the action word, type an integer, after a space: !deal --give 5 --Playing Cards The script will deal cards to the player from the specified deck so long as there are enough available. If the deck has cycled through all cards, it will automatically shuffle. If a token has more than one controller or is controlled by All and one or more players, it will select the first single player in the controlled by list. Script will try to let you know if you have not prepared a command or deck properly. If deck does not deal a card, you may need to manually shuffle (Roll20 bug). If the deck is shuffled, it may not recognize all cards in hand. Uses: Games which deal or take playing cards at random from a standard deck Awarding inspiration--or Bardic Inspiration from a separate deck. Awarding a random potion/scroll/treasure/piece of equipment from a properly prepared deck. Examples !deal --give --Inspiration This will deal a card from a deck called "Inspiration" to the player whose token is selected.  This would be ideal as a token ability or macro bar macro to allow GMs to award Inspiration to the player of a selected token. !deal --take --Inspiration This will take a card from a deck called "Inspiration" from the hand player whose token is selected. This would be ideal as a token ability to allow players to spend Inspiration !deal --give or !deal --give --Playing Cards This will deal a card from the Playing Cards deck to the player whose token is selected. !deal --take This will take a card from the Playing Cards deck from the hand player whose token is selected. The latest version of Dealer is now available for One Click install.
1565756229
GiGs
Pro
Sheet Author
API Scripter
Nice to see you building on this script. I'll be using this in one of my upcoming games for fate point tokens. Might be handy to look into giving more than one card at the same time. 
1565756501
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Good idea.
1565835245
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I have added the capability to specify the number of cards to handle. After "--give" or "--take", type a space followed by an integer: !deal --give 5 --Playing Cards The script will deal cards to the player from the specified deck so long as there are enough available. If the deck has cycled through all cards, it will automatically shuffle. The top post is updated, and the code is now linked, rather than posted in-line.
1565840990
Wes
Sheet Author
I haven't checked it out yet but it sounds very convenient. Can anyone in a game use the commands or do they check for gm only?
1565841141
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Anyone. It was designed that way back when I started it as an inspiration script, so that players could discard their inspiration.
1567518640

Edited 1567518683
Could there be a way to have it deal or place specific cards? If you gave the cards name. Something like "!deal --give --playing cards --Ace of Spades" or  "!deal --play --playing cards --Ace of Spades"
1567528849
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Actually, I added that to the script a week or two ago. I just haven't had time to playtest it or clean it up. Also, although you can deal a card by name, I haven't added functionality to recall a card by name. If you want to try it out, it's in my personal repo here . Syntax is:  --deckname|cardname So in the example you gave it would be: !deal --give --playing cards|Ace of Spades I have used this in my own game to create a chat menu for potion deck cards. I can give cards representing potions to players, so that they can keep track of them more easily. When you use a potion, just play the card. Here is the macro code: &{template:npcaction} {{rname=Potions}} {{description=[Oil of Slipperiness](!deal --give --Potions|Oil of Slipperiness) [Oil of Etherealness](!deal --give --Potions|Oil of Etherealness) [Oil of Sharpness](!deal --give --Potions|Oil of Sharpness) ... [Vitality](!deal --give --Potions|Vitality) [Bravery](!deal --give --Potions|Bravery)}}
Well that worked nicely. On the quick test. 
1567566114
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I've been using it for over a week and it's simple enough. I have submitted a Pull Request.
1570813587
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Nope. I have not submitted a pull request. The instructions for doing this make no sense to me since I am not even a casual user of github. If anyone wants the latest code, please get it here until I have a chance to figure out what the heck I am doing.
Hey keith thx you for this awesome script.  I wonder if its possible to send a x number of cards to a player by having a query something like !deal --give ?{Nr|1} --Tarot ? Another question, this only work with selected tokens? or do I have to add something else?
Oh man, I just tested and this script is amazing! exactly what I need it. This can be use to have money tokens now. For example in my game I use money and it always been clumpy to add the money. but with this script is just a click away. Here is an example and here is the macros I have made for them. !deal --give ?{Nr|1} --?{Type|Gold Crowns|Silver Shillings|Brass Copper} !deal --take ?{Nr|1} --?{Type|Gold Crowns|Silver Shillings|Brass Copper} Thx you for this Keith, Now i can have an economy going in my games without being clumpy.
1570970747
GiGs
Pro
Sheet Author
API Scripter
That;s a great way to use it. I used cards for hero points and other expendable resources, and money is the ultimate version. Though having, say, 20,000 gold pieces might be pushing the system so I'd be create some intermediate value coins (like 10gp and 100gp coins) to manage the higher amounts.
1570981292
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There's Platinum Pieces (10gp), and I have seen some settings that use bars equal to 10 or 100x coin value.
Keith, Would it be possible in the future, to have more than 1 token selected when dealing cards?
1570984761
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I'll look into it when I next revisit the script, sure.
Playing with this script some more and found that you can give the Named Card but you cannot take the named card. !deal --give --Healing|?{Type?|Common Healing Potion|Greater Healing Potion|Superior Healing Potion|Supreme Healing Potion|Resurrection|True Resurrection} and !deal --take --Healing|?{Type?|Common Healing Potion|Greater Healing Potion|Superior Healing Potion|Supreme Healing Potion|Resurrection|True Resurrection} Both give the card to the player.
1573977572
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks Kilter. I'll look into that.
Hey Keith. I am getting an error with 1 of my players. I am unable to give him or take cards from him. I was checking the API Console And i am getting this.  do you know what it can be?
1574801544

Edited 1574801607
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Can you describe what you were doing (dealing, taking, etc), and post the macro command you used? Oh, and also the name of the token/character selected.
Hey Keith, It seems if a player is log on to long time after a while it kind of "disconnect" the player and i could not deal to him since I could not find him. My player relog and everything was working as it is
1574868885
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Whew, because I don't think I could have addressed a problem like that.
1575093948
Mino
Marketplace Creator
Would it be possible to deal up to a certain number of cards? For instance, if I had a player who was supposed to have 4 1st Level Spell Slots after a long rest, would it be possible to add a command that deals them the appropriate card until they have 4 in their hand? Assuming they start with 1 card, they would need to be dealt 3 to add up to 4. That sorta thing.
1575094162
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hmm, to "fill in a hand"? Probably. I'm a slow programmer though, so I'd need to set aside a chunk of time. Maybe during the Winter Break...