Page 1 of 1

How To Define Images Using Variables

Posted: Tue May 21, 2019 7:25 pm
by K1tten
So, I'm modding Doki Doki Literature Club by Team Salvato, and I'm trying to input a variable into the image definitions to make them wear different clothes. Here's the code that I've tried:

image sayori 1g = im.Composite((960, 960), (0, 0), "sayori/1l[s_clothes].png", (0, 0), "sayori/1r[s_clothes].png", (0, 0), "sayori/g.png")

s_clothes is the variable. So, if the s_clothes variable is "a", it should be showing 1la.png, but it isn't working. It says it cannot find the image.

The weird thing is, it worked in a game that I'm making (not as a mod, as an original game). This is the code in my game where it works (we'll just pretend the character's name is Meep):
image meep 1 = LiveComposite(
(800, 770),
(0, 0), "/characters/meep/meep_body[meep_body].png",
(0, 0), "/characters/meep/meep_head1.png",
(0, 0), "/characters/meep/meep_brows[meep_brows].png",
(0, 0), "/characters/meep/meep_mouth[meep_mouth].png",
(0, 0), "meep blink"
)

So the "meep_body" variable changes the body position of Meep. So 1 would be crossed arms, for example. And that works fine. But I don't know why it isn't working in the mod I'm making.

Re: How To Define Images Using Variables

Posted: Fri May 24, 2019 9:51 pm
by K1tten
bump

Re: How To Define Images Using Variables

Posted: Sat May 25, 2019 7:10 am
by Per K Grok
K1tten wrote: Tue May 21, 2019 7:25 pm So, I'm modding Doki Doki Literature Club by Team Salvato, and I'm trying to input a variable into the image definitions to make them wear different clothes. Here's the code that I've tried:

image sayori 1g = im.Composite((960, 960), (0, 0), "sayori/1l[s_clothes].png", (0, 0), "sayori/1r[s_clothes].png", (0, 0), "sayori/g.png")

s_clothes is the variable. So, if the s_clothes variable is "a", it should be showing 1la.png, but it isn't working. It says it cannot find the image.

The weird thing is, it worked in a game that I'm making (not as a mod, as an original game). This is the code in my game where it works (we'll just pretend the character's name is Meep):
image meep 1 = LiveComposite(
(800, 770),
(0, 0), "/characters/meep/meep_body[meep_body].png",
(0, 0), "/characters/meep/meep_head1.png",
(0, 0), "/characters/meep/meep_brows[meep_brows].png",
(0, 0), "/characters/meep/meep_mouth[meep_mouth].png",
(0, 0), "meep blink"
)

So the "meep_body" variable changes the body position of Meep. So 1 would be crossed arms, for example. And that works fine. But I don't know why it isn't working in the mod I'm making.

You could try

"sayori/1l" + s_clothes + ".png"

Re: How To Define Images Using Variables

Posted: Sun Jun 02, 2019 7:38 pm
by K1tten
Per K Grok wrote: Sat May 25, 2019 7:10 am
K1tten wrote: Tue May 21, 2019 7:25 pm So, I'm modding Doki Doki Literature Club by Team Salvato, and I'm trying to input a variable into the image definitions to make them wear different clothes. Here's the code that I've tried:

image sayori 1g = im.Composite((960, 960), (0, 0), "sayori/1l[s_clothes].png", (0, 0), "sayori/1r[s_clothes].png", (0, 0), "sayori/g.png")

s_clothes is the variable. So, if the s_clothes variable is "a", it should be showing 1la.png, but it isn't working. It says it cannot find the image.

The weird thing is, it worked in a game that I'm making (not as a mod, as an original game). This is the code in my game where it works (we'll just pretend the character's name is Meep):
image meep 1 = LiveComposite(
(800, 770),
(0, 0), "/characters/meep/meep_body[meep_body].png",
(0, 0), "/characters/meep/meep_head1.png",
(0, 0), "/characters/meep/meep_brows[meep_brows].png",
(0, 0), "/characters/meep/meep_mouth[meep_mouth].png",
(0, 0), "meep blink"
)

So the "meep_body" variable changes the body position of Meep. So 1 would be crossed arms, for example. And that works fine. But I don't know why it isn't working in the mod I'm making.

You could try

"sayori/1l" + s_clothes + ".png"
Thanks! I'll try that.