• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

unmerged(75409)

Field Marshal
Apr 30, 2007
7.727
101
Hi there,

I would like to introduce you to a tool program that I wrote. The tool is called "CK2-Cultures-Parser" and it is intended to help modders who wish to cross-link the given name lists of the vanilla game or of their own mods.

The tool is an executable which you can place in the directory where your "00_cultures.txt" file is located. You double-click the executable, it will automatically load the 00_cultures file into memory, and then you can pick one of two options:

  1. Write the name lists from the 00_cultures.txt file into spreadsheet tables where linked names are put onto the same row, like this:
    attachment.php
  2. Load the spreadsheet tables, process them into lists of properly linked names, and update the 00_cultures.txt file with these name lists.

Having the name lists in the form of tables that can be edited by a spreadsheet program is nice, because this allows you to easily check which names are linked and which aren't. You can create links between names in two ways:
  • Within the column that contains the name list for one culture, you can move a name up or down into the same row as another name to which you want it to be linked. If that name does not yet have a reference version, write one into the "reference" column on that row.
  • You can also simply add a "reference" name in the reference column, this will create a link to all other names with the same reference name. They don't have to be on the same row.

The ZIP file contains the executable, two sample spreadsheets created from the vanilla 00_cultures.txt file, and the C++ source code for the parser. (Don't bash me if you find it crude or inefficiently written, this was my C++ learning project.)

spreadsheet1.jpg

Download it through this attachment:
View attachment CK2-Cultures-Parser.zip

Some remarks:
  • Before you process a 00_cultures.txt file, you have to replace all tabs (\t) with spaces. Notepad++ will do this for you if you search & replace the expression \t with a couple of spaces. (Sorry for the inconvenience)
  • I built a couple of "safety catch" functions into the file, which will abort the program if something wasn't read properly. It will show you a pop-up saying "Ck2-Cultures-Parser.exe has stopped working. What do you want to do?" ignore this and try to read what it says in the black screen.
  • Don't use double-names that have a space in them. Four or five of these are in the vanilla 00_cultures.txt file ("Abu Bakr", "Ramon Berenguer", and some others) and they are fine, as long as you don't try to crosslink them. Use a dash to separate the two names instead.
 
I just downloaded this and followed the instructions, however when opening the files (eg. male_names.csv) in Excel they just look like regular localisation files rather than the neat table that you shown. Is this a WAD?
 
You're unfamiliar with a feature in Excel :)

Select the 'A' column, then use Data - Text to Columns - Delimited - semicolon
This will move everything to its own column.

Or if you don't use Excel for other stuff anyway you can make it treat the semicolon as a delimiter by default, so it always opens in a nice view:
Follow these instructions, but make sure you set the semicolon as a list separator.
 
You're unfamiliar with a feature in Excel :)

Select the 'A' column, then use Data - Text to Columns - Delimited - semicolon
This will move everything to its own column.

Or if you don't use Excel for other stuff anyway you can make it treat the semicolon as a delimiter by default, so it always opens in a nice view:
Follow these instructions, but make sure you set the semicolon as a list separator.
Thank you!! I haven't used Excel in a while and I certainly never knew of that feature.
 
Nice to see that someone is finding this tool useful after all! :)

I didn't check in this thread any more after the first couple of days... if you have any questions about the tool or the source code, feel free to PM me.
 
I'm having a problem with the second function; I loaded the .csv files and made the neccessary changes, but when I open the Parser and choose the second function it crashes.

EDIT: I thought I narrowed the problem down to me not placing any names in the REF column, but it's still not working.
 
Last edited:
Hmm... when it crashes, what does it say on the program window itself? Does the text on the screen (not the crash popup) say anything helpful? For some of the things that lead to program aborts, I made it write a descriptive message to the main window before it closes down.

Also, did you make sure to save the CSV file in the same format that it has when you opened it? I.e., as comma separated values, with the rightmost column consisting of X'es?

When you save it after making your changes, the rightmost column of the table must contain X'es to make sure Excel prints the same number of semicolons into every line. (Excel will only print semicolons up to the last non-empty cell in each row.) If this is the reason, the program screen should say something about the number of semicolons being wrong when it chrashes.

If that doesn't help... do you have visual studio or some other C++ compiler? Even if you have just rudimentary knowledge of how to run a compiler, you can quite easily build the EXE yourself using the source code supplied in the ZIP file, and check what's wrong in that function. I can supply some tips on what the variables are supposed to do if you post where it chrashes...
 
Last edited:
Also, did you make sure to save the CSV file in the same format that it has when you opened it? I.e., as comma separated values, with the rightmost column consisting of X'es?
That may be it. So I should undo the 'delimiting of the columns' then save and try again?
 
No, I don't think that's the problem. The perfectly resemble the example image in the first post. The messages I get when running the exe are:
Code:
Reached the end of file male_names.csv
Reached the end of file female_names.csv
Would it help if you could actually see all three of the files used (00_cultures.txt, male_names.csv, female_names.csv)?
 
No, I don't think that's the problem. The perfectly resemble the example image in the first post. The messages I get when running the exe are:
Code:
Reached the end of file male_names.csv
Reached the end of file female_names.csv
Would it help if you could actually see all three of the files used (00_cultures.txt, male_names.csv, female_names.csv)?
Yeah it probably would. Can you post them to this thread as post attachments?
 
Found the reason :)

You saved it with commas ( , ) not with semicolons( ; ) as separators. After replacing all 190.000 commas with semicolons the parser was able to process the lists and generated the following files:

Code:
levantine_group = { #Semitic
 punic = {
  graphical_culture = muslimgfx #punicgfx
  
  color = { 0.5 0.2 0.5 }

 male_names = {
       Abdashmon Abdenna Abdeshmun Abdimilki Abdmelqart Abdmilkot Abdosir Abdshed 
       Abdshesm Abdusmun Abdzaphon Aderbaal Admagon Adonibaal Ahimilk Ahiram 
       Ahotmilk Akbar Annobaal Anobaal Aqhat Ashdabor Ashtartyaton Ashtzaph 
       Azrubaal Baalfadi Baalhanno Baalshillek Baalyaton Baraket Binmilqart Bodashtart 
       Bodeshmun Bodinelqart Bodmelqart Bodtanit Bostar Danel_Daniel Eshmunamash Eshmunazar 
       Eshmunkhilletz Eshmunshalokh Germelqart Hamilket Hamon Hannibaal Hanno Hiram 
       Kanmi Khamelqart Khilletzbaal Khimilkât Magon Maharbaal Melqartpilles Menahilim 
       Milkherem Milkpilles Milkyaton Mithonbaal Philosir Pimyaton Rib-Addi Sakarbaal 
       Shafat Tabnit Tanubda Yaroah Yehawwielon Yutpan Zimrida        }
 female_names = {
       Abdosir Abdtanit Amatashtart Amatbaal Amma Ammobaal Amotmilqart Arashtibaal 
       Arisha Arishat Arishot Arshut Ashdanot Ashdonbaal Ashmonrabti Astarte 
       Azibal Barkitbaal Batnoam Birkana Birkanda Bisha Bitnima Demna 
       Domina Elissa Emeshmun Hannah Imashmon Imashtart Mitunbaal Muttunbaal 
       Pawly Quarta Saphanbaal Septy Shiba Sisa Ummashtart Yasha 
       Zibqet        }
  
  dynasty_title_names = yes
  founder_named_dynasties = yes

  male_patronym = "bin "
  female_patronym = "bitt "
  prefix = yes
  
  modifier = default_culture_modifier
 } 
 israelite = {
  graphical_culture = muslimgfx
  
  color = { 0.4 0.5 0.9 }

 male_names = {
       Adalya_Adalya Adam_Adam Adinah_Adinah Adlai Adoniyah Aharon Amaryahu_Amaryahu Amnon_Amnon 
       Amos Amram Anaiah Aran Ari'el_Ari'el Arieh Asa_Asa Asaf 
       Asher Avi'el_Avi'el Avidan Avihu_Avihu Avima'el_Avima'el Avimelekh Aviram Avishay 
       Avner Avraham Avram Avshalom Azaryah_Azaryah Azazyahu_Azazyahu Azri'el_Azri'el Barak 
       Barukh Belshatzzar Benayahu Binyamin Boaz Chananyah_Chananyah Chanokh Chavaqquq 
       Chizqiyahu_Chizqiyahu Dan Daniyyel_Daniel Daryawesh_Daryawesh Dawid Delayahu_Delayahu Efrayim Ehum 
       Eiran Eitan El'azar_El'azar Eli Eli'ezer_Eli'ezer Elifalet Elifelet Elihu_Elihu 
       Elisha Eliyyahu Elkanah_Elkanah Enosh Esaw Ezer Ezra_Ezra Gavri'el_Gavri'el 
       Gedalyahu_Gedalyahu Gemaryahu_Gemaryahu Gershom Gershon Gid'on Gilad Haran Hevel_Hevel 
       Hillel Hiram Hoshea Immanuel Ira Itamar_Itamar Ittay_Ittay Iyyov_Iyyov 
       Kalev_Kalev Kayin_Kayin Keinan Kenanyahu Koresh_Koresh Lemuel_Lemuel Lewi Lot 
       Machli Mal'akhi Mattan_Mattan Mattanyahu Mattityahu Melech_Melech Menachem Menashsheh_Menashsheh 
       Meshullam Mikha'el Mikhah Mordokhay Moshe Nachum_Nachum Nadav Natan 
       Nechemyah Neriah_Neriah Netanyahu Nethanel Noach Ofrah Omri_Omri Ovadyah_Ovadyah 
       Oved Peleg_Peleg Penuel Pinchas_Pinchas Rafa'el Reuven Satan_Satan Seraiah 
       Sha'ul She'alti'el_She'alti'el Shelomoh Shem Shema'yah Shemu'el Shet_Shet Shimon 
       Shimshon Talmai Teman_Teman Terach Toviyyah_Toviyyah Tzefanyah_Tzefanyah Tzidkiyahu_Tzidkiyahu Tzion 
       Tzivah Uri_Uri Uriy'el_Uriy'el Uriyah_Uriyah Uzzi_Uzzi Uzziel Uzziyyah_Uzziyyah Ya'rah_Ya'rah 
       Yaakov Yachin_Yachin Yadon Yair_Yair Yared Yechezkel_Yechezkel Yechi'el_Yechi'el Yedidyah 
       Yefet Yeho'ash_Yeho'ash Yehochanan Yehonatan Yehoram Yehoshafat Yehoshua_Yehoshua Yehoyakhin 
       Yehoyakim Yehu_Yehu Yehudah Yehudi Yered_Yered Yeriyahu Yesha'yahu_Yesha'yahu Yeshua 
       Yiftach Yirmiyahu Yishai_Yishai Yishma'el Yishmeray Yisra'el Yissakhar_Yissakhar Yitzhak 
       Yo'ash_Yo'ash Yoav Yochanan Yoel Yonah Yonatan Yoram Yosef 
       Yoshiyahu_Yoshiyahu Yotam_Yotam Zekharyah Zevadyah Zevulun_Zevulun        }
 female_names = {
       Achinoam Asenat_Asenat Ashtoret_Ashtoret Atarah_Atarah Avigayil Avishag_Avishag Avital_Avital Basmat_Basmat 
       Bat-Sheva Beulah_Beulah Bityah_Bityah Chaggit Channah Chawwah_Chawwah Cheftzi-Bah Chuldah_Chuldah 
       Delilah Devorah Dinah_Dinah Ednah Efrat_Efrat Elisheba Ester Hadassah_Hadassah 
       Hagar_Hagar Hodiyah_Hodiyah Ketzi'ah_Ketzi'ah Le'ah Machalat Meheitav'el_Meheitav'el Merav_Merav Mikhal 
       Miriam Moriah Na'amah_Na'amah Na'omi No'ah Orpah_Orpah Rachel Rivqah_Rivqah 
       Rut Sarah Shifra_Shifra Shoshannah_Shoshannah Shulammit Tamar_Tamar Tirtzah Tzillah 
       Tzipporah Washti_Washti Yael_Yael Yedidah Yehudit Yemima Yiskah_Yiskah Yocheved 
       Zilpah        }
  
  from_dynasty_prefix = "of"
    
  modifier = default_culture_modifier
 }
 nabataean = {
  graphical_culture = muslimgfx
  
  color = { 0.7 0.55 0 }

 male_names = {
       Abd'allah Abd-Dushara Adnun Amat Aush'allah Ausos Cain Dani'el_Daniel 
       Garm'alba'ali Hana Paran Rav'el Thaim'alba'ali Tym-Dushara Ushba'al Wadal-L'el 
       Wahab-Allah Waqi'ha'el Zabin        }
 female_names = {
       Amat'allahi Ammayu Aphityu Gamilat Hab-Allahi Haganu Hagru Han-Allahi 
       Huldu Kalbu Nashgu Shalm-Lahi Shaqilat Shumrahu Walu Waqilu 
              }
  
  from_dynasty_prefix = "of"
    
  modifier = default_culture_modifier
 }
 aramaic = {
  graphical_culture = muslimgfx
  
  color = { 1 0.85 0.35 }

 male_names = {
       Adalya_Adalya Adinah_Adinah Amaryahu_Amaryahu Amnon_Amnon Ari'el_Ari'el Asa_Asa Avi'el_Avi'el Avihu_Avihu 
       Avima'el_Avima'el Avira Azaryah_Azaryah Azazyahu_Azazyahu Azri'el_Azri'el Chananyah_Chananyah Chizqiyahu_Chizqiyahu Daryawesh_Daryawesh 
       Delayahu_Delayahu El'azar_El'azar Eli'ezer_Eli'ezer Elihu_Elihu Elkanah_Elkanah Ezra_Ezra Gavri'el_Gavri'el Gedalyahu_Gedalyahu 
       Gemaryahu_Gemaryahu Hevel_Hevel Itamar_Itamar Ittay_Ittay Iyyov_Iyyov Kalev_Kalev Kayin_Kayin Koresh_Koresh 
       Lemuel_Lemuel Mattan_Mattan Melech_Melech Menashsheh_Menashsheh Nachum_Nachum Neriah_Neriah Omri_Omri Ovadyah_Ovadyah 
       Peleg_Peleg Pinchas_Pinchas Rockmeil Satan_Satan She'alti'el_She'alti'el Shet_Shet Te'oma Teman_Teman 
       Toviyyah_Toviyyah Tzefanyah_Tzefanyah Tzidkiyahu_Tzidkiyahu Uri_Uri Uriy'el_Uriy'el Uriyah_Uriyah Uzzi_Uzzi Uzziyyah_Uzziyyah 
       Ya'rah_Ya'rah Yachin_Yachin Yair_Yair Yechezkel_Yechezkel Yechi'el_Yechi'el Yeho'ash_Yeho'ash Yehoshu'a_Yehoshua Yehu_Yehu 
       Yered_Yered Yesha'yahu_Yesha'yahu Yishai_Yishai Yissakhar_Yissakhar Yo'ash_Yo'ash Yoshiyahu_Yoshiyahu Yotam_Yotam Zevulun_Zevulun 
              }
 female_names = {
       Asenat_Asenat Ashtoret_Ashtoret Atarah_Atarah Avishag_Avishag Avital_Avital Basmat_Basmat Beulah_Beulah Bityah_Bityah 
       Chawwah_Chawwah Chuldah_Chuldah Dinah_Dinah Efrat_Efrat Hadassah_Hadassah Hagar_Hagar Hodiyah_Hodiyah Ketzi'ah_Ketzi'ah 
       Meheitav'el_Meheitav'el Merav_Merav Na'amah_Na'amah Orpah_Orpah Rivqah_Rivqah Shifra_Shifra Shoshannah_Shoshannah Tamar_Tamar 
       Washti_Washti Yael_Yael Yiskah_Yiskah        }
  
  from_dynasty_prefix = "of"
    
  modifier = default_culture_modifier
 }
............................. etc

Do those name lists look like they should?