LotR TCG Wiki → Card Sets:  All 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 → Forums:  TLHH CC

Author Topic: Announcing VKIT: A tool for producing printable PDFs  (Read 5886 times)

0 Members and 1 Guest are viewing this topic.

November 15, 2022, 10:45:17 PM
Read 5886 times

TelTura

  • *****
  • Information Offline
  • Ranger
  • Administrator
  • Posts: 836
    • Player's Council Discord
Announcing VKIT: A tool for producing printable PDFs
« on: November 15, 2022, 10:45:17 PM »
https://pdf.lotrtcgpc.net

People are always asking the best way to print off proxy cards, and now there's an answer.  The Player's Council has stolen the code for VKIT from the SWCCG-PC, and adapted it for use with the LOTR-TCG.

Basically, select any cards you want in any combination, then click a button for the utility to download and arrange all your selected cards into one of two formats: 3x3 PDF (for printing at home), or individual PNGs with a custom bleed margin (for use with professional services).

This tool includes all PC cards (including PC errata and V1), as well as all unique Decipher cards.  This tool omits Masterworks, RF, Tengwar, Oversized cards, and Promo reprints as a pre-emptive curtailing of potential counterfeit issues. 

If you have any questions, ask away!









An example of what it means to put a bleed margin on:



Come join the Player's Council to help us run events, create new cards, and steer the direction of this great game!

Join our Discord here for more information.

January 09, 2024, 04:49:02 PM
Reply #1

Witchkingx5

  • *****
  • Information Offline
  • Knight
  • Posts: 1159
Re: Announcing VKIT: A tool for producing printable PDFs
« Reply #1 on: January 09, 2024, 04:49:02 PM »
Silly question, but is there a way to import entire decklists, e.g. through GEMP export?

January 16, 2024, 01:11:56 PM
Reply #2

Phallen Cassidy

  • *****
  • Information Offline
  • Bowman
  • Global Mod
  • Posts: 497
Re: Announcing VKIT: A tool for producing printable PDFs
« Reply #2 on: January 16, 2024, 01:11:56 PM »
Not a silly question. There is a way, but it's a bit technical -- you'll want some sort of program-ish thing to help you. I'll plan to map out the steps and give an Excel formula to fill in the gaps. At some point.

January 25, 2024, 07:40:55 AM
Reply #3

Witchkingx5

  • *****
  • Information Offline
  • Knight
  • Posts: 1159
Re: Announcing VKIT: A tool for producing printable PDFs
« Reply #3 on: January 25, 2024, 07:40:55 AM »
Sounds amazing, thank you very much in advance whenever you get to it! :)

January 27, 2024, 09:51:49 AM
Reply #4

TelTura

  • *****
  • Information Offline
  • Ranger
  • Administrator
  • Posts: 836
    • Player's Council Discord
Re: Announcing VKIT: A tool for producing printable PDFs
« Reply #4 on: January 27, 2024, 09:51:49 AM »
At some point we should probably put a decklist importer in.  The original VKIT from the SWCCG has an xml importer (which is the format their gemp uses), which ought to be adaptable.
Come join the Player's Council to help us run events, create new cards, and steer the direction of this great game!

Join our Discord here for more information.

February 12, 2024, 08:44:29 AM
Reply #5

Phallen Cassidy

  • *****
  • Information Offline
  • Bowman
  • Global Mod
  • Posts: 497
Re: Announcing VKIT: A tool for producing printable PDFs
« Reply #5 on: February 12, 2024, 08:44:29 AM »
Eventually has arrived! This wound up A LOT more complicated than I remembered, you have to negotiate between 3 data sources before you even get to the programming part I mentioned to format the decklist properly. What's worse, Excel is super localized so I can't just write one formula for everyone to use -- if your system language is German or French or even English (United Kingdom) you will have to make some changes. So first I'll say what we're going to do and then I'll get into how to do it. You may need to figure out some workarounds for the "how" depending on your setup.

Basically, we're tricking the deck importer into adding what we want it to add. Go to VKIT and filter down until you have a single card. I filter for 000 to bring up the card back. Right click on it and select the last option, "Inspect". This brings you to the computer instructions to generate the page you're looking at, highlighting the spot for the card. When you click Add in VKIT, the program checks this spot and recreates all highlighted options to the right so they can be put on a PDF. Right-click on that and pick "edit as HTML." Now you can change the code. Perhaps you can see where we're going with this: if we had an entire decklist here instead of just one card, the program could move that over to the right all at once.  The part in quotes after "value=" is what will be added to the right and where the text is repeated is what shows on the left.

We have our goal. All we need is a decklist formatted to look like the options VKIT wants to see, then we can paste it over the code for the single card on the right. We immediately run into our first problem: VKIT uses card ID rather than just title, so you'll need some source for the IDs.

Kralik posted the spreadsheet that was the basis of the wiki here: http://lotrtcgwiki.com/files/CardData.xls
If you download it we'll have something that mostly lines up with VKIT. There are some typos or differences, 5 or fewer, Speak "Friend" and Enter for example uses different quotation marks between the two. Easily overcome. That's between the VKIT and the spreadsheet though. But we want to go from Gemp to the VKIT, meaning Gemp to spreadsheet to VKIT, which unfortunately means we're not done with data inconsistencies. The Nazgul names famously won't link on the forums because Gemp uses accents while the forums (and the VKIT) do not. Úlairë Enquëa, Lieutenant of Morgul comes up empty, we need Ulaire Enquea, Lieutenant of Morgul. Case matters, too. Lieutenant Of Morgul will not work for VKIT.

I'm going to solve this in Excel. This wound up being a problem because Excel is a very casual kind of program translated into dozens of languages. What I have here may not work for you if the formula names in all caps have to be translated to your system language. You'll also probably need to replace all commas with semicolons, I think only Excel for United States uses commas. I've still got the instructions below, but it'll be up to the individual to translate this into whatever language necessary. Here's what appeared to be a useful resource on the matter: https://edu.gcfglobal.org/en/excel-tips/understanding-regional-differences-in-excel/1/
You could also get around the regional differences by changing Excel to use English (United States). As with everything about this sort of thing, else I don't know what other issues that might cause (especially if you use Excel yourself) and I can't help with it.

With that out of the way, let's get started. Paste your decklist into the spreadsheet at cell T1 (technically you can put it anywhere, but the formulas below expect it to be here). In column U we're going to strip out all the non-English characters in card titles from Gemp so we can match them to titles in the spreadsheet. Here's that formula:
Quote from: Put this in U1
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(LOWER(T1),"ú","u"),"û","u"),"ë","e"),"é","e"),"ó","o")
If nothing happens, change the formatting at the top from "Text" to "General" then click on the cell and press enter again. If it gives you an error and you're not in the US, you'll need to translate the formula names in all caps and change all the commas to semicolons. Remove the "=" at the start and do find-and-replace to fix these regional issues. Sorry to say I'll be of minimal help here, if you overcome any problems leave a message for future generations. I'm pretty sure it'll work in all versions of Excel, and I'd like to believe that OpenOffice or something similar will let you use Excel formula names? If anyone is using OpenOffice and has trouble let me know and I'll rewrite the formula to be in that syntax.

First problem is solved, we have a way to get from the Gemp title to the card ID. Now we need to have them formatted properly. Remember, <option value="ID_### - Card Name"><\option> is all we need. The formula to format our card names is this:
Quote from: Put this in V1
="<option value="""&LEFT(RIGHT(INDEX($C$2:$C$3497,MATCH(IF(LEFT(U1,4)="Ring",RIGHT(U1,LEN(U1)-SEARCH(":",U1)-1),IFERROR(RIGHT(U1,LEN(U1)-SEARCH("x ",U1)-1),U1)),$A$2:$A$3497,0)),5),2)&"_"&RIGHT(INDEX($C$2:$C$3497,MATCH(IF(LEFT(U1,4)="Ring",RIGHT(U1,LEN(U1)-SEARCH(":",U1)-1),IFERROR(RIGHT(U1,LEN(U1)-SEARCH("x ",U1)-1),U1)),$A$2:$A$3497,0)),3)&" - "&INDEX($A$2:$A$3497,MATCH(IF(LEFT(U1,4)="Ring",RIGHT(U1,LEN(U1)-SEARCH(":",U1)-1),IFERROR(RIGHT(U1,LEN(U1)-SEARCH("x ",U1)-1),U1)),$A$2:$A$3497,0))&""">"&U1&"</option>"
Then copy the formula fields in U1 and V1 down to the length of your decklist in column T. Hopefully (barring any regional differences in Excel formulas) we have a list.

Our final problem is now upon us: decklists consolidate duplicate copies while VKIT lists them all individually. The simplest way is to paste in your decklist with single lines for every card, then paste in any cards with 2x or more, then 3x or more, then finally any 4x copies. VKIT does helpfully group cards by title so the finished product will look right. But that means pasting your decklist 4 times and we can improve on that without much effort. Put a 1 in W1 and put this formula below it:
Quote from: Put this in W2
=IF(ISNA(V2),W1,W1+IFERROR(NUMBERVALUE(LEFT(T2)),1))

Then put a 1 in Y1 and this formula below that:
Quote from: Put this in Y2
=Y1+1

Drag W2 down to the length of your decklist and Y2 down until it's as least as many as the last number in W (I would just go to 200 or something, enough for all the cards in any of your decks). And now to reap the fruits of your labors:
Quote from: Put this in Z1
=INDEX(V:V,MATCH(Y1,W:W,1)+1)

Carry it down and you've got your full decklist formatted for VKIT. Finally, we're ready to make our decklist into a PDF. Copy all the non-N/A cells in column Z, go back to VKIT, filter for a card, right-click > inspect, right click > edit as HTML, paste. Click somewhere else in the inspect dialog box and watch as that one card you don't care about turns into all the cards that you do. Click on the first entry, hold shift, then scroll down and click on the last entry to select them all. Then "Add". BAM. Generate your decklist.

WARNING: the VKIT is definitely not meant to do this. Like I said, we're tricking it into doing what we want. I tried to do 10 decks at once and crashed my entire computer so... I don't recommend trying to add a ton of cards all at once. I would bet that you can still put them all on one PDF by clicking "Add" on just one of them at a time, but do this at your own risk.

Whew! Yeah, I forgot about the title mismatches between Gemp and the spreadsheet and VKIT. But once you do all the above steps, you save your spreadsheet and all the setup is finished. Then you can cut and paste everything to a new tab, clean it up a bit, whatever you want. I expect that ketura, seeing the steps all laid out, will soon update VKIT to just load a decklist and render all of these instructions unnecessary. But in a way that means the instructions have done their job: a user can convert a decklist to a PDF :P