andymeneely / squib

A Ruby DSL for prototyping card games.
http://squib.rocks
MIT License
918 stars 67 forks source link

Flag for "Qty" column? #222

Closed JKochosky closed 7 years ago

JKochosky commented 7 years ago

I've been loving Squib since I discovered it, and I recently came up with an idea for a possible enhancement.

The use of the "Qty" column when creating multiple cards with the same face is extremely helpful, but I do a lot of my prototyping via The Game Crafter site, where I can set the quantity I need of a particular card, rather than having to load the same card multiple times.

I would love to see an option (perhaps in the config.yml file) to turn the Qty feature on or off, depending on whether you're creating images for TGC or its ilk, or if you're setting up an PnP document where you need all copies of each card shown.

Thank you.

andymeneely commented 7 years ago

You can! The csv and xlsx have an explode option set to Qty by default. http://squib.readthedocs.io/en/v0.13/dsl/csv.html

If you want to change it on the fly, this is perfect for build groups. Have one group for TGC and the other for PnP. Or just use an environment variable and Rake. Here's an untested snippet off the top of my head:

require 'squib'

explode_col = ENV['SQUIB_EXPLODE'].eql?('TRUE') ? 'Qty' : ''
Squib.csv file: 'data/characters.csv', explode: explode_col

Then set your environment var on the command line or via Rake.

Or, you can ALWAYS do quantity explosion and then use range to save only what you need when it comes time to save. That lets you do build groups.

I'll try to include this kind of stuff when I finish writing this tutorial: http://squib.readthedocs.io/en/v0.13/guides/getting-started/part_3_workflows.html

andymeneely commented 7 years ago

(Added the docs label so I remember to look over this when I get to that tutorial)

JKochosky commented 7 years ago

Excellent! Thank you very much for pointing me in the right direction.