FANDOM

Lycentia

  • I live in USA
  • I was born on June 20
  • I am Female
A FANDOM user
  Loading editor
  • Your template is lovely, but there's a problem, it takes the upgrades in order, but the game doesn't order them by tier. Your example actually suffers from this problem. I don't know a ton about MW templates or how this might be fixed, but for now I can just manually reorder the templates.

    It looks fucking great and very useful aside from that, though.

      Loading editor
    • Wait, why would I do it manually?

      import re
      
      try:
        input = raw_input
      except NameError:
        pass
      
      upgrade_re = re.compile('^[A-Z]{2}\d$')
      
      def reorder(template):
        items = template.split(',')
        tiers = [[], [], []]
        spells = []
        factions = set()
        for x in items:
          if (x[:3] == "SP:"):
            spells.append(x)
          elif (upgrade_re.match(x)):
            factions.add(x[:2])
            n = int(x[2])
            tiers[(n-1)/3].append(x)
          else:
            print('hm, that doesn\'t look right: {}'.format(x))
        upgrades = ','.join(','.join(x) for x in tiers)
        template = ','.join([upgrades] + spells)
        harlequin = len(factions)**3
        return "|template = {}\n|harlequin = {}".format(template, harlequin)
      
      if (__name__ == '__main__'):
        try:
          import pyperclip
        except ImportError:
          print('no pyperclip, have to copy manually')
        while (True):
          stuff = input('>> ')
          result = reorder(stuff)
          print(result)
          if (pyperclip):
            pyperclip.copy(result)
      
      

      That should do the trick.

      • Edit: updated it, added harlequin as well
      • Edit II: the editening: switched to a nicer to use input loop rather than command line args
        Loading editor
    • Well, hell. I didn't know the game spits them out like that. I didn't notice in my example either (never code while tired).
      I guess people will have to live with the inconvenience of reordering it, because I'm not totally sure how I would be able to compensate for it.
      Maybe we could just get the devs to change the export output. XD

        Loading editor
    • Heh, good luck getting the devs to do anything useful. The game outputs them in instantiation order, I'm pretty sure, which goes by faction.

      And yeah, I looked a bit at the parser functions features you used (plus I had to get them enabled on the shadow wiki on miraheze). They don't seem to really be smart enough to do anything like that. Maybe a scribunto module would be the way to go.

        Loading editor
    • Well, don't look at me. XD I never really could figure out lua.

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.