Jump to content

[mod] Species_Classes and Portraits text file generator


Goregath

Recommended Posts

Posted (edited)

Species_Classes and Portraits text file generator


What does it do:

I made this file so I could add species to Vanilla Framework and have them 'just work'.
After looking at the policies and species_classes files, I was deterred.

 

So this program was made to look at a series of images, organized by file structure, and then create the required species_classes and portraits files automatically.

It is also written in python (with comments) and should be adjustable to anyone's file structure.

Thus, you can collect the images you like and have them show up in game without making/changing the species_classes and portraits files.

 

Setup:
So this script was made for the naming convention in Vanilla Framework, but can work with others.

 

The code takes a target path to a mod folder (YourModName for example) and then assumes that you have the path:

YourModName\gfx\models

and is this path is a series of folders that correspond to the playable races:
Models_VF.png.e4ce8d198a6cbf30aae4f234d3de680c.png

The code will auto ignore any folders it doens't recognise the name of.

This can now be configured, by default it only knows:

Topspecies_names=['aquatic', 'arthropoid', 'avian',
                'fungoid', 'humanoid', 'kemonomimi', 
                'lithoid', 'machine', 'mammalian',
                'molluscoid', 'necroid', 'plantoid', 
                'reptilian', 'toxoid']

But it can be told to look for custom races with the flag "--custom_support True"

 

It then checks for sub-folders to make species from:
image.png.1925c3f2ff359101d2d95fdffa50c4ea.png

The code will check inside in the Species Type (e.g. Aquatics) folder and ignore anything that isn't also a folder.

In this case it assumes that Aqua01, Aqua02, ... Aqua06 are all separate species. There is no naming convention requirement here, the species can be called anything!

 

Assuming the folder looks like this:
Aquatics_VF.png.daeff0c584d85193f455068dfe37a8a7.png

A list of .dds files are generated such that:

'01AquaF1.dds', '01AquaF10.dds', '01AquaF11.dds', '01AquaF12.dds', '01AquaF13.dds', '01AquaF14.dds', '01AquaF15.dds', '01AquaF2.dds',
'01AquaF3.dds', '01AquaF4.dds', '01AquaF5.dds', '01AquaF6.dds', '01AquaF7.dds', '01AquaF8.dds', '01AquaF9.dds'
are all female.
'01AquaH1.dds','01AquaH2.dds', '01AquaH3.dds' are all futa.
'01AquaM1.dds', '01AquaM2.dds' are all male.


The code then iterates through all the folders it recognises and using the sub-folders a sspecies it generates ALL of the portraits text files for playable races (and pre-sapients), and all the species classes for playable races (not pre-sapients).

 

It will go back to the folder YourModName and look for the two paths:

YourModName\portraits\portraits

YourModName\common\species_classes

If it doesn't find them, it will create them.

Portraits_VF.png.847fe6641f1a1657d5b52b8ddf450c8b.png

I've removed the _test in the picture, so it will now overwrite the Vanilla Framework (or others) if it has the same name.

 

Code:

 

File Names:


 

Spoiler

Inside each folder should be a list of .dds files.

There is also now a variable for file extension for the pictures:

pic_types='(dds|png)'

Change it if you want to support other types, like jpg for example:

pic_types='(dds|png|jpg)'

I personally don't know what Stellaris supports outside dds and png, so change at your own risk.

 

The code will then try to sort them into genders if the files are named a certain way.
The sorting is done by regular expression where each gender has a list of expressions that are acceptable.

The first is looking for the end of the file name to be (gender as M F or H)(some number).dds

The second is looking for female in ANY part of the file path.

 

Here is the search list:

# these are regular expression search terms.

names = [['[Ff][0-9]+\.'+pic_types+'$','(?i)female'],

         ['[Mm][0-9]+\.'+pic_types+'$','(?i)male'],

         ['[Hh][0-9]+\.'+pic_types+'$','(?i)futa','(?i)indeterminate']]

 

Add more or change them if you have different ways of storing your files.

 

WARNING:

-------------------------------------------------------------------------------------------------------------------

It will search for females, then males, then futa.

It will search through every item in each list stopping at the FIRST thing found.

So for example:

if your mod has females in the name, EVERY portrait will ALWAYS be female ONLY.

To stop this, just change the code by removing the '(?i)female' entry (similar for the other gender entries).

i.e.

names = [['[Ff][0-9]+\.'+pic_types+'$'],

         ['[Mm][0-9]+\.'+pic_types+'$'],

         ['[Hh][0-9]+\.'+pic_types+'$']]

-------------------------------------------------------------------------------------------------------------------

 

If it can't sort them, it will assume a mono-gendered set of portraits.

 

Leaders:

 

Spoiler

The new version now checks for leader classes in the FILE PATH. So sorting by folders, or file names should both work.
Looking at line 64 :

leader_names_search = {

        'ruler':['(?i)ruler'],

        'pop':['(?i)pop'],

        'scientist':['(?i)scientist'],

        'governor':['(?i)governor'],

        'general':['(?i)general'],

        'admiral':['(?i)admiral'],

        'envoy':['(?i)envoy'],

    }

There is a list of regular expressions that are used for each leader class to find them.

here '(?i)ruler' will search for the string 'ruler' and ignore case.

Adding to the list will add checks for that ruler.

i.e. changing it to:
        'ruler':['(?i)ruler','_r_'],

will cause the code to search first for the ruler word, then for underscore r underscore.

 

Look at the function

def leader_dict_sorter(leader_dict)

on line 315 and

def pic_to_leader(pic_list,name_search=leader_names_search)

on line 272 for details on how it searches.

 

This search occurs AFTER the gender search.

 

Sets that have no leader types detected will now produce smaller portrait files.

 

How to use:

 

Firstly you'll need python installed.
Later if I get to it I'll see if I can make it an executable or something.

But in this form it is safer as people can read it to see what it's doing.

 

Taken straight from the python file:

 

--- HOW TO RUN THE CODE ----
----------------------------
Assuming something like Linux, run in terminal:
python3 Stell_VanF.py --folderpath 'Some/Path/To/Paradox Interactive/Stellaris/mod/YourModName' --run_all True

 

Or Windows:
python3 Stell_VanF` 1_0_5.py --folderpath 'C:\Users\CHANGEYOURNAME\Documents\Paradox Interactive\Stellaris\mod\YourModName' --run_all True
 

There is a verbose flag that can be used.

i.e. python3 Stell_VanF.py --folderpath 'C:\Users\CHANGEYOURNAME\Documents\Paradox Interactive\Stellaris\mod\YourModName' --run_all True --verbose True

All command line flags:
python3 Stell_VanF.py --folderpath 'C:\Users\CHANGEYOURNAME\Documents\Paradox Interactive\Stellaris\mod\YourModName' --run_all True --verbose True --vanilla_framework True --block_base_species True --block_prescripted_countries True --custom_support True --andro_sub True

NOTE: vanilla_framework flag does nothing at the moment, if I get the other things (events/scripts etc.) automated it will be used for that.

 

Just be prepared to have your screen flooded if you have many portrait files.

 

Or just run it in idle like I do ?

I should have explained more, my bad:
example code:

folderpath= r'C:\Users\CHANGEYOURNAME\Documents\Paradox Interactive\Stellaris\mod\YourModName'
run_the_lot(folderpath=folderpath,dospecies_class=False,block_base_species=False,vanilla_framework=True,verbose=False)

(values are set to the defaults in the above example, i.e. verbose is default set to false)

 

Here is step by step of what you need to to in IDLE:

Spoiler

First, Open a new IDLE window (i.e. just run idle) and then open the file from the file menu:

IDLE_1.png.7c092e70b4a85d071d9b3f267901ef3d.png

Select the version (probably latest and the only one you'd have):

IDLE_2.png.47e819e0d2a27323afa89df99cf55a23.png

When it's open, run the module:

IDLE_3.png.8d66eb6a59d24fc5a1faf7609bbade61.png

You're now able to execute all the functions yourself, and play with them if you like.
But in this next picture I have highlighted the last few lines of code in a red box in my python file.
These last line are what the command line is trying to execute if you use the command line.
To do what it's doing, just assign the path to Vanilla Framework (or another mod) to a variable (can be any name, but I'll use folder path), then use run_the_lot([Variable Name Here]).

NOTE:

You'll notice I have an r in front of the string path, this is because the windows path names are interpreted as escape commands. The r makes it a real string and ignores those commands. The r is not needed for Linux/Mac, but should have no effect if still included. (it is necessary on Windows tho).

Here's a picture:

IDLE_4.png.2d5dc72a0a44ac20cc4357cb83e01381.png


This should solve the problem.

If you want to see the inputs that the command line can understand (and where they are used in the code), they are the paser.add_argument lines near the top of the file.
 

As a side note:

Since you are using IDLE you can examine what each function is doing, which can be intimidating but fun!
Other than run_the_lot, all functions should be returning strings, lists, dictionaries or something else.
run_the_lot will try to write files to the computer, so messing with it can be annoying to clean up.
The rest of the funtions will at worst clutter your screen with text, which can easily be solved by opening a new window and starting again.

 

 

VIDEO!

I've added a video to the downloads with an example run on just pictures.

The file path inside the test mod is required. (e.g. YourModName\gfx\models\Aquatic\Aqua01\example1.dds)

 


----------------------------

 

I'll continue to post updates as I improve the script.
Feel free to use/modify this script, and to suggest changes if you like.

 

TL;DR:

-Putt all your species pictues (any name as .dds files) into sub-folders (any name e.g. Aqua01) for each set of pictures

-The sets of pictures need to be in a folders that corresponds to a playable races (e.g. Aquatic) (Species Type folders shown in the first figure by the red dashes.)

Species Type folders need to be here:

YourModName\gfx\models

 

(So for the example: YourModName\gfx\models\Aquatic\Aqua01\example1.dds )

 

run the code pointing to:

C:\Users\CHANGEYOURNAME\Documents\Paradox Interactive\Stellaris\mod\YourModName

 

Done! your species will show up in the game when you load YourModName!


I also generally recommend anyone to read a script before they use it.
 

 

Example 1: Making A Race From An Old Mod

 

Spoiler

Lets resurrect an old portraits mod:

 

I'll use Stellaris Sexy Xenos and more (SSX) 1.11.8 1.11.8 (4 june 2021)

 

  • Download the mod
  • I'm going to bring back the Egyptians (because they have male and female pics)
  • Looks like this:
Spoiler

 

 

image.png.1313175a5a10189fe49e5d7d831321dc.png

image.png.62e6128853ebabb96c97e090602fe12f.png

image.png.0354351eaaccc4051b33706179b6a7f4.png

 

  • Now to sort, I'm going to make a folder called female and a folder called male.
Spoiler

image.png.861692184392360b1d1073739922b6c3.png

  • Now I run the code
Spoiler

SCR_005.jpg.80a206b53e9ebc51db619a3815010869.jpg

 

SCR_001.thumb.jpg.1f5895e0428e3eaeac7d13f328f2388e.jpg

SCR_004.thumb.jpg.c6d61126766b73e7e4e76707dbaa4eb7.jpgSCR_003.thumb.jpg.861c1e724c952db37a929e4d515fdd30.jpg

SCR_002.thumb.jpg.d6c9ef534aa3a8528743795c6309e669.jpg

  • It works

 

Example 2: Making A Race Set From Another Old Mod

 

Spoiler

Getting portraits from another mod:

 

I'll use Smutty Space Ponies

  • Download the mod
  • This mod has multiple sets of pictures, where some are just female and futa

Screenshot2024-06-27160118.jpg.a6abfc41b64fc237790d57d31d2dd7fa.jpg

 

image.png.d854bbf09d0b3e98dd7b1f93dde1028b.png

 

Screenshot2024-06-27161134.jpg.b602c47a69f637eaf07082b2229dfbeb.jpg

Also IDLE version for those using IDLE:

  • NOTE: Futa_sub is the equivalent of --andro_sub in terminal
  • You can see in the verbose output it is subbing portraits detected as intermediate in for males (as none were found)

Screenshot2024-06-27163347.jpg.4ae1a745eb592b644962aeb8c278542c.jpg

 

Screenshot2024-06-27161450.jpg.d29f8c7832341325d84f599427054af1.jpg

 

Screenshot2024-06-27161536.jpg.6c49baa66680145b79907003280e0222.jpg

 

ASPIRATIONS LIST:

 

  • Tackle events
    • Probably very painful
  • Read current entries for species lists and portrait lists
    • time consuming and difficult to decide what to do in edge cases
  • GUI?
    • Would cost lots of time and only add a little functionality at the moment, but would make it more accessible to others.
  • Executable
    • No idea how hard, but guessing hard. Would make it accessible to non-python users

 

What's New in Version 1.0.5

Fixed two bugs:

  1. The code would actually pickup non image files and add them if they were in the folder
  2. The default image in portraits is now checked only once and not every gender, this prevents a bug when one gender had no leaders, but the others did

 

The names variable is now a list of lists (like the leaders) and will check against each.

Default behavior is now to check file names as it would for like Vanilla Framework, then look for 'Female','Male' ect. in the file path.

What's New in Version 1.0.6
 

Minor updates:
 

  1. Will now name species classes as VF did (with the _classes)
  2. Changed the logic it uses to determine gender. Has no effect on the end user, but the profile files (and the python file itself) are much smaller now.

 

What's New in Version 1.0.7

 

Minor update:
 
run_the_lot will now check the inputs it has received and tell you if it's going to fail, rather than the code failing somewhere random down the line. Hopefully making it easier to pick up typos and missing definitions,

What's New in Version 1.0.8

 

3 New additions:

-vanilla_framework flag to determine if event portraits should be written to the portraits files. These are hard coded so I'll need to update if VF gets updated. But good to turn off if you have a custom portrait set or if VF gets updated and this doesn't.

-More error flags for when folders are not found or ignored.

-block_base_species flag for generating 00_species_classes.txt and 01_base_species_classes.txt which will block the base species portraits from appearing in the game.


 

Edited by Goregath
  • Goregath changed the title to Species_Classes and Portraits text file generator
Posted (edited)

I've been looking into that.

The hardest part is making a naming convention that works/is easy to use.

The next is making sure the code doesn't break if not enough portraits are used found.
 

But it's next on my list and I already have an idea of how to do it.


If Is there is a good example mod that has sets for each leader type that I could practice on to start?

Edited by Goregath
Typo / corrections
  • 2 weeks later...
Posted

@Goregath Would it be possible to automate the naming process as well?

What I was thinking was if you have a species folder, say Aqua01. And all the species are named 01Aqua01F, 01Aqua02F, 01Aqua03F, for the females of the species... Could you do something similar to like an excel sheet where you can put a bunch of pictures in and they will automatically name themselves in that format?

Sorry, I am not that good at explaining myself >.< A while ago I had posted up an idea similar to what you've made here, but it was a poorly drawn app concept in paint lol.

Posted
3 hours ago, Screws said:

@Goregath Would it be possible to automate the naming process as well?

What I was thinking was if you have a species folder, say Aqua01. And all the species are named 01Aqua01F, 01Aqua02F, 01Aqua03F, for the females of the species... Could you do something similar to like an excel sheet where you can put a bunch of pictures in and they will automatically name themselves in that format?

Sorry, I am not that good at explaining myself >.< A while ago I had posted up an idea similar to what you've made here, but it was a poorly drawn app concept in paint lol.

The naming is the most difficult as I have to predict what names will be in there.
I'm not sure what you mean by excel sheet?
Do you mean you'd have something like this:
image.png.67cb140192cfcc82948b65f173ddf40f.png
 

That would work fine.

This would even work:

image.png.8b5ae927a13d7a9ab87f5573be18fdd3.png

 

I'd need to code that in, it could look at the folder, see if there is a CSV/TXT file, check if the code understands the file and then name according to the file.
It would fall back on what it already does if that doesn't work.


I can think of a few other solutions off the top of my head, but the simplest solution without a lookup file might be to change the code.

Solution 1: Self coded

On Line 63 is:

names = ['[Ff][0-9]+\.dds$','[Mm][0-9]+\.dds$','[Hh][0-9]+\.dds$']

 

The code assumes that the first entry in this list is females, second is males and third is intermediate/Futa.
The text is regular expression syntax for searching.

If you have your own naming convention (for all files) you could change it to match what you have.

If your naming convention changes you could write your own script file to run the code over and over.
The function on line 103:

def run_the_lot(folderpath,dospecies_class=True)

Is what runs the code.
 

where it uses

for i in model_folders:

 

checks if it is a recognized folder (such as Aquatics, Humanoid ect.)
Then runs:

speciesdict=speciesfolder(species_path,names)

 

You'll notice that the function speciesfolder has the names variable as it's second input.
You could change this for each folder.

I could write an example script if that would be helpful.

 

Solution 2: Text file config per folder


Another solution might be to get it to look in each folder for a naming convention script and use that in place of the names variable.
So you'd have a text file that just has whatever expression string it should use and the code uses that.

The biggest problem I foresee here is if there are multiple text files, or the pictures are split into sub folders and each of those has a text file.
But that might be easily solved by using the first text file it sees and ignore the rest.

Posted
42 minutes ago, Goregath said:

The naming is the most difficult as I have to predict what names will be in there.
I'm not sure what you mean by excel sheet?
Do you mean you'd have something like this:
image.png.67cb140192cfcc82948b65f173ddf40f.png
 

That would work fine.

This would even work:

image.png.8b5ae927a13d7a9ab87f5573be18fdd3.png

 

I'd need to code that in, it could look at the folder, see if there is a CSV/TXT file, check if the code understands the file and then name according to the file.
It would fall back on what it already does if that doesn't work.


I can think of a few other solutions off the top of my head, but the simplest solution without a lookup file might be to change the code.

Solution 1: Self coded

On Line 63 is:

names = ['[Ff][0-9]+\.dds$','[Mm][0-9]+\.dds$','[Hh][0-9]+\.dds$']

 

The code assumes that the first entry in this list is females, second is males and third is intermediate/Futa.
The text is regular expression syntax for searching.

If you have your own naming convention (for all files) you could change it to match what you have.

If your naming convention changes you could write your own script file to run the code over and over.
The function on line 103:

def run_the_lot(folderpath,dospecies_class=True)

Is what runs the code.
 

where it uses

for i in model_folders:

 

checks if it is a recognized folder (such as Aquatics, Humanoid ect.)
Then runs:

speciesdict=speciesfolder(species_path,names)

 

You'll notice that the function speciesfolder has the names variable as it's second input.
You could change this for each folder.

I could write an example script if that would be helpful.

 

Solution 2: Text file config per folder


Another solution might be to get it to look in each folder for a naming convention script and use that in place of the names variable.
So you'd have a text file that just has whatever expression string it should use and the code uses that.

The biggest problem I foresee here is if there are multiple text files, or the pictures are split into sub folders and each of those has a text file.
But that might be easily solved by using the first text file it sees and ignore the rest.


The excel thing was mainly an example. It's been awhile since I last used it and I'm an amateur at best lol. What I meant was the feature where you could drag a box down and it would change numbers of the boxs beneath in order.

So if I put in say                 And drug the box down it would automatically go

Aqua1                                      Aqua1
------                                        Aqua2
------                                        Aqua3
------                                        Aqua4

______________________________________________

Honestly, I have no idea what all the code stuff really means, I'm a bit of an idiot on that front. I have tried to learn how to code, but it just doesn't register at all in my noggin'. Although your explanations are pretty good! : ) I'm just not smart enough to comprehend the divine language of the development/modding gods lol. I say that with sincere respect for those capable of making code do the things.. it does.. Yeah.. x.x

You could set it up where you use a specific naming scheme for the program and as long as you follow the naming scheme it could work regardless of whether you were making a new portrait mod or adding on/modifying VF.

The 2nd solution... idk it sounds simpler to me? So probably the better one? Again, I know nothing of code stuff, but I always figure the simplest method is probably the best especially when making a tool like this since it helps a lot of people who don't understand (Like myself lol) more easily grasp and use said tool.

Posted
Spoiler
2 hours ago, Screws said:


The excel thing was mainly an example. It's been awhile since I last used it and I'm an amateur at best lol. What I meant was the feature where you could drag a box down and it would change numbers of the boxs beneath in order.

So if I put in say                 And drug the box down it would automatically go

Aqua1                                      Aqua1
------                                        Aqua2
------                                        Aqua3
------                                        Aqua4

______________________________________________

Honestly, I have no idea what all the code stuff really means, I'm a bit of an idiot on that front. I have tried to learn how to code, but it just doesn't register at all in my noggin'. Although your explanations are pretty good! : ) I'm just not smart enough to comprehend the divine language of the development/modding gods lol. I say that with sincere respect for those capable of making code do the things.. it does.. Yeah.. x.x

You could set it up where you use a specific naming scheme for the program and as long as you follow the naming scheme it could work regardless of whether you were making a new portrait mod or adding on/modifying VF.

The 2nd solution... idk it sounds simpler to me? So probably the better one? Again, I know nothing of code stuff, but I always figure the simplest method is probably the best especially when making a tool like this since it helps a lot of people who don't understand (Like myself lol) more easily grasp and use said tool.

 

 

 

Well changing the names list already works if you want to go the folders route.

But now I've made it so you can have multiple ways to name the folders.
For example, lets resurrect an old portraits mod:

 

I'll use Stellaris Sexy Xenos and more (SSX) 1.11.8 1.11.8 (4 june 2021)

 

  • Download the mod
  • I'm going to bring back the Egyptians (because they have male and female pics)
  • Looks like this:
Spoiler


 

image.png.1313175a5a10189fe49e5d7d831321dc.png

image.png.62e6128853ebabb96c97e090602fe12f.png

image.png.0354351eaaccc4051b33706179b6a7f4.png

 

  • Now to sort, I'm going to make a folder called female and a folder called male.
Spoiler

image.png.861692184392360b1d1073739922b6c3.png

  • Now I run the code
Spoiler

SCR_005.jpg.80a206b53e9ebc51db619a3815010869.jpg

 

SCR_001.thumb.jpg.1f5895e0428e3eaeac7d13f328f2388e.jpg

SCR_004.thumb.jpg.c6d61126766b73e7e4e76707dbaa4eb7.jpgSCR_003.thumb.jpg.861c1e724c952db37a929e4d515fdd30.jpg

SCR_002.thumb.jpg.d6c9ef534aa3a8528743795c6309e669.jpg

  • It works
Posted

I've updated the file and the description.
I also added the what's new to the end.

I thought it would do that automatically for all updates, but I can't see the old ones so I'll manually do it from now on.

Posted

IDK what I'm doing wrong, but trying to change the file target to either a repository main folder or just the default but re-pathed \mod\ folder, I'm getting either a syntax error or it tells me reset in the prompt. I've ran it with the run line in python's window and in IDLE. I'm very much out of my depth when it comes to python, so I'm not sure what I'm missing.

Posted
On 7/13/2023 at 11:30 PM, k2jackal said:

IDK what I'm doing wrong, but trying to change the file target to either a repository main folder or just the default but re-pathed \mod\ folder, I'm getting either a syntax error or it tells me reset in the prompt. I've ran it with the run line in python's window and in IDLE. I'm very much out of my depth when it comes to python, so I'm not sure what I'm missing.

Can you send me the syntax error?
You don't need to include the full path if that's private.
But it'll tell me which line is breaking.

Posted (edited)

python3 Stell_VanF 1_0_5.py --folderpath 'C:\Users\[MyUser]\Documents\Paradox Interactive\Stellaris\mod\Vanilla Framework' --run_all True
SyntaxError: invalid decimal literal

 

I believe I also had a line 2-3 error, but because I deleted my old download of your script for a fresh one I didn't have it happen.

 

Do you have to put the script inside the stellaris\mod\ file? This shouldn't be the case because I had this reference the same main folder location it was in originally but if I'm having problems, who knows.

Untitled.png

Edited by k2jackal
Posted (edited)
5 hours ago, k2jackal said:

python3 Stell_VanF 1_0_5.py --folderpath 'C:\Users\[MyUser]\Documents\Paradox Interactive\Stellaris\mod\Vanilla Framework' --run_all True
SyntaxError: invalid decimal literal

 

I believe I also had a line 2-3 error, but because I deleted my old download of your script for a fresh one I didn't have it happen.

 

Do you have to put the script inside the stellaris\mod\ file? This shouldn't be the case because I had this reference the same main folder location it was in originally but if I'm having problems, who knows.

Untitled.png



I know the problem: I should have explained IDLE.

What's going on (I think) is that you are using the command line instructions inside the IDLE environment.

Here is what you need to to in IDLE:

Spoiler

First, Open a new IDLE window (i.e. just run idle) and then open the file from the file menu:

IDLE_1.png.7c092e70b4a85d071d9b3f267901ef3d.png

Select the version (probably latest and the only one you'd have):

IDLE_2.png.47e819e0d2a27323afa89df99cf55a23.png

When it's open, run the module:

IDLE_3.png.8d66eb6a59d24fc5a1faf7609bbade61.png

You're now able to execute all the functions yourself, and play with them if you like.
But in this next picture I have highlighted the last few lines of code in a red box in my python file.
These last line are what the command line is trying to execute if you use the command line.
To do what it's doing, just assign the path to Vanilla Framework (or another mod) to a variable (can be any name, but I'll use folder path), then use run_the_lot([Variable Name Here]).

NOTE:

You'll notice I have an r in front of the string path, this is because the windows path names are interpreted as escape commands. The r makes it a real string and ignores those commands. The r is not needed for Linux/Mac, but should have no effect if still included. (it is necessary on Windows tho).

Here's a picture:

IDLE_4.png.2d5dc72a0a44ac20cc4357cb83e01381.png


This should solve the problem.

If you want to see the inputs that the command line can understand (and where they are used in the code), they are the paser.add_argument lines near the top of the file.


As a side note:

Since you are using IDLE you can examine what each function is doing, which can be intimidating but fun!
Other than run_the_lot, all functions should be returning strings, lists, dictionaries or something else.

Edit:
To clarify, run_the_lot will try to write files to the computer, so messing with it can be annoying to clean up. The rest will at worst clutter your screen with text, which can easily be solved by opening a new window and starting again.

Edited by Goregath
Posted (edited)

Alright, I was able to get the script running after some re-reading and patience. One thing I've noticed is that there's only one leader portrait being used besides the one you set as the ruler. I know your post above shows you incorporating another mod's worth of portraits, and those do show up as leaders, albeit without the Paragon DLC, so I'm unsure where my disconnect is now. My suspicion lies in the DLC being the problem as I didn't have a problem with VF before its release. With the original author of VF discontinuing their work, we have to rely on generous people such as yourself, and I've appreciated your patience and insight.

 

tl;dr we wait very patiently for an .exe for simplicity's sake, even if your project is about transparency. ♥

 

Edit:

I know it'll be hard for you to replicate if you don't own the DLC yourself, so hopefully it's more like my wires are crossed in the files.

Edited by k2jackal
Posted
7 hours ago, k2jackal said:

Alright, I was able to get the script running after some re-reading and patience. One thing I've noticed is that there's only one leader portrait being used besides the one you set as the ruler. I know your post above shows you incorporating another mod's worth of portraits, and those do show up as leaders, albeit without the Paragon DLC, so I'm unsure where my disconnect is now. My suspicion lies in the DLC being the problem as I didn't have a problem with VF before its release. With the original author of VF discontinuing their work, we have to rely on generous people such as yourself, and I've appreciated your patience and insight.

 

tl;dr we wait very patiently for an .exe for simplicity's sake, even if your project is about transparency. ♥

 

Edit:

I know it'll be hard for you to replicate if you don't own the DLC yourself, so hopefully it's more like my wires are crossed in the files.

What files are you trying to turn into a species? If I can grab a set I can try it on my end and see what happens for me.
If it's another set on here I can try it download and run it myself. If it's a personal one you can send it to me and I can try it.
(If you don't want to send the pictures for any reason, you can send me a list of the file names and folder structure. As they will be the problem.)

 

Some quick notes that might help:

  • The logic of how it sorts leaders can run into problems if the file path has and of the leader words in it.
  • So if your username has ruler/governor/scientist/general/admiral/pop in it, the code will get confused ?
  • It only looks for .dds and .png files at the moment, could be a file type problem.
  • We found a problem that another user encountered on the Vanilla Framework thread, who was using a gender trait and one of the gender options (in species name) together. That caused only one leader picture to show, with the others all being the default species picture.
Posted

I'm trying to fix the original files to have their leader portraits randomize like before, currently it's just stuck on only one image for everything but the leader. I'm unsure if this is outside the scope of your project, as it's more about populating other mods to fit the confines of VF, but I figured this would be the best shot to address my problem. 

  • 2 weeks later...
Posted (edited)

Hey, using your program creates duplicates of species portraits even after deleting the original VF files, did i do something wrong or is this a bug.

 

EDIT: GOT IT, turns out it also made duplicate files in common because your naming is different from mugginnato's

 

 

Edited by NeinNeinNeinNope
Posted
On 7/31/2023 at 12:43 AM, NeinNeinNeinNope said:

Hey, using your program creates duplicates of species portraits even after deleting the original VF files, did i do something wrong or is this a bug.

 

EDIT: GOT IT, turns out it also made duplicate files in common because your naming is different from mugginnato's

 

 

Yea, noticed that when you pointed it out.
I'm dumb. ?
I'll change it for the next version.

Posted
On 7/31/2023 at 12:43 AM, NeinNeinNeinNope said:

Hey, using your program creates duplicates of species portraits even after deleting the original VF files, did i do something wrong or is this a bug.

 

EDIT: GOT IT, turns out it also made duplicate files in common because your naming is different from mugginnato's

 

 


Fixed it in the new version, and made the files more efficient.
Sorry all for the confusion in files!

If anyone has the duplicates problem due to the older versions go to:
Documents\Paradox Interactive\Stellaris\mod\Vanilla Framework\common\species_classes
And delete the text files without "_classes" in the name.

Should look like this afterwards:
image.png.330fc9935352fa15fc3ae50fa0d3c898.png

  • 4 weeks later...
Posted

I have no idea what I'm doing. I've put a new folder in models/Mammalian named Mam14 and put a bunch of .dds files inside. I run the program yet it is not adding my images. What am I doing wrong?

Posted
15 hours ago, Frederto said:

I have no idea what I'm doing. I've put a new folder in models/Mammalian named Mam14 and put a bunch of .dds files inside. I run the program yet it is not adding my images. What am I doing wrong?

It'll be either a problem with the files, or a problem with how it's running. Are you using python to run it, or command line?

  1.  Is it running normally on the other files?
    1. An easy test for this is to delete another whole folder (say a random other mammalian) and see if that species is removed in the mod. (Make a backup first or just re-download after)
    2. If it's not running it could be a command line/python issue
  2.  If it's working normally, than it might be a naming convention problem. If that's the case I may need to update my code

If you want you can zip the pics and send it to me. I'll see if I can get it working. If I can't than I'll update and fix.

Posted
6 hours ago, SomeoneThatYouNeverKnew said:

Question, Does this or does this not work with Machine species?


It works with Machine species just fine.

In fact, every time it runs it's actually regenerating/overwriting the species classes files and portrait files.
If any of the species already in VF didn't work, this would break them.

The only problem I foresee is if you try to gender your machines, as I don't know how Stellaris will handle this.
At worst I imagine it will just ignore one or more of the genders.
But genders might even work for them.

  • 1 month later...
Posted

i'm fairly certain everything's been set up right but i'm having problems with specifically reptilians being generated correctly almost all of them are blank black boxes and thats even with no mods other then the portrait mod i was putting together. I'm pretty sure i can manually fix them but i haven't been able to get it to do it correctly with just the script

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...