How to call an image in the options screen? [Resolved]

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.
Post Reply
Message
Author
rufiangel
Regular
Posts: 29
Joined: Sat Dec 01, 2012 5:45 am
Contact:

How to call an image in the options screen? [Resolved]

#1 Post by rufiangel »

Hi folks, my coder created this amazing snowblossom effect that we wanted to put on the options screen of the VN we're working on, but we couldn't get Ren'Py to be cool with using the 'show' function with it (the traceback said the 'show' function wouldn't play nice with the 'screen'). We tried to use the 'add' function to call it instead, but then it asked us to define the image. We placed the definition everywhere we could think of but it still wouldn't recognise it. Is this simply not something we can do on the options screen?

Any help would be greatly appreciated. Thanks so much in advance!
Last edited by rufiangel on Sun Mar 29, 2020 7:33 am, edited 1 time in total.
Please check out Speechless, a project on hold for the moment!
Serpamia Flare: http://www.serpamiaflare.com
The Lethian: http://www.thelethian.com
DeviantArt: http://rufiangel.deviantart.com

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How to call an image in the options screen?

#2 Post by trooper6 »

What is the code for the snow blossom effect? What is it? Is it a screen? An image? A Transform?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: How to call an image in the options screen?

#3 Post by Donmai »

Are you by any chance forgetting to use quotes when referencing the image? For example:

Code: Select all

add "fallingStars"
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

rufiangel
Regular
Posts: 29
Joined: Sat Dec 01, 2012 5:45 am
Contact:

Re: How to call an image in the options screen?

#4 Post by rufiangel »

Sorry for not leading in with code examples! The code for the snow blossom effect looks something like this (I may have fudged the numbers a bit, sorry):

Code: Select all

image snowfall = ("snowflake.png")

image snow1 = SnowBlossom("snowfall", count=5, border=40, xspeed=(-20, 20), yspeed=(-5, -10), start=4.3, fast=False, horizontal=False)

image snow2 = SnowBlossom("snowfall", count=5, border=40, xspeed=(-20, 20), yspeed=(-8, 8), start=9, fast=False, horizontal=True)
To use it in the game we put the above under the init in the script.rpy file, and in the game itself (under labels) we used this code to call it, and it would work:

Code: Select all

    show snow1 onlayer borderframe
    show snow2 onlayer borderframe
We wanted to put it on our custom options screen, so I guess our initial attempt looked something like this:

Code: Select all

screen main_menu():

    tag menu

    show snow1
    show snow2
The traceback said something like the following:

Code: Select all

File "game/screens.rpy", line 257: u'show' is not a keyword argument or valid child for the screen statement.
We then tried using the add function, like this:

Code: Select all

screen main_menu():

    tag menu

    add snow1
    add snow2
But that returned the following traceback:

Code: Select all

  File "game/screens.rpy", line 257, in execute
    add snow1
NameError: name 'snow1' is not defined
Donmai, I tried putting it in quotation marks, and while it didn't cause any errors, the effect itself did not show in the options screen regardless. *scratches head*

I apologise if I come across as a bit vague, I am not a coding expert by any means. >-< Please let me know if there are further details I need to be explaining! I really appreciate all the help, thank you very much.
Please check out Speechless, a project on hold for the moment!
Serpamia Flare: http://www.serpamiaflare.com
The Lethian: http://www.thelethian.com
DeviantArt: http://rufiangel.deviantart.com

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: How to call an image in the options screen?

#5 Post by Donmai »

Quotation marks are mandatory in this case. Has your screen any background image? If that's the case, you should add the effect after the background. The last item added always appear on top. Maybe the effect is appearing behind the background image. Here's an example from one of my projects:

Code: Select all

screen music_room:
    tag menu
    add "alice_sleeping" #this is the background image
    add "fairydust" additive 0.85 alpha .85 # this is the animated particles effect
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

rufiangel
Regular
Posts: 29
Joined: Sat Dec 01, 2012 5:45 am
Contact:

Re: How to call an image in the options screen?

#6 Post by rufiangel »

Donmai - that was super helpful, and your remarks helped us fix the issue - we can now see that lovely effect on our options screen! Thank you so so much, it's so appreciated!! <3 You guys are the best!
Please check out Speechless, a project on hold for the moment!
Serpamia Flare: http://www.serpamiaflare.com
The Lethian: http://www.thelethian.com
DeviantArt: http://rufiangel.deviantart.com

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Andredron