I'm trying to edit a mod that changes regularly (I'm trying to turn all characters into adults), and in some of the files I need to run a script that finds a specific line like "character = yes" and then find the next iteration of "age = {their age}" and replace it with a random number between 18 and 45.
The real problem I'm having is how to tell the script to look only for the very next instance of string 2 (age) after reading each instance of string 1 (character = yes), then stopping and looking for the next string 1 (character = yes) again.
I don't want to replace all instances of string 2 (age) because it applies to noncharacters as well in the same file. So I only want to replace the very next instance of string 2 (age) that's read after string 1 (character = yes), since it's coded in bracketed blocks.