Skip to Content
 

Using XML for card editing

12 replies [Last post]
Ludomancer
Ludomancer's picture
Offline
Joined: 06/25/2011

Hey guys,

I'm spent a very frustrating day trying to get something to work.

I have created an XML file that contains the text for all of my cards, as well as info such as the file name/location of the images on the cards.
Now I want to apply the XML info to another program.

Essentially, I want an easy way to update lots of cards at once. Currently, I can make XML changes and import them into Excel or vice versa. Very useful, as I can use Excel's sort functions to see only 'Beast' cards, count keyword instances and etc.

What I want to do now is integrate the text into a printable layout, with a border, image and etc (i.e. something that actually looks like a card). I would like the text of the cards to be instantly updateable from my XML. Is there any program that will let me do this?

P.S. I've attached the Excel sheet, if anyone is interested. This also serves to 'publish' and copyright the card text. Use the drop-down dorting menus to see particular decks or card types.

Yamahako
Offline
Joined: 12/01/2010
I have a software package

I have a software package that I designed with my brother in law that lets me take a spreadsheet of card data - and then through a web interface arrange the cells of that sheet (as either text or images) where I want them to exist and then applies the template to all of the cards in the spreadsheet to produce High Res print sheets (in PDF or PNG format) for play testing. (Actually we also used this to make the printer sheets for Orbit).

This is a product that we've been considering making for an external audience (presumably, at some point to generate income). Is this something like what you're talking about? Adding the XML I think is a step taken that basically replicates the web interface portion of the tool, but it might be possible to have the tool interpret the XML into the interface.

whoshim
Offline
Joined: 05/02/2011
NanDeck is what you want. It

NanDeck is what you want. It is really great for this sort of thing. (http://www.nand.it/nandeck/) There are all kinds of tutorials on the site, but if you need some help, let me know.

Ludomancer
Ludomancer's picture
Offline
Joined: 06/25/2011
Yay software

whoshim wrote:
NanDeck is what you want. It is really great for this sort of thing. (http://www.nand.it/nandeck/) There are all kinds of tutorials on the site, but if you need some help, let me know.

I checked out Nandeck, but I felt like I'd have to learn a new scripting language to really use it. Most of the manual goes over my head. However, if it has a function where I can auto-grab text from my XML tags, I'd be happy to learn. Please let me know.

Yamahako wrote:
I have a software package that I designed with my brother in law that lets me take a spreadsheet of card data - and then through a web interface arrange the cells of that sheet (as either text or images) where I want them to exist and then applies the template to all of the cards

This sound more like my speed. I can already auto-update my spreadsheet; if I could then auto-update cards that I can print, it would be perfect. Please respond or PM me if you'd be willing to donate your software to a good cause.

Thanks for the help guys!

Yamahako
Offline
Joined: 12/01/2010
Our intention is to make the

Our intention is to make the software available soon for some alpha testing so we can get feedback from the community about what features should be added. I will see today if there's some opportunity to make this available for you. It's completely functional tool right now - but since it was designed for internal use first, the documentation isn't there.

Ludomancer wrote:
whoshim wrote:
NanDeck is what you want. It is really great for this sort of thing. (http://www.nand.it/nandeck/) There are all kinds of tutorials on the site, but if you need some help, let me know.

I checked out Nandeck, but I felt like I'd have to learn a new scripting language to really use it. Most of the manual goes over my head. However, if it has a function where I can auto-grab text from my XML tags, I'd be happy to learn. Please let me know.

Yamahako wrote:
I have a software package that I designed with my brother in law that lets me take a spreadsheet of card data - and then through a web interface arrange the cells of that sheet (as either text or images) where I want them to exist and then applies the template to all of the cards

This sound more like my speed. I can already auto-update my spreadsheet; if I could then auto-update cards that I can print, it would be perfect. Please respond or PM me if you'd be willing to donate your software to a good cause.

Thanks for the help guys!

whoshim
Offline
Joined: 05/02/2011
After seeing your post, I

After seeing your post, I started writing a guide. I hope to have it up soon. I will put in some code that you can copy and paste and slightly modify.

InvisibleJon
InvisibleJon's picture
Offline
Joined: 07/27/2008
Adobe InDesign can import XML into a multi-page layout.

Ludomancer wrote:
I want an easy way to update lots of cards at once. ... What I want to do now is integrate the text into a printable layout, with a border, image and etc (i.e. something that actually looks like a card). I would like the text of the cards to be instantly updateable from my XML. Is there any program that will let me do this?
Adobe InDesign can do this.

CS3: http://livedocs.adobe.com/en_US/InDesign/5.0/help.html?content=WS7F9C368...
CS4: http://help.adobe.com/en_US/InDesign/6.0/WSa285fff53dea4f8617383751001ea...

It's a lot more expensive than "free," but it's also a lot more powerful.

Ludomancer
Ludomancer's picture
Offline
Joined: 06/25/2011
InDesign is...

Thanks for the advice jon, but InDesign is the first thing I tried. It doesn't handle repeating content very well, so I'd have to build each card seperately (or use a table, which I can already do).

I need something where either I can build one card template and then fill multiple instances with different cards, or something that will let me auto-build all my cards at once. Thanks anyway.

whoshim
Offline
Joined: 05/02/2011
Here is the quick and dirty

Here is the quick and dirty version, since it may be some time before I complete my guide as I want it. Here is the code I am using for my game (notes about each part will be set off with {{ }} ):

--.00847 cm is 1 pixel {{This is used for going from a PNG, JPG, or BMP to the nanDECK measurements}}

CARDS=457
BORDER=RECTANGLE
PAGE=24,32.7,Portrait {{This is the page layout in cm. It is probably too big for most normal printers, but I just use it for generating PDFs to read on the computer.}}
DPI=300
CARDSIZE=6.985,9.525 {{My cards in pixel size are 825 x 1125}}
MARGINS=1,1,1,1
GAP=0,0

LINK="Testrun1.txt" {{This is the link to the txt file. The txt file is created from the spreadsheet. Save your spreadsheet as a comma separated file, then convert it from csv into txt}}

{{These next sections define different words used throughout the code}}

[all]=1-{(power)}

[back_kn]="Koine_Noun_Background.png"
[back_kv]="Koine_Verb_Background.png"
[back_ko]="Koine_Other_Background.png"
[back_kpn]="Koine_Proper_Noun_Background.png"

[arrows_u]="C:\Documents and Settings\Us\Desktop\Dallas\LLCG\U.png"
[arrows_d]="C:\Documents and Settings\Us\Desktop\Dallas\LLCG\D.png"
[arrows_l]="C:\Documents and Settings\Us\Desktop\Dallas\LLCG\L.png"
[arrows_r]="C:\Documents and Settings\Us\Desktop\Dallas\LLCG\R.png"
[arrows_ul]="C:\Documents and Settings\Us\Desktop\Dallas\LLCG\UL.png"
[arrows_ur]="C:\Documents and Settings\Us\Desktop\Dallas\LLCG\UR.png"
[arrows_dl]="C:\Documents and Settings\Us\Desktop\Dallas\LLCG\DL.png"
[arrows_dr]="C:\Documents and Settings\Us\Desktop\Dallas\LLCG\DR.png"

[red]=#FF0000
[black]=#000000

--Background--
if=[type]=kn
image=[all],[back_kn],0.00,0.00,6.985,9.525
endif

{{^^^In my spreadsheet, I have a column entitled TYPE. In the column, there are types kn, kv, ko, and kpn. This line means that if the TYPE if kn, then it will display the background image defined by BACK_KN above.}}

if=[type]=kv
image=[all],[back_kv],0.00,0.00,6.985,9.525
endif

if=[type]=ko
image=[all],[back_ko],0.00,0.00,6.985,9.525
endif

if=[type]=kpn
image=[all],[back_kpn],0.00,0.00,6.985,9.525
endif

--Title-- {{This section creates the name of the card. It reads the text in the NAME column of my document. The numbers represent the X start, Y start, X length, and Y length for the text box.}}
FONT=Greek,12,T,#000000
TEXT=[all],[name],1.7,1.27,6.985,.635,left,center,0,100

--Gametext Box-- {{Same as title section above, but for gametext. This uses the WORDWRAP command at the end, so that it can render multiple lines of text.}}
FONT=Cambria,8,T,#000000
TEXT=[all],[text],1.4,5.61,4.185,2.55,left,wordwrap

--Definition Box-- {{Same as above, but it centers the text in the text box.}}
FONT=Cambria,8,T,#000000
TEXT=[all],[definition],5.7,5.35,.635,2.6,CENTER,CENTER,90

--Power--
FONT=texgyreschola,18,T,#FFFFFF
TEXT=[all],[power],.475,6.3,1,.635

--Cost--
FONT=texgyreschola,16,T,#000000
TEXT=[all],[cost],.975,1.23,.635,.635

--Poker Code-- {{The following bit puts poker values and symbols on the cards. There is a more elegant way to do this, but I just wrote out the amount up to 468 cards.}}
[poker_val]=texgyreschola,16,T
[poker_suit]=symbol,20,T
[poker_val_pos]=.475,1.99,1,.635
[poker_suit_pos]=.475,2.46,1,.635

[val]="A|K|Q|J|X|9|8|7|6|5|4|3|2"

font=[poker_val],[red]
text="14-39,66-91,118-143,170-195,222-247,274-299,326-351,378-403,430-455",[val],[poker_val_pos]
font=[poker_suit],[red]
text="14-26,66-78,118-130,170-182,222-234,274-286,326-338,378-390,430-442","\169\",[poker_suit_pos]
text="27-39,79-91,131-143,183-195,235-247,287-299,339-351,391-403,443-455","\168\",[poker_suit_pos]

font=[poker_val],[black]
text="1-13,40-65,92-117,144-169,196-221,248-273,300-325,352-377,404-429,456-468",[val],[poker_val_pos]
font=[poker_suit],[black]
text="40-52,92-104,144-156,196-208,248-260,300-312,352-364,404-416,456-468","\167\",[poker_suit_pos]
text="1-13,53-65,105-117,157-169,209-221,261-273,313-325,365-377,417-429","\170\",[poker_suit_pos]

--Arrows-- {{My cards have arrows in the corners. These arrows are images I have made that are the same size as the total image (though most of the image is blank). These read the columns, U,D,L,R,UL,UR,DL,DR, and if 'y', then they display the image. I defined all the images above [arrows_u] etc.}}
if=[u]=y
image=[all],[arrows_u],0.00,0.00,6.985,9.525,0,"T"
endif

if=[d]=y
image=[all],[arrows_d],0.00,0.00,6.985,9.525,0,"T"
endif

if=[l]=y
image=[all],[arrows_l],0.00,0.00,6.985,9.525,0,"T"
endif

if=[r]=y
image=[all],[arrows_r],0.00,0.00,6.985,9.525,0,"T"
endif

if=[ul]=y
image=[all],[arrows_ul],0.00,0.00,6.985,9.525,0,"T"
endif

if=[ur]=y
image=[all],[arrows_ur],0.00,0.00,6.985,9.525,0,"T"
endif

if=[dl]=y
image=[all],[arrows_dl],0.00,0.00,6.985,9.525,0,"T"
endif

if=[dr]=y
image=[all],[arrows_dr],0.00,0.00,6.985,9.525,0,"T"
endif

--Images-- {{This section reads the images I have in the Images folder. These images are numbered just like the cards, and so it will match the image to the card. The images are all 505 x 400, and the image definition numbers below (in the bottom line) define a box that is that big. The numbers are, again, X start, Y start, X length, Y length. (So, 4.27735 cm = 505 pixels, and 3.388 cm = 400 pixels).}}

[picture]=dirfiles("C:\Documents and Settings\Us\Desktop\Dallas\LLCG\Images\",png)

image=1-457,[picture],1.3552,2.0328,4.27735,3.388

---

So, you need to have column headers in your spreadsheet. Save it as a CSV, then as a txt. You can put your column names in [] so that nanDECK will read it. So, you could use the following code:

CARDS=100
BORDER=RECTANGLE
PAGE=24,32.7,Portrait
DPI=300
CARDSIZE=6.985,9.525
MARGINS=1,1,1,1
GAP=0,0

LINK="MyGame.txt"

[all]=1-{(cardnumber)}

--Title--
FONT=Arial,12,T,#000000
TEXT=[all],[name],1.7,1.27,6.985,.635,left,center,0,100

--Gametext Box--
FONT=Arial,8,T,#000000
TEXT=[all],[text],1.4,5.61,4.185,2.55,left,wordwrap

If you name your spreadsheet saved as a text as MyGame.txt, and had columns titled NAME and TEXT, it would display those in the certain areas of the card. You also need a CARDNUMBER column. This code will do 100 cards (see the first line of the code), at 825 x 1125 pixels. The text doc needs to be in the same folder as your nanDECK document code is saved, otherwise you will have to put a full path to the document. If you have any more questions, let me know.

EDIT: I had forgotten a line for the code you would need (a definition for [all]). It should work.

Ludomancer
Ludomancer's picture
Offline
Joined: 06/25/2011
Looks good

I think I actually understand this! I'll try it and see how it comes out.

Thanks a lot!

whoshim
Offline
Joined: 05/02/2011
I forgo to note above that

I forgo to note above that you can also do text at an angle.

FONT=Cambria,8,T,#000000
TEXT=[all],[definition],5.7,5.35,.635,2.6,CENTER,CENTER,90

The 90 at the end is the amount of degrees.

Let me know how things go. Once you use it a little bit, check back at the nanDECK site and look through the tutorials. You should be able to understand them at a glance. It may seem like a lot at first, but the program is well made and is pretty consistent, so it is easy to learn quickly. You can also ask any questions on BGG in the nanDECK user area: http://boardgamegeek.com/forum/26631/nandeck-users/general. The programmer usually responds quickly.

pelle
pelle's picture
Offline
Joined: 08/11/2008
Yet another one: my free

Yet another one: my free inkscape tool
. text in csv, layout in svg (draw wysiwyg in inkscape or import). Search for inkscape countersheet here and on bgg forums for details. m

nand
nand's picture
Offline
Joined: 07/27/2008
whoshim wrote:Let me know how

whoshim wrote:
Let me know how things go. Once you use it a little bit, check back at the nanDECK site and look through the tutorials. You should be able to understand them at a glance. It may seem like a lot at first, but the program is well made and is pretty consistent, so it is easy to learn quickly. You can also ask any questions on BGG in the nanDECK user area: http://boardgamegeek.com/forum/26631/nandeck-users/general. The programmer usually responds quickly.

Thanks, Whoshim, for proposing my program (and explaining it in such a detailed manner) ;-)

I'll make only an addition: in the latest version of nanDECK you can LINK directly an Excel file (instead of a CSV), the syntax is the same.

Feel free to ask here (or by email) if you have any question.

Bye,
Nand

Syndicate content


forum | by Dr. Radut