I wrote a script which reads unit stats and add/update extra information in unit descriptions. Here is the preview:
The script will be included in former 2.0 release, so you could use it too for your mods.
I wrote a script which reads unit stats and add/update extra information in unit descriptions. Here is the preview:
The script will be included in former 2.0 release, so you could use it too for your mods.
I really would like to learn how to make scripts like this or for reforms ect. Do you have any advise?
Nice work aqd!
Wow. That's excellent. May I use that in the ExRM?
RTR Platinum Team Apprentice, RTR VII Team Member, and Extended Realism Mod Team Coordinator. Proud member of House Wilpuri under the patronage of Pannonian
The ExRM forum: come for the mod, stay for the Classical History discussions. Or vice versa.
My writing-related Twitter feed.
I hate to trouble you about it. I'll take a crack at it and see if some of my teammates can get it to work, too, and then ask you if we come up with nothing.
RTR Platinum Team Apprentice, RTR VII Team Member, and Extended Realism Mod Team Coordinator. Proud member of House Wilpuri under the patronage of Pannonian
The ExRM forum: come for the mod, stay for the Classical History discussions. Or vice versa.
My writing-related Twitter feed.
Here is the script. It needs php 5 and the mbstring extension.
First the script opens EDU and analyzes all unit stats into a mapped array ($umap), then it loops through and decides what extra text for them (put in $tmap), and finally it opens export_units.txt and replaces a special mark in each of unit descriptions with that info.
The generated file is saved in text\export_units.txt.new, in the correct UTF-16 encoding through the end of file is corrupted (mbstring is buggy...)
I have formatted my EDU and export_units.txt, my EDU looks like this:All tabs are replaced by spaces and all commas have one space for postfix and no prefix, no trailing whitespaces.Code:type aor dahae nobles dictionary rtr_aor_dahae_noble category cavalry class missile voice_type Medium_1 soldier aor_dahae_noble, 25, 0, 7 mount horse armoured med mount_effect horse +2, camel +2 attributes sea_faring, very_hardy, hide_forest, frighten_foot, frighten_mounted, cantabrian_circle, mercenary_unit formation 2.5, 4.0, 6.0, 6.0, 4, square stat_health 3, 9 stat_pri 7, 18, arrow3, 145, 90, siege_missile, archery, piercing, none, 0, 1 stat_pri_attr no stat_sec 14, 18, no, 0, 0, melee, blade, piercing, spear, 0, 0.75 stat_sec_attr no stat_pri_armour 14, 11, 1, metal stat_sec_armour 0, 1, flesh stat_heat 2 stat_ground -3, 0, -6, 0 stat_mental 9, normal, trained stat_charge_dist 210 stat_fire_delay -200000 stat_food 60, 300 stat_cost 1, 2244, 935, 224, 224, 2244 ;; fedual ownership all
Abnd this my export_units.txt:One line per description. The {..} is followed by one tab, and whatever characters and then the "____" mark. The script would replace anything between the tab after {} and the ____ mark with the extra unit info.Code:¬---------------- {rtr_aor_dahae_noble} Daai Eugeneis Hippeis {rtr_aor_dahae_noble_descr} ____\n\nThe Dahae were a confederacy of three tribes, including the Parni, who were later called as Parthians....... {rtr_aor_dahae_noble_descr_short} Dahaen noble cavalry are heavy-armoured horse archers.
Last edited by AqD; January 14, 2009 at 02:11 AM.
Cool, thanks. That's beyond my skill, but I'll ask around.
RTR Platinum Team Apprentice, RTR VII Team Member, and Extended Realism Mod Team Coordinator. Proud member of House Wilpuri under the patronage of Pannonian
The ExRM forum: come for the mod, stay for the Classical History discussions. Or vice versa.
My writing-related Twitter feed.