Card Pool / Add a Pack problem (in multiple plugins)

Started by Penagain, May 12, 2020, 08:49:10 AM

Previous topic - Next topic

Penagain

Hello!

I'm running Lackey on my Mac and am running into a problem with both of the plugins that I use--Babylon 5 and Magi-Nation--where nothing appears to happen when I try to open a pack in card pool. Pack graphics don't load, pack names are incomplete (but are complete in the packdefinitions.txt file), and no cards appear no matter what I do.

It isn't a deal breaker by any means--I just wondered if there was something I could do to fix it (with my very limited skills) or if this is a bigger problem.

Any help the wise folks here can provide would be very appreciated!

CrazyChucky

#1
I installed those two plugins, just now, to test. I get the same results. (My existing MTG installation still works fine.) Not sure yet what the actual issue is, but at least we can be pretty certain it's a problem with the plugins, not some local system issue or Lackey setting.

Edit: I think I see the issue. These plugins use what looks to be an earlier format for pack definitions, before Trevor settled on his "1.0" XML syntax. I dug around to see if any other plugins I have installed use the same pack format; LOTR does, and it displays the same buggy behavior.

If you're feeling industrious, you could probably follow that guide and update the pack definitions to the newer syntax. (Liberal use of search-and-replace would no doubt come in handy.) I don't know if either of those plugins is still maintained, but if so, you could also contact the maintainers about this.

Penagain

Thanks for investigating this for me!

My question is, how do I make the XML version of the file get read by the plugin?

I know that when there is a Packdefinitions file, the Card Pool tab shows up in Lackey, and when there is not, it does not. (At least, I think I know that :)) But when I create a Packdefinitions.xml file and put it in there... it doesn't trigger the Card Pool tab to show up.

So do I just use the XML programing from the page you linked me to... but in a packdefinitions.txt file?

I freely confess this is all a bit over my head, but I'm stubbornly willing to learn :)

CrazyChucky

#3
You're in good company here! In over my head but stubbornly willing to learn is exactly how I started out when I took on responsibility for the Magic plugin. (Not that this should be anywhere near THAT big an undertaking...)

Did you put pack definitions in your packdefinitions.xml file? If you left it blank, or your formatting is incorrect, that could be causing an issue.

It might be helpful, in troubleshooting, to copy one of the pack definition files from the Magic plugin (or any other plugin with currently working packs). None of the packs will probably be able to actually load cards, since they'll be referring to set names that probably don't exist in your plugin, but the pack selector should at least show up and display the available pack titles.

Penagain

I'm going to do some more exploring and experimenting! Thank you so much for your help... I wouldn't be surprised if I wind up back here with more questions :)

Penagain

IT IS WORKING! And you, CrazyChucky... you are MY HERO!

I have a lot to do still, but I copied your Magic plugin and then just made one Magi-Nation pack by modifying your packdefinitions file, and it's working!

More to go... but you've got my feet on the path!

CrazyChucky

Heck yeah! Godspeed, and feel free to ask more questions if something stumps you.

Penagain

Will do. I had a meltdown earlier today, but realized it was because of the need to explicitly permit duplicate copies. So... so far, trial and error (and the excellent source code from your plugin) have been getting me through.

I am working on a sort of complicated multi-chance starter deck with a blend of fixed and random cards from two sets right now... so if that all falls apart, I know where to run for help :)

CrazyChucky

This may or may not be way more complicated than is helpful or warranted in your situation, but I made a tool that can help with generating chances when your pack structure gets more complex: https://www.lackeyccg.com/forum/index.php?topic=12713

I have actually improved and streamlined it a good bit since, but in a way that unfortunately is pretty tightly coupled with the rest of my Magic-plugin-generating code. No one's ever expressed interested before, so I haven't worried about it too much. But if it could be helpful to you, I could see about packaging my newer version up into a tidier and more shareable form. In its newer form, especially, it should require very little knowledge of programming in Python.

CrazyChucky

#9
For comparison, the version I previously shared requires all pack structures be defined in Python. The default layout for a Magic pack (including the crit definitions, which can be reused) looks like this:

mythic = Crit('Rarity', 'IS', 'M')
rare = Crit('Rarity', 'IS', 'R')
uncommon = Crit('Rarity', 'IS', 'U')
common = Crit('Rarity', 'IS', 'C')

default = (
  BranchPoint(
      Branch(Kind(1, mythic), prob=13),
      Branch(Kind(1, rare), prob=87),
    ),
    Kind(3, uncommon),
    Kind(10, common),
)


These days I write my pack structures in YAML, a simpler format. It's not a programming language; it's made for listing data or settings. So the above gets streamlined to:

mythic: [ Rarity, IS, M ]
rare: [ Rarity, IS, R ]
uncommon: [ Rarity, IS, U ]
common: [ Rarity, IS, C ]
---
default:
  - 13: [ 1, mythic ]
    87: [ 1, rare ]
  - [ 3, uncommon ]
  - [ 10, common ]


In either case, the Python code handles reading that, generating the pack-wide chances that Lackey expects, and outputting it as XML:

<chance>
  <prob>13</prob>
  <kind>
    <qty>1</qty>
    <crit><field>Rarity</field><eval>IS</eval><data>M</data></crit>
  </kind>
  <kind>
    <qty>3</qty>
    <crit><field>Rarity</field><eval>IS</eval><data>U</data></crit>
  </kind>
  <kind>
    <qty>10</qty>
    <crit><field>Rarity</field><eval>IS</eval><data>C</data></crit>
  </kind>
</chance>
<chance>
  <prob>87</prob>
  <kind>
    <qty>1</qty>
    <crit><field>Rarity</field><eval>IS</eval><data>R</data></crit>
  </kind>
  <kind>
    <qty>3</qty>
    <crit><field>Rarity</field><eval>IS</eval><data>U</data></crit>
  </kind>
  <kind>
    <qty>10</qty>
    <crit><field>Rarity</field><eval>IS</eval><data>C</data></crit>
  </kind>
</chance>


Let me know if you'd find this updated version handy, and I can look into extricating it into a shareable form.

Penagain

Oooh, I see how what you built there works--that's SMART!

I think I have all of the Magi-Nation packs and starter decks sorted out! So much of our conversation has helped me, I would have been completely stuck without you.

I'm going to work on Babylon 5 next, but it does not have any multi-chance packs, so I think I have the necessary skills at this point. But if things were more complex, that last bit of coding you shared would be a life-saver. Thank you again, SO MUCH, for taking the time to pitch in and help me.

Penagain

I do have a question about syntax:

I know I can set a pack to allow doubles. Can I set a Kind within the Pack to allow doubles? I tried KindDoubles and that didn't work :)

The situation is that I have a pack (a deck in this case) for a game where all the cards are fixed and one card appears three times. I know I can tediously construct that by naming each card in the pack definitions... but I have another way that works so smooth except that it won't pull those two extra copies with the pack.

I may not be explaining myself very well.

<pack>
<packtitle>Earth Alliance Starter</packtitle>
<packimage>01-Pr_sd-Hm</packimage>
<packkind>Starter</packkind>
<packcommoncrit><field>Set</field><eval>IS</eval><data>Premier</data></packcommoncrit>
<chance>
<kind>
<qty>48</qty>
<crit><field>Fixeds</field><eval>CONTAINS</eval><data>Human</data></crit>
</kind>
<kind>
<qty>2</qty>
<crit><field>Name</field><eval>IS</eval><data>Level the Playing Field</data></crit>
</kind>
</chance>
</pack>


Thoughts?

Penagain

#12
I thought I had Kind Doubles working, but now I think I was hallucinating. So help is still very much appreciated.

OK. I did it in a way that feels silly.

<pack>
<packtitle>Earth Alliance Starter</packtitle>
<packimage>01-Pr_sd-Hm</packimage>
<packkind>Starter</packkind>
<packcommoncrit><field>Set</field><eval>IS</eval><data>Premier</data></packcommoncrit>
<chance>
<kind>
<qty>47</qty>
<crit><field>Fixeds</field><eval>CONTAINS</eval><data>Human</data></crit>
</kind>
<kind>
<qty>1</qty>
<crit><field>Name</field><eval>IS</eval><data>Level the Playing Field [Pr]</data></crit>
</kind>
<kind>
<qty>1</qty>
<crit><field>Name</field><eval>IS</eval><data>Level the Playing Field [Pr]</data></crit>
</kind>
<kind>
<qty>1</qty>
<crit><field>Name</field><eval>IS</eval><data>Level the Playing Field [Pr]</data></crit>
</kind>
</chance>
</pack>


But it was NOT having it when I tried to set the quantity to 3 (because of the PackDoubles setting, I assume).