Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
-
NickelBuckle9
- Regular
- Posts: 36
- Joined: Wed Sep 14, 2011 3:47 pm
- Completed: MiniBot
- Projects: Ah! Peku, Pokemon Trainer Game (untitled)
- Location: United States - East Coast
-
Contact:
#1
Post
by NickelBuckle9 » Thu Dec 22, 2011 5:38 pm
So, I figured out how to get the variables working. I now have a variable "HAIR" which specifies the correct image file in the correct format:
Pictures/H1A.png
by using something like this:
Code: Select all
$ HAIR = "Pictures/H" + HAIRSTYLE + HAIRCOLOR + ".png"
Is there any way to define the image "hair" by using this variable?
Code: Select all
image hair = HAIR
image hair = str(HAIR)
#and...
image hair = "[HAIR]"
# don't work D: What do I do???
image hair = "[HAIR]" comes the closet to working, as it runs smoothly until it must display the image. However, red text appears that says:
"Image 'Pictures/H25B.png' not found"
Any ideas? Thank you so much!
Last edited by
NickelBuckle9 on Fri Dec 23, 2011 12:16 pm, edited 4 times in total.
-
Mild Curry
- Regular
- Posts: 107
- Joined: Fri Jul 02, 2010 3:03 pm
- Projects: That's The Way The Cookie Crumbles
- Organization: TwinTurtle Games
-
Contact:
#2
Post
by Mild Curry » Thu Dec 22, 2011 7:20 pm
Hmm...try it this way:
Code: Select all
$ HAIR = "Pictures/H" + str(HAIRSTYLE) + str(HAIRCOLOR) + ".png"
It's basically assuring the game that those variables are strings too, and therefore part of the larger string.
-
NickelBuckle9
- Regular
- Posts: 36
- Joined: Wed Sep 14, 2011 3:47 pm
- Completed: MiniBot
- Projects: Ah! Peku, Pokemon Trainer Game (untitled)
- Location: United States - East Coast
-
Contact:
#3
Post
by NickelBuckle9 » Thu Dec 22, 2011 7:26 pm
Mild Curry wrote:Hmm...try it this way:
Code: Select all
$ HAIR = "Pictures/H" + str(HAIRSTYLE) + str(HAIRCOLOR) + ".png"
It's basically assuring the game that those variables are strings too, and therefore part of the larger string.
Thanks! ...but I managed to figure out why it wasn't working. Apparently it needs to be in the actual game script after the start label, not at the beginning.
Would you have any idea how to use this variable to define an image? I edited the topic as you replied it seems. >_>
-
Mild Curry
- Regular
- Posts: 107
- Joined: Fri Jul 02, 2010 3:03 pm
- Projects: That's The Way The Cookie Crumbles
- Organization: TwinTurtle Games
-
Contact:
#4
Post
by Mild Curry » Fri Dec 23, 2011 3:17 am
Hmm...that's odd. "image hair = HAIR" works fine for me.
Well, anyway, you don't want to define 'hair' as an image. I don't think images defined in init blocks can be changed.
Try this:
Code: Select all
$ HAIR = "Pictures/H" + HAIRSTYLE + HAIRCOLOR + ".png"
show expression HAIR
*sorry if this is irrelevant again*
-
NickelBuckle9
- Regular
- Posts: 36
- Joined: Wed Sep 14, 2011 3:47 pm
- Completed: MiniBot
- Projects: Ah! Peku, Pokemon Trainer Game (untitled)
- Location: United States - East Coast
-
Contact:
#5
Post
by NickelBuckle9 » Fri Dec 23, 2011 12:16 pm
Mild Curry wrote:Hmm...that's odd. "image hair = HAIR" works fine for me.
Well, anyway, you don't want to define 'hair' as an image. I don't think images defined in init blocks can be changed.
Try this:
Code: Select all
$ HAIR = "Pictures/H" + HAIRSTYLE + HAIRCOLOR + ".png"
show expression HAIR
*sorry if this is irrelevant again*
AHHHH! It worked! Thank you so much! You just saved my over 150 lines of repetitive code, haha. <3
Users browsing this forum: Bing [Bot], Google [Bot]