Various newbie questions

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.
Message
Author
User avatar
LuckyBerry
Newbie
Posts: 20
Joined: Tue Sep 12, 2017 1:50 pm
Projects: aRomancetherapy!, The White Castle (title subject to change), and oh so much more lol
Location: Otakebi Land~
Contact:

Various newbie questions

#1 Post by LuckyBerry »

Hello everyone, nice to meet you :) Well, Exactly What It Says On The Tin: ren'py newbie here and i've got various things I'd like to add to my projects but that I haven't found out how to do (especially since I'm using the new GUI interface and there are many outdated resources) so any help (tutorials I should see, your own explanations, etc) would be really appreciated ;A;

So here's what interests me:

How to...
  • Add a splashscreen
    Make an interactive screen for a "daily planner" (player chooses where to go from a map)
    Make the background interactive (player can inspect objects in the background image)
    Add a gallery and in general how to add new screens apart of the default start, load, about, etc. (like an extras thing, etc)
    ...Change the font of the quickmenu :lol:
Well, so yeah, that hehe, thanks in advance and sorry for bothering you with my no0b problems :mrgreen: Also, if anyone is kind enough to write their own explanation, please don't forget to mention exactly in which rpy file the code should be placed (script, options, gui, etc), sometimes something as simple as that has confused me :oops:

Ana
Regular
Posts: 61
Joined: Sun Oct 12, 2014 5:56 pm
Contact:

Re: Various newbie questions

#2 Post by Ana »

I think I could probably answer two of those questions, mostly because I've been playing around with them in my own game lol..

Make the background interactive (player can inspect objects in the background image):
Just recently answered this in another topic, actually. You can use these types of interactive backgrounds with imagemaps. I feel like there may be a more efficient way to do this, but if you don't do it too often, it shouldn't be a problem.

Add a gallery and in general how to add new screens apart of the default start, load, about, etc. (like an extras thing, etc)
No idea how to do gallery (I'm sure there are plenty of guides on that), but I could show how to do a basic 'extra' menu:
Go into screens.rpy. There should be an about screen, so you can look to that for reference. In case you want to add one from scratch...

Add:

Code: Select all

textbutton _("NAME OF YOUR SCREEN HERE") action ShowMenu("SCREENNAMEHERE")
Also, add:

Code: Select all

screen SCREENNAMEHERE():

    tag menu

    use game_menu(_("NAME OF YOUR SCREEN HERE"), scroll="viewport"):
        style_prefix "NAMEOFSCREENTYPEHERE"
        
        has vbox:
            vbox:
                
                spacing 20
                
                text _("{b}Riley")
                
                text _("{b}Height: 188 cm.")
                text _("{b}Weight: 77 kg.")
                
                if not persistent.blood:
                    text _("{b}Blood Type: ???")
                else:
                    text _("{b}Blood Type: O")
                
                if not persistent.birth:
                    text _("{b}Date of Birth: ???")
                else:
                    text _("{b}Date of Birth: August 23.")
                    text _("{b}Zodiac Sign: Virgo.")
That's how you would go about making a really, really basic menu. You can do a lot of customization too (i.e. moving the box around, etc). I also included persistents that you can throw in if something changes over a route, like an image, or a text description. Sorry if I can't really be of much help on the other things.

Inksword
Regular
Posts: 83
Joined: Fri Oct 24, 2014 1:20 am
Tumblr: inksword
Contact:

Re: Various newbie questions

#3 Post by Inksword »

The RenPy cookbook is the best place to look for a lot of these questions. These are pretty common things that many VNs use, so it's pretty likely that someone's put up a guide about it already! In fact, I found this single topic that covers all the questions you asked! It's from 2014, so it might be a little out of date, but the foundations should be the same. The search function for the forum is also really useful for this stuff, if you limit it to the coding sections of the forum and input some keywords, you can find lots of stuff!

verysunshine
Veteran
Posts: 339
Joined: Wed Sep 24, 2014 5:03 pm
Organization: Wild Rose Interactive
Contact:

Re: Various newbie questions

#4 Post by verysunshine »

The extra menu code works well in the current version of Ren'Py, but in some older versions, it can cause problems. I believe this applies to games with "Change Theme" on the launcher instead of "Change/Update GUI".

1) "use game_menu" is invalid, as the game_menu screen is not in the code
2) "has vbox" does not require a colon, and vbox is not required afterwards
3) "style" will cause an error, as that style isn't defined
4) "spacing 20" is not read as a style instruction

In addition, {b} makes everything bold. This seems to be unintentional, and would affect all versions of the screens syntax.

It looks like you were making a character bio screen, so that"s what I'll be showing here. This runs without having to copy other bits of code, but it doesn't scroll. No promises for if it works on newer versions. Hopefully, my comments will be useful, at least.

Code: Select all

screen character_bio():
    
    #This tells the game to bring up the "navigation" menu, which is useful when interfacing with the menus instead of the game itself.
    use navigation()
    
    window:
        style "character_bio"
        
        has vbox
                
         #This tells the game to go get a line of text.       
        text _("{b}{u}Riley{/u}{/b}") 
        # The closing tags aren't necessary at the end of a text string, but it's a good habit to get into.
                
        text _("{b}Height:{/b} 188 cm.")
        text _("{b}Weight:{/b} 77 kg.")
                
        #These rely on persistent variables, which you can learn about at https://www.renpy.org/doc/html/persistent.html
        if not persistent.blood:
            text _("{b}Blood Type:{/b} ???")
        else:
            text _("{b}Blood Type:{/b} O")
                
        if not persistent.birth:
            text _("{b}Date of Birth: ???")
        else:
            text _("{b}Date of Birth: August 23.")
            text _("{b}Zodiac Sign: Virgo.")

init -2:
#The style should match the name you gave it under "window:"
    style character_bio:
    #sets line spacing to 20 pixels
        spacing 20
To put it in another menu, add this to the area where you want the button to be. This code works in any version.

Code: Select all

textbutton _("Character Bio") action ShowMenu('character_bio')

Build the basics first, then add all the fun bits.

Please check out my games on my itch.io page!

User avatar
LuckyBerry
Newbie
Posts: 20
Joined: Tue Sep 12, 2017 1:50 pm
Projects: aRomancetherapy!, The White Castle (title subject to change), and oh so much more lol
Location: Otakebi Land~
Contact:

Re: Various newbie questions

#5 Post by LuckyBerry »

Thanks again to everyone who replied! I haven't said anything until now because I've been kinda away from my ren'py projects these days and thus hadn't tried anything of what was said here~ But now that I have time, I decided to start with try adding an "extras" screen and while it all worked just fine, I just wonder if the test info provided by Ana is supposed to look like that? I mean, I DID have to erase some li'l parts of the code or else it would give me an error... Anyways, here's the pic:

https://s18.postimg.org/wpuhhail5/extrascreen.png

Is that ok? Didn't I mutilate the test info? lol Just wanna know to have a nice example of what can be put in there.

And thanks to verysunshine for your own comments in the subject! The example Ana provided is fine with me since I'm using (almost) the newest version of Ren'py :mrgreen:

verysunshine
Veteran
Posts: 339
Joined: Wed Sep 24, 2014 5:03 pm
Organization: Wild Rose Interactive
Contact:

Re: Various newbie questions

#6 Post by verysunshine »

LuckyBerry wrote: Fri Feb 09, 2018 7:06 am Thanks again to everyone who replied! I haven't said anything until now because I've been kinda away from my ren'py projects these days and thus hadn't tried anything of what was said here~ But now that I have time, I decided to start with try adding an "extras" screen and while it all worked just fine, I just wonder if the test info provided by Ana is supposed to look like that? I mean, I DID have to erase some li'l parts of the code or else it would give me an error... Anyways, here's the pic:

https://s18.postimg.org/wpuhhail5/extrascreen.png

Is that ok? Didn't I mutilate the test info? lol Just wanna know to have a nice example of what can be put in there.

And thanks to verysunshine for your own comments in the subject! The example Ana provided is fine with me since I'm using (almost) the newest version of Ren'py :mrgreen:
What is the difference between the text in the screenshot and what you want to see? To me, the text here looks fine.

Build the basics first, then add all the fun bits.

Please check out my games on my itch.io page!

User avatar
LuckyBerry
Newbie
Posts: 20
Joined: Tue Sep 12, 2017 1:50 pm
Projects: aRomancetherapy!, The White Castle (title subject to change), and oh so much more lol
Location: Otakebi Land~
Contact:

Re: Various newbie questions

#7 Post by LuckyBerry »

Well, I dunno since I'm using Ana's example code not mine lol~ Looking at that it looks pretty ok but I had to erase the "has vbox" part (and the spacing) or else an error would appear... I guess I want to know what exactly is the vbox thing about? Was the text supposed to appear inside a box or something? Or is that simple plain ol' text all that the example was about?

Code: Select all

        vbox:
 
                text _("{b}Riley")
                
                text _("{b}Height: 188 cm.")
                text _("{b}Weight: 77 kg.")
                
                if not persistent.blood:
                    text _("{b}Blood Type: ???")
                else:
                    text _("{b}Blood Type: O")
                
                if not persistent.birth:
                    text _("{b}Date of Birth: ???")
                else:
                    text _("{b}Date of Birth: August 23.")
                    text _("{b}Zodiac Sign: Virgo.")

verysunshine
Veteran
Posts: 339
Joined: Wed Sep 24, 2014 5:03 pm
Organization: Wild Rose Interactive
Contact:

Re: Various newbie questions

#8 Post by verysunshine »

"has vbox" means items in the lists should be listed in rows, which yours does anyway. I think "vbox:" might do the same thing. @Ana could clarify this.

Build the basics first, then add all the fun bits.

Please check out my games on my itch.io page!

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Various newbie questions

#9 Post by xavimat »

boxes have not background property, if you want to use a background you have to put the vbox or hbox inside a container that has this property, like "window" or (usually) "frame". So, to avoid a double level of indentation, you can use "has" in window or frame.
This two are the same, but the second one more elegant:

Code: Select all

frame:
    # Here properties to the frame
    vbox:
        # here properties of the vbox
        text "1"
        text "2"
frame:
    # Here properties to the frame
    has vbox
    # here properties of the vbox
    text "1"
    text "2"
If you don't need a background on the vbox/hbox, you can (as you have done) put directly the vbox/hbox in the screen.

https://www.renpy.org/doc/html/screens. ... -statement
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

verysunshine
Veteran
Posts: 339
Joined: Wed Sep 24, 2014 5:03 pm
Organization: Wild Rose Interactive
Contact:

Re: Various newbie questions

#10 Post by verysunshine »

xavimat wrote: Sat Feb 10, 2018 8:23 pm boxes have not background property, if you want to use a background you have to put the vbox or hbox inside a container that has this property, like "window" or (usually) "frame". So, to avoid a double level of indentation, you can use "has" in window or frame.
This two are the same, but the second one more elegant:

Code: Select all

frame:
    # Here properties to the frame
    vbox:
        # here properties of the vbox
        text "1"
        text "2"
frame:
    # Here properties to the frame
    has vbox
    # here properties of the vbox
    text "1"
    text "2"
If you don't need a background on the vbox/hbox, you can (as you have done) put directly the vbox/hbox in the screen.

https://www.renpy.org/doc/html/screens. ... -statement
What's the difference between text "Text" and text _("Text")? Can you get away with removing the underscore and brackets and still have it accepted as proper Python syntax?

Build the basics first, then add all the fun bits.

Please check out my games on my itch.io page!

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Various newbie questions

#11 Post by Remix »

verysunshine wrote: Sun Feb 11, 2018 6:49 am What's the difference between text "Text" and text _("Text")? Can you get away with removing the underscore and brackets and still have it accepted as proper Python syntax?
The _( ) part is a python function that passes the input value through the translation module... So basically, anything wrapped in _( ) will be translatable, appear in any translation files (ready to be translated) and be auto translated in game if the translation file has been completed.

For games just using one language, you could ignore using _( ) ... though it is still a good practice to use them, just in case you want to translate later.

For info, there is also a __( ) similar function and a _p( ) function... More Details
Frameworks & Scriptlets:

Sirdheenz
Newbie
Posts: 11
Joined: Wed Jan 31, 2018 6:15 am
Contact:

how to get imagemap to repeat with 1 command

#12 Post by Sirdheenz »

hey i am new starter 1 month in renpy, i have a question about imagemap. .
screen blabla:
imagemap auto ("blabla _% .png") xpos 0 ypos 0 focus_mask True action Return ("blablabla")

something like that, but the problem was just a click and not a "show".
this is the problem that I experienced and make my head smoky, because when I install 2 imagemap in the background first click may succeed but when in the click again imagemap is missing and does not appear .
code (show screen blablabla call screen blablabla) like this code that I use to call the imagemap in star label. my question "how to keep imagemap can still exist / appear even though I go in one scene and still can click" example I make 2 imagemap
screen blabla:
imagemap auto ( "blabla _%. png") xpos 100 ypos 100 focus_mask True action Return ("blabla")
screen alala:
imagemap auto ("alala _%. png) xpos 50 ypos 50 focus_mask True action Return (" alala ")
label start:
scene blck
show screen blabla
call screen blabla
show screen alala
call screen alala
$ result = _return
if _return = "blabla"
blck scene (I want this in direct hit jump to "blck scene")
$ result = _return
if _return = "alala"
scene blck

here code that i use ..
and when i click blabla / alala it managed to move me to blck screen, but here the problem is after blabla / alala brings me to blck scene when cursor leads to blabla / alala they die.
unlike before its when the cursor approaches they light up and this is off when you want to click the second time, can I repeat it stay there even though I repeatedly clicked on them and they stay on and respond ???

sorry i question is somewhat understood from the language .. i'm bad about english .. please understand me i need your help
Last edited by Sirdheenz on Mon Feb 12, 2018 12:34 am, edited 2 times in total.

User avatar
mitoky
Veteran
Posts: 316
Joined: Sat Feb 07, 2015 9:12 pm
Projects: The Purring Demon's Love, circus eterie
Contact:

Re: Various newbie questions

#13 Post by mitoky »

Sirdheenz wrote: Mon Feb 12, 2018 12:03 am hey i am new starter 1 month in renpy, i have a question about imagemap. .
screen blabla:
imagemap auto ("blabla _% .png") xpos 0 ypos 0 focus_mask True action Return ("blablabla")

something like that, but the problem was just a click and not a "show".
this is the problem that I experienced and make my head smoky, because when I install 2 imagemap in the background first click may succeed but when in the click again imagemap is missing and does not appear .
code (show screen blablabla call screen blablabla) like this code that I use to call the imagemap in star label. my question "how to keep imagemap can still exist / appear even though I go in one scene and still can click" example I make 2 imagemap
screen blabla:
imagemap auto ( "blabla _%. png") xpos 100 ypos 100 focus_mask True action Return ("blabla")
screen alala:
imagemap auto ("alala _%. png) xpos 50 ypos 50 focus_mask True action Return (" alala ")
label start:
scene blck
show screen blabla
call screen blabla
show screen alala
call screen alala
$ result = _return
if _return = "blabla"
blck scene (I want this in direct hit jump to "blck scene")
$ result = _return
if _return = "alala"
scene blck

here code that i use ..
and when i click blabla / alala it managed to move me to blck screen, but here the problem is after blabla / alala brings me to blck scene when cursor leads to blabla / alala they die.
unlike before its when the cursor approaches they light up and this is off when you want to click the second time, can I repeat it stay there even though I repeatedly clicked on them and they stay on and respond ???

sorry i question is somewhat understood from the language .. i'm bad about english .. please understand me i need your help
Its a bit hard for me to understand what your problem is.
The best thing would be if you post your code with the code format on lemmasoft. Like this without the stars: [*code] YOUR CODE HERE [*/code]

Afterwards explain:
1.) what happens with that code and
2.) what you want to actually happen instead
If you cant speak english good, thats no problem (: Try to explain in short points, it may helpt a bit!

Also, if you have more than one problem with your code, list each problem one after another.

Sirdheenz
Newbie
Posts: 11
Joined: Wed Jan 31, 2018 6:15 am
Contact:

Re: Various newbie questions

#14 Post by Sirdheenz »

mitoky wrote: Mon Feb 12, 2018 12:25 am
Sirdheenz wrote: Mon Feb 12, 2018 12:03 am hey i am new starter 1 month in renpy, i have a question about imagemap. .
screen blabla:
imagemap auto ("blabla _% .png") xpos 0 ypos 0 focus_mask True action Return ("blablabla")

something like that, but the problem was just a click and not a "show".
this is the problem that I experienced and make my head smoky, because when I install 2 imagemap in the background first click may succeed but when in the click again imagemap is missing and does not appear .
code (show screen blablabla call screen blablabla) like this code that I use to call the imagemap in star label. my question "how to keep imagemap can still exist / appear even though I go in one scene and still can click" example I make 2 imagemap
screen blabla:
imagemap auto ( "blabla _%. png") xpos 100 ypos 100 focus_mask True action Return ("blabla")
screen alala:
imagemap auto ("alala _%. png) xpos 50 ypos 50 focus_mask True action Return (" alala ")
label start:
scene blck
show screen blabla
call screen blabla
show screen alala
call screen alala
$ result = _return
if _return = "blabla"
blck scene (I want this in direct hit jump to "blck scene")
$ result = _return
if _return = "alala"
scene blck

here code that i use ..
and when i click blabla / alala it managed to move me to blck screen, but here the problem is after blabla / alala brings me to blck scene when cursor leads to blabla / alala they die.
unlike before its when the cursor approaches they light up and this is off when you want to click the second time, can I repeat it stay there even though I repeatedly clicked on them and they stay on and respond ???

sorry i question is somewhat understood from the language .. i'm bad about english .. please understand me i need your help
Its a bit hard for me to understand what your problem is.
The best thing would be if you post your code with the code format on lemmasoft. Like this without the stars: [*code] YOUR CODE HERE [*/code]

Afterwards explain:
1.) what happens with that code and
2.) what you want to actually happen instead
If you cant speak english good, thats no problem (: Try to explain in short points, it may helpt a bit!

Also, if you have more than one problem with your code, list each problem one after another.
sorry sir .. i dont know .

verysunshine
Veteran
Posts: 339
Joined: Wed Sep 24, 2014 5:03 pm
Organization: Wild Rose Interactive
Contact:

Re: Various newbie questions

#15 Post by verysunshine »

Sirdheenz wrote: Mon Feb 12, 2018 12:38 am
mitoky wrote: Mon Feb 12, 2018 12:25 am
Sirdheenz wrote: Mon Feb 12, 2018 12:03 am hey i am new starter 1 month in renpy, i have a question about imagemap. .
screen blabla:
imagemap auto ("blabla _% .png") xpos 0 ypos 0 focus_mask True action Return ("blablabla")

something like that, but the problem was just a click and not a "show".
this is the problem that I experienced and make my head smoky, because when I install 2 imagemap in the background first click may succeed but when in the click again imagemap is missing and does not appear .
code (show screen blablabla call screen blablabla) like this code that I use to call the imagemap in star label. my question "how to keep imagemap can still exist / appear even though I go in one scene and still can click" example I make 2 imagemap
screen blabla:
imagemap auto ( "blabla _%. png") xpos 100 ypos 100 focus_mask True action Return ("blabla")
screen alala:
imagemap auto ("alala _%. png) xpos 50 ypos 50 focus_mask True action Return (" alala ")
label start:
scene blck
show screen blabla
call screen blabla
show screen alala
call screen alala
$ result = _return
if _return = "blabla"
blck scene (I want this in direct hit jump to "blck scene")
$ result = _return
if _return = "alala"
scene blck

here code that i use ..
and when i click blabla / alala it managed to move me to blck screen, but here the problem is after blabla / alala brings me to blck scene when cursor leads to blabla / alala they die.
unlike before its when the cursor approaches they light up and this is off when you want to click the second time, can I repeat it stay there even though I repeatedly clicked on them and they stay on and respond ???

sorry i question is somewhat understood from the language .. i'm bad about english .. please understand me i need your help
Its a bit hard for me to understand what your problem is.
The best thing would be if you post your code with the code format on lemmasoft. Like this without the stars: [*code] YOUR CODE HERE [*/code]

Afterwards explain:
1.) what happens with that code and
2.) what you want to actually happen instead
If you cant speak english good, thats no problem (: Try to explain in short points, it may helpt a bit!

Also, if you have more than one problem with your code, list each problem one after another.
sorry sir .. i dont know .
It's okay to not understand things. I think we're all a little bit confused.

What is your native language? Knowing the language you speak could help us communicate.

Code can be added to forum posts with the "</>" button. The button is above the text box. It should give you this:

Code: Select all

CODE GOES HERE!
Here is what I think your code looks like.

Code: Select all

screen blabla: 
	imagemap auto ( "blabla _%. png") xpos 100 ypos 100 focus_mask True action Return ("blabla")
screen alala: 
	imagemap auto ("alala _%. png) xpos 50 ypos 50 focus_mask True action Return (" alala ") 
label start:
 	scene blck 
	show screen blabla 
	call screen blabla 
	show screen alala 
	call screen alala 
	$ result = _return 
	if _return = "blabla" 
		blck scene #(I want this in direct hit jump to "blck scene") 
		$ result = _return 
	if _return = "alala" 
		scene blck
		$ result = _return 
The line "blck scene" does not mean anything in Ren'Py. It tells Ren'Py to look for a "blck" named "scene". It doesn't know what a "blck" is, so it will create an error. You can replace "blck scene" with "scene blck" or "jump blck scene". These instructions will produce different results.

The line "scene black" will tell Ren'Py to look for a "scene" called "blck". Scenes are the backgrounds. (Think of it as "scenery".)

The line "jump blck scene" will make Ren'Py look for a label named "blck scene." If it finds this label, it will start reading the information in that label. You can look in the sample game "The Question" to see how this works. This game came with Ren'Py. It's located below the tutorial.

I do not understand the questions you are asking. Please do not be discouraged. We would love to help you.

I could guess what you are asking, but that may not help.

"How to keep imagemap can still exist / appear even though I go in one scene and still can click" could be "How do I keep the imagemap visible even after I go into a scene and can click on other things?"

"after blabla / alala brings me to blck scene when cursor leads to blabla / alala they die.
unlike before its when the cursor approaches they light up and this is off when you want to click the second time, can I repeat it stay there even though I repeatedly clicked on them and they stay on and respond ??? " is less clear. "After blablabla or alala bring me to the blck screen, when the cursor goes over blablabla or alalala the screens disappear. Before, when the cursor goes over the buttons, they light up. When you go to click the second time, they do not light up. Can they still light up when my cursor is over them after I select a button?" The last sentence is my biggest guess. I have no idea what your question means.

What are blablabla and alala supposed to do within the game? Are the screens maps, with the buttons being locations? Are the screens part of a heads up display? Is it something else?

Build the basics first, then add all the fun bits.

Please check out my games on my itch.io page!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], haitai