Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+1)

Hi Shawna!!!

Thank you sm for all the resources you're always giving the community; your generosity and talent are so appreciated!!!! I'm trying to use your gradient shader as an alpha mask right now for an image to turn transparent. I'm running into some issues because the image itself is displayed based on a variable, so I've defined it as "image_[variable].png" for example. When I try to add the gradient as a mask to it, I get the error: "In DynamicImage 'image_[variable].png': Could not find substitution 'variable'. It was working perfectly find when I used a normal image but now that I've included a variable, it seems to be running into some issues q.q Do you happen to have any advice or is it just not compatible with this kind of code (or am I just doing something wrong LOL :pained smile:). Thank you sm!!! <3

(+1)

Thanks for your kind words!

Can you share the code you're using to declare the AlphaMask? I ran a quick test with the following code:

image radial_mask = GradientDisplayable(["#fff", "#0000"], xysize=(800, 800), kind='radial')
image feniks_masked = AlphaMask("feniks", "radial_mask")
default who = "feniks"
image test_masked = AlphaMask("[who]", "radial_mask")

which I was able to get working in 8.1, so with luck it'll just be a declaration issue :)

Yes! I should've mentioned it's on a screen, so I'm not sure if that changes things, but here's the current code:

define replaydate = ["aisaflower", "drukcafe", 
"drukflower", "drukmarket", "etzacafe", "etzaflower", 
"etzamarket","etzariver", "fenircafe", "fenirflower",
"fenirmarket", "fenirriver", "kayncafe", "kaynflower", 
"kaynmarket", "kaynriver", "kunaflower"]
default replayCurrent = 0
screen scenegallery():
    tag menu
    add "menu/extramemories.jpg"
    $ currentreplayDate = replaydate[replayCurrent]
    add AlphaMask("menu/memories_[currentreplayDate].png", GradientDisplayable(
        ["#FFF", "#0000"], kind="linear",
        thresholds=[0.1, 1.0], center=(0.25,0.5), angle=0)):
        xalign 0.85 yalign 0.5 zoom 0.5
        at bw

Basically, I want the image to update as it goes through the list of dates, so $ currentreplayDate helps me get the location on the list and show an image based on the date in focus. When I take out the variable and just put the image name, it works perfectly, but as soon as I want it to update based on the list variable, it doesn't work q.q 

Ah it's because the variable you're substituting doesn't exist all the time! You can use `format` or fstrings to fix this, for example:

add AlphaMask("menu/memories_{}.png".format(replaydate[replayCurrent]),

The problem is that your `$ currentreplayDate = replaydate[replayCurrent]` line only runs when the screen is up, so most of the time that variable doesn't exist and Ren'Py doesn't know what to search for in the dynamic image. Using fstrings or format substitutes the variable right in the path instead, so it isn't trying to search for an incomplete image path.

(+1)

AHHHHH yes that worked!!!! I had no idea the format/fstrings were a thing. Thank you so much!!!! YOURE A LIFESAVER <3