Results 1 to 9 of 9

Thread: Extra unit info

  1. #1
    AqD's Avatar 。◕‿◕。
    Join Date
    Dec 2007
    Location
    🏡🐰🐿️🐴🌳
    Posts
    10,959

    Default Extra unit info

    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.

  2. #2

    Default Re: Extra unit info

    I really would like to learn how to make scripts like this or for reforms ect. Do you have any advise?

  3. #3
    Legio's Avatar EMPRESS OF ALL THINGS
    Content Emeritus

    Join Date
    Mar 2008
    Location
    Chlοėtopia
    Posts
    43,774

    Default Re: Extra unit info

    Nice work aqd!

  4. #4

    Default Re: Extra unit info

    Very good +rep!

  5. #5
    Quinn Inuit's Avatar Artifex
    Join Date
    Sep 2006
    Location
    Virginia, USA
    Posts
    4,968

    Default Re: Extra unit info

    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.

  6. #6
    AqD's Avatar 。◕‿◕。
    Join Date
    Dec 2007
    Location
    🏡🐰🐿️🐴🌳
    Posts
    10,959

    Default Re: Extra unit info

    Quote Originally Posted by Emperor Domitianus View Post
    I really would like to learn how to make scripts like this or for reforms ect. Do you have any advise?
    For reforms - just read about EB's script.

    Quote Originally Posted by Quinn Inuit View Post
    Wow. That's excellent. May I use that in the ExRM?
    Yeah of course. But you'll need to know a bit about PHP and regular expressions, or I could customize it for you when I have time.

  7. #7
    Quinn Inuit's Avatar Artifex
    Join Date
    Sep 2006
    Location
    Virginia, USA
    Posts
    4,968

    Default Re: Extra unit info

    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.

  8. #8
    AqD's Avatar 。◕‿◕。
    Join Date
    Dec 2007
    Location
    🏡🐰🐿️🐴🌳
    Posts
    10,959

    Default Re: Extra unit info

    Quote Originally Posted by Quinn Inuit View Post
    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.
    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:
    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
    All tabs are replaced by spaces and all commas have one space for postfix and no prefix, no trailing whitespaces.

    Abnd this my export_units.txt:
    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.
    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.
    Last edited by AqD; January 14, 2009 at 02:11 AM.

  9. #9
    Quinn Inuit's Avatar Artifex
    Join Date
    Sep 2006
    Location
    Virginia, USA
    Posts
    4,968

    Default Re: Extra unit info

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •