Difference between revisions of "Calamity track/Script"

From Wildermyth Wiki
Line 64: Line 64:
         if k == 0:
         if k == 0:
           if 'onlyIfFlavorHasCards' in tracks[j]:
           if 'onlyIfFlavorHasCards' in tracks[j]:
             add_entry(card_list,flavor,tracks[j]['onlyIfFlavorHasCards'],{'name':cardName + ' %s'%cardNumbers[k],'cards':monsters,'count':k+1,'position':j})
             add_entry(card_list,flavor,tracks[j]['onlyIfFlavorHasCards'],{'name':cardName,'numeral':cardNumbers[k],'cards':monsters,'count':k+1,'position':j})
             max_cards = max(tracks[j]['onlyIfFlavorHasCards'],max_cards)
             max_cards = max(tracks[j]['onlyIfFlavorHasCards'],max_cards)
           else:
           else:
             add_entry(card_list,flavor,0,{'name':cardName + ' %s'%cardNumbers[k],'cards':monsters,'count':k+1,'position':j})
             add_entry(card_list,flavor,0,{'name':cardName,'numeral':cardNumbers[k],'cards':monsters,'count':k+1,'position':j})
         else:
         else:
           if 'trackAdvanceThresholds' in tracks[j]:
           if 'trackAdvanceThresholds' in tracks[j]:
             add_entry(card_list,flavor,tracks[j]['trackAdvanceThresholds'][k-1],{'name':cardName + ' %s'%cardNumbers[k],'cards':monsters,'count':k+1})
             add_entry(card_list,flavor,tracks[j]['trackAdvanceThresholds'][k-1],{'name':cardName,'numeral':cardNumbers[k],'cards':monsters,'count':k+1})
             max_cards = max(tracks[j]['trackAdvanceThresholds'][k-1],max_cards)
             max_cards = max(tracks[j]['trackAdvanceThresholds'][k-1],max_cards)
           else:
           else:
Line 96: Line 96:
         if 'position' in card and card['position'] < 2:
         if 'position' in card and card['position'] < 2:
           string += "''"
           string += "''"
         string += card['name']
         string += '[[%s|%s]] %s'%(card['cards'][0],card['name'],card['numeral'])
         if 'position' in card and card['position'] < 2:
         if 'position' in card and card['position'] < 2:
           string += "''"
           string += "''"

Revision as of 04:50, 20 February 2022

This is a Python script to generate the calamity track table. Copy the code in the box below into a text file named calamityTable.py (or whatever you want) inside the Wildermyth directory. Then run it by calling python calamityTable.py from the command line. It will create a text file named calamityTable.txt, which is wiki-formatted and can be pasted into the calamity track page.