kt0's party script

Users who are viewing this thread

BYOB.

Also, since it's been a while:  BLAM

Do you have a hacked up parties.txt?  Would you really like to have your party data in the module system?  Are you dreading the tedious task of pushing those changes back into tuples?  If this sounds like you then it's your lucky day!

http://www.mbrepository.com/file.php?id=1210

As a test of effectiveness, I got tuples out of my parties.txt, pasted them into module_parties.py, re-compiled and diffed the output against the old parties.txt with zero differences. 

Limitations:
- Some of the values don't map 1:1 so stuff like the training fields get their flags messed up. 
- If there are icons in the parties.txt that aren't part of the handful of icons I hardcoded into the script, you'll get a bunch of warnings.
- I didn't do all the lookups but they'd be easy enough to add if people need them.
- If you hack up your party flags, you'll need to hack up this script to reflect your changes.

If you use this script and find bugs, please PM or email me.
 
sounds cool! 

FYI - I did something similar just to update your module_parties.py after make changes with the map editor, but it doesn't handle icons and other tuples.
http://forums.taleworlds.com/index.php/topic,45772.0.html
 
Aha!  I'd wondered why someone hadn't written a tool to do that yet but clearly someone did!  :mrgreen:

The icons just live in the bottom 0xFF of the flags.  All you have to do is mask them out and compare to a constant.  I was lazy; I didn't parse the ID_map_icons.py file but it wouldn't be hard to do so.  I just copied out the ones that I knew were used and did a simple string lookup. 

Fun stuff!
 
I just have to ask, to see if I get this right.

Do you mean that you can "revesre" the txt file named parties.txt? And convert that language to python language? And it just "pops" up new tuple in the Parties.py
with the data from the txt?


I'm not saying your tool is, but it sounds kinda stupid when I explain, but I'm just wondering.
 
NaglFaar said:
I just have to ask, to see if I get this right.

Do you mean that you can "revesre" the txt file named parties.txt? And convert that language to python language? And it just "pops" up new tuple in the Parties.py
with the data from the txt?


I'm not saying your tool is, but it sounds kinda stupid when I explain, but I'm just wondering.
Yes, that's the idea.  So if you have a parties.txt that was edited outside of the module system, you can use the script to get the tuples out.  A very common theme around here is "I started making my mod just by hacking up text files, now I want to use the module system and can't get my changes to Python easiliy." 

If your changes are already in Python, it's not terribly useful  :mrgreen:

I don't think people have caught on to how useful this kind of stuff is.  Managing the tuple data in the module system is a goddamn nightmare but we have lots of fun 3rd party tools that modify text files with relative ease.  So you could use, say, the unofficial item editor, hack up your item_kinds1.txt, then use my two scripts to get the data back into the module system. 
 
kt0 said:
I don't think people have caught on to how useful this kind of stuff is. 

Agreed.

So this means that I can... Um..Oh! place "20" towns/ parties on the map using the map editor and then just use your tool and then "Whoppsidaisy" get all of the towns etc with location ect right into the module.

Awsooome.
 
could you do this for troops.txt and items_kinds1.txt too?
its sometimes a bit difficult to work with item/troop editor and the module_system :mrgreen:
 
Srry for reseructing the thread but I can't get it working.

I downloaded the files and the Ruby program. I tried opening with the Ruby command window, and I even read the manual. But nothing is happening and I am stuck  :sad:.

You need to run the parties2tuples file in the Ruby command window or if this is wrong, then how should I do it?

Thanks in advance.
 
Back
Top Bottom