SOLUTION IN LAST POST, OF MINE.
I have folder/file format that reflects various things. Folder-names are used for the "locations" and "sub-locations", going up to five levels deep. Then, the file-names are used to identify who is in the scene, and the clothing, moods, times of day... (As opposed to cramming all of this into one folder, with massive names that can't be read at some point.)
An example of my folders/files would be...
../game/maps/town/home/kitchen/sink/noon.jpg (This is the SPOT image, without anyone)
../game/maps/town/home/kitchen/sink/bob casualwashdishes noon.jpg
../game/maps/city/office/lobby/counter/sue workreception morning.jpg
The hierarchy is actually this... (../game/maps/) is ignored...
(main sub area spot) = (town home kitchen sink)
(who [wearing:doing] when) = (bob casualwashdishes noon)
In the game, I "build" the "image to display", (which is not always an exact match), so I need all the tags preserved, from the folders and file-names.
SO... in the two examples, the actual "names" I need them accessed by, is...
scene town home kitchen sink bob casualwashdishes noon
scene city office lobby counter sue workreception morning
Looking at the codes, they look like they should work, but I can't get them to work. The codes are all old, and I can't even get the direct examples to work, or they are just too specific to one individuals needs, and only sort-of work, for my needs. (Help-files are kind-of vague, so there is only so much I can actually "look up", to see where they may be failing.)
I sort-of need it to be a function, so the code is not a giant nested tree of IF and FOR loops.
This is the old code that I found, which was (as far as I can see), setup to function as I need. But, for some reason, it doesn't function as desired, as it describes. (I only modified the code to remove the "flip image" function, which I do not need.)
I put this in the [options.rpy] file, which has a loading-order of -10, but that only matters for when it is read. "early", is specific to python, but I am not sure if that is even supported by RenPy.
Code: Select all
init python early:
#import os #[??? not needed, unsure, I added this in, as found in another set of code. I didn't get any errors without it. Thought it may be why it wasn't working.]
def define_images(imageFolder, excludeFolders=0):
for path in renpy.list_files():
if path.startswith(imageFolder + "/"):
path_list = path.split("/")
path_list[-1] = os.path.splitext(path_list[-1])[0]
path_list = tuple(path_list[excludeFolders:])
renpy.image(path_list, path)
$define_images('maps/', 1)
Which tells it to start looking in the "maps" folder, from the "games" folder... I also tried ('games/maps/', 2), and tried moving the "maps" folder into the "images" folder, with no luck.
A few specifically tell it to look for PNG, JPG and JPEG files... Some codes just said IMAGE_TYPES or something like that... I tried this with both PNG and JPG images, and nothing actually worked in any of the codes.
I would have used the auto-define function from RenPy (just adding them to the images directory, in the folders), but that has an odd demand of needing to repeat the folder-structure, within the name-structure, which is just redundant and stupid... "../eileen/smile/greenshirt/eileen_smile_greenshirt.png" = "eileen smile greenshirt".
This will be thousands of images... I don't want to type this all out, by hand, twice, per image... and burden everyone to also download that wasteful image-data too.
I don't know why we can't just use an image-path as the images to load, as a variable, when needed. Such an odd demand that they must be individually defined.
scene "myfile.jpg"
That is all anyone wants... or
$my_location = $loc_main + $loc_sub + $loc_... ... ...
scene $my_location
Which is essentially what I am trying to replicate in the "needs an image object" or "displayable"... scene-call-function
Just some side-notes... Each folder also has an associated image, related to the actual "map" that it displays... Used for the image-buttons, where you select the locations, per map-level. So those will also be "indexed" as displayables too.
../maps/bg.jpg <-(image of all main locations, as the "map")
../maps/town.jpg <-(icon of the "town" DEFAULT) [has an associated folder]
../maps/city.jpg
../maps/town selected.jpg <-(icon of the "town" SELECTED) [has an associated folder]
../maps/town hover.jpg
../maps/town/bg.jpg <-(BG image of the "town", displayed on screen.)
../maps/town/home.jpg <-(icon of the "home" DEFAULT) [has an associated folder]
../maps/town/home selected.jpg <-(icon of the "home" SELECTED) [has an associated folder]
../maps/town/store.jpg
../maps/town/store/bg.jpg
etc...
Where as the images, at each nested folder-level, are just specific to "something being displayed", at that level. Like "bob casualwaiting noon.jpg", "bob workcounter noon.jpg", "bob nudeshoweringhappy night.jpg"...
Bob (as a PNG overlay) may be in just the "house BG" (sub-location), or just in the "house bathroom BG" (area of sub-location), or "house bathroom shower BG" (spot in an area, in a sub-location)
When there is no specific "deeper nested image", the image from the higher-level loads, as that is generic to all the sub-locations in the tree. Which is why I need the image-tags retained.