MagicSetEditor2 icon indicating copy to clipboard operation
MagicSetEditor2 copied to clipboard

card has no member 'styling_data'

Open fenhl opened this issue 4 years ago • 2 comments

I'm trying to access a card's styling data in an export template so I can check whether an M15 Mainframe card has a color indicator (which is shown/hidden based on a styling option) in the MTG JSON exporter I'm writing. According to the 2.0 docs, cards should have a styling_data field, but testing in the console gives the error “card has no member 'styling_data'”. Has this field been removed?

fenhl avatar Aug 28 '20 19:08 fenhl

For this particular case the has_identity() function is probably the better solution, M15 Mainframe and its DFC and planeswalkers use it and its in the script file so every template has access to it, though they may not be set up to modify it correctly.

For styling_data in general, it seems to work fine if the card has styling data, but you need to call the specific field you need: Image

CajunAvenger avatar Sep 08 '20 14:09 CajunAvenger

The styling_data field is currently only exposed when a card has customized styling ("options specific to this card") and when it uses a non-default stylesheet. That is not very useful for scripting.

What makes this tricky is that internally, when using the set's default values, the card doesn't have any styling_data. So you would have to do something like card.styling_data or else set.styling_data[stylesheet.name].

twanvl avatar Sep 26 '20 23:09 twanvl