Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Effective ways of mass raw editing?  (Read 1987 times)

Jundavr

  • Bay Watcher
    • View Profile
Effective ways of mass raw editing?
« on: May 06, 2021, 07:07:17 pm »

My problem is quite simple: I want to make every creature in the game heterosexual and interested in marriage, so I can couple histfigs naturally. I'm planning to use this to make family forts and other gimmicks like coupling together any "visitors" I receive, from regular mercenaries to invading minotaurs and cyclops, and even animal creatures that I'll use a script to make join my civ. This also should make couples way more frequent in legends mode.

My first solution was to use the fix-ster script every once in a while while running the fort, but I want something permanent. Plus, the script doesn't quite work for arranging marriages as it only modifies the unit's orientations and doesn't change the histfig data.

I learned about the [ORIENTATION] tag, that make creatures generate with the desired orientation, instead of me having to edit them, so I went on to modding the raws.
The way I found to do this was by finding and replacing every single txt in the raws folder:

find "[MALE]"
replace by "[MALE] [ORIENTATION:FEMALE:0:0:100][ORIENTATION:MALE:100:0:0]"

find "[FEMALE]"
replace by "[FEMALE] [ORIENTATION:MALE:0:0:100][ORIENTATION:FEMALE:100:0:0]"

It worked perfectly, but I can't help feeling it was a very inneficient way to go about it. Hence the question: when I want to edit a specific thing about every creature (or a large specific group of them), is there a better way to do it than doing it one at a time, txt per txt?
« Last Edit: May 06, 2021, 07:09:00 pm by Jundavr »
Logged
I was out in the rain. So exasperating!

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Effective ways of mass raw editing?
« Reply #1 on: May 08, 2021, 10:09:43 pm »

There isn't a better way

This also should make couples way more frequent in legends mode.

I've tested this, actually, theoretically breeding pairs should be ~9% more frequent1 with this change but in practice I couldn't find a statistically significant difference

1first, 100/95, since only 5% of creatures are disinterested in the opposite sex by default; then, 23.75% of creatures being bisexual * 26% of those actually ending up in a homosexual relationship (cause 95% of the opposite-sex partners are interested while only 25% of same-sex ones are, and .25/.95 = 26.3%) * 90% or so who won't cheat on their lover (LUST_PROPENSITY governed) * 50% or so who will never break up or end up with a dead lover comes out to ~2.6%, all of which I ended up fudging up to 4% cause some of those numbers are suspect, though I have them in descending order of confidence here

Roses

  • Bay Watcher
    • View Profile
Re: Effective ways of mass raw editing?
« Reply #2 on: May 15, 2021, 11:13:02 am »

For just the modify text part of the question, if you are on Windows you can use Powershell (or bash if you have windows subsystem for linux installed) to mass edit files. On Mac you can just use bash. The Powershell command would look something like

Code: [Select]
Get-ChildItem "C:\mypath" -file | %{$path=$_.FullName; (Get-Content $path).Replace('[MALE]', '[MALE][ORIENTATION:FEMALE:0:0:100][ORIENTATION:MALE:100:0:0]') | set-content $path -encoding ASCII }
Note that I have not tested that command, but it should work
Logged

Jundavr

  • Bay Watcher
    • View Profile
Re: Effective ways of mass raw editing?
« Reply #3 on: May 25, 2021, 06:43:32 pm »

Eh, I started using NotePad++ and it has a find/replace function that works on all opened documents. So now I just open all the files I want to edit and do the replacing, then use the save all button.
Logged
I was out in the rain. So exasperating!

Mohreb el Yasim

  • Bay Watcher
  • ♫♪♫♫♪♫♪♪♫♪
    • View Profile
Re: Effective ways of mass raw editing?
« Reply #4 on: July 19, 2021, 11:21:19 am »

You could even give a directory to replace things in. (no need to open)
Logged
Mohreb el Yasim


GENERATION 24:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experime