
What Does it Do?
This script allows you to pull from Decks and/or Rollable Tables. You can:
Examples:
The following examples assume that you have a "Spells" Deck and a "Spells" Rollable Table and that every value in the Rollable Table exists as a card. (There's no problem with there being card items that don't exist in the Rollable Table).
Both have the following items:
Updates & To-Do (as of March 29, 2014):
Script:
https://gist.github.com/Parmeisan/9864305
This script allows you to pull from Decks and/or Rollable Tables. You can:
- Filter the results in a variety of ways (or not).
- Get the results as a list in chat, or have tokens created from the chosen image.
- Get all the results, or one randomly selected (respecting weights, if defined).
- Since infinite decks lose their randomness (you will always pull each card, in order, then start again at the first), this script can put that randomness back in. You could have a card for all your different types of gear, define some weights on it via a Rollable table (or not, if equal weighting is fine), and then randomly select one. (Unfortunately, it can't actually deal cards yet - but it can make a token from one.)
- You can quickly get a random token from a rollable table, as opposed to only being able to roll on the table, get the first token, and then manually change it to the one you rolled.
- You can consolidate your decks and tables. For example, you might currently have several Loot tables, split up by rarity or by item type. But with this script, you can put them all together because you can choose at any time to roll on only part of the table.
- Every command must begin with !deck-util
- The second word will be interpreted as the Deck name. If invalid (e.g. "none" or "0") it doesn't use a deck.
- If a third word is entered prior to any other keywords, that's the Rollable Table. If blank or invalid, it attempts to resolve a Rollable Table with the same name as your Deck. If that fails, equal weighting is used on the Deck you entered. (You *must* include either a valid Deck or a valid Rollable Table.)
- (From this point forward, order doesn't matter unless otherwise stated.)
- If you include "!w", the result is returned to you as a whisper instead of being public.
- If you include "!all", you get all matches instead of one randomly chosen.
- If you include "!token", a token is created from the image on your card or table.
- If you include "!filter", then everything afterward until the next keyword is used to define your possible results:
- Every filter term must have quotes around it. This makes it possible to include spaces.
- Every filter term defines a condition that must be true. That is, a valid result will have ALL terms, not ANY.
- If a term begins (just after the quote) with the ^ symbol, then the condition is that the term must not be in the item name in order for that item to be a valid result.
- If a term begins (just after the quote) with the / symbol, then the rest of the string is interpreted as a regular expression. (Do not end the term with another /). So if you're wanting something more complicated, you'll want to look into Regular Expressions. One relatively simple usage would allow you to put two valid words with a | symbol separating them (no spaces) which would return results with either term.
Examples:
The following examples assume that you have a "Spells" Deck and a "Spells" Rollable Table and that every value in the Rollable Table exists as a card. (There's no problem with there being card items that don't exist in the Rollable Table).
Both have the following items:
- Buff: Armour (Novice)
- Buff: Deflection (Novice)
- Buff: Smite (Novice)
- Combat: Blast (Seasoned)
- Combat: Bolt (Novice)
- Healing: Healing (Novice)
Command | Result | Valid |
!deck-util Spells !all !filter "Buff" | Immediately lists all buff spells. | Armour, Deflection |
!deck-util 0 Spells !w !filter "/Heal|Combat" | Whispers you a random healing or combat spell, weighted per the Spells table. | Blast, Bolt, Healing |
!deck-util Spells !filter "Novice" "Combat" !token | Draws the token for a random novice combat spell, weighted per the Spells table. (In the future, I hope for this to actually draw the card instead of just a token based on it). | Bolt |
!deck-util Spells 0 !token "^Combat" "/Novice|Seasoned | Creates a token for a random non-combat novice or seasoned spell, using equal weights of 1. (Again, I'd like for it to draw the card instead of a token, but not yet.) | Armour, Deflection, Smite, Healing |
Updates & To-Do (as of March 29, 2014):
- [FUTURE] When the API allows for it, the ability to deal from the deck. This would combine nicely with my Inventory Extension script.
Script:
https://gist.github.com/Parmeisan/9864305