problem about screen sovrapposition, hiding wrong, jump wrong

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
User avatar
deltadidirac
Regular
Posts: 123
Joined: Fri Nov 30, 2018 5:00 am
Projects: Artworks and Comics
Tumblr: deltadidirac
Deviantart: Deltadidirac67
Location: Europe
Contact:

problem about screen sovrapposition, hiding wrong, jump wrong

#1 Post by deltadidirac » Fri Nov 01, 2019 8:37 am

Hi all

Are days that I'm fighting with the location's screens and my UI screen... (you can understand well if you saw also my post added yesterday and days ago, but for now I have this problem, that could be the MAIN problem respect the orthers)

In my UI I added a simple imagebutton that clicking on it do the action to return in your bedroom with a command action [Jump ("my_location_label")]
this action I can do it the first time I run the game or reload it, sometimes i can do it 2 or 3 time, but often or everytime, it happen that :
- I can stay in the same location and nothing happen
- or i ruturn to my bedroom, but if I go somewhere else, apper the location where I was before
- or sometimes moving trough the location, the old position will appear random.....
- and so on...

Because I can't know when the palyer will choose to click on this button (he could be in bath, out home, in school etc....) in the command action I added only the
[ Hide ("Interface"), Jump ("my_location_label"] and nothing else

My question is :
- must I set the location screen differently? (my screens have only a bg with the image buttons hotspot, nothing else)
- or must I write the action differently?
- or (I prefare it) exist a generic command for Hide all the screens (independently on witch is) and Jump or Show where or what you want?

PS
untill now, I have not at the moment an "imagemap" because I'm at the start of the game, so you move in every location (with his screen related ) only through the imagebutton that giving the action to jump in the different labels (time and dialogues or no events, depends on what values have the MC in that moment).


thanks

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: problem about screen sovrapposition, hiding wrong, jump wrong

#2 Post by Alex » Fri Nov 01, 2019 2:37 pm

Khm, it looks like you've mixed up screens and labels concepts.

You see, in Ren'Py there is a game flow - code executed line by line from start of the game (label start). For convenience, code can be devided in to labels. But if you don't have any jump statement, then when the program reach the end of the label it will go farther - to the next label (as you've coded it in your script files). So jump statement will let you make some branches/routs or loops in you game. If you need to run the same part of code several times from different places in your code, you can use call statement that will run label, and return to the line of code right next the line where it was called (you need a return statement as a last line of this called label).
Using labels and jump/call statements you can arrange the game flow or game loop. Like having each location in a different label, and jumping from one to another as player choose where to go. The simpliest gui would be the in-game menu with choices.

Screens are mainly made to visualise stuff to player, like showing date/time, player's hp, money, navigation buttons, etc. Also, you can create mini games, battle/inventory systems using screens.

If you don't need to show characters and their dialogues, like in normal vn, you can make screens for each location, and show them to player.
But if your game is a vn, it's better to make locations as labels, and use screens for GUI.

User avatar
deltadidirac
Regular
Posts: 123
Joined: Fri Nov 30, 2018 5:00 am
Projects: Artworks and Comics
Tumblr: deltadidirac
Deviantart: Deltadidirac67
Location: Europe
Contact:

Re: problem about screen sovrapposition, hiding wrong, jump wrong

#3 Post by deltadidirac » Fri Nov 01, 2019 3:30 pm

Alex wrote:
Fri Nov 01, 2019 2:37 pm
Khm, it looks like you've mixed up screens and labels concepts.

You see, in Ren'Py there is a game flow - code executed line by line from start of the game (label start). For convenience, code can be devided in to labels. But if you don't have any jump statement, then when the program reach the end of the label it will go farther - to the next label (as you've coded it in your script files). So jump statement will let you make some branches/routs or loops in you game. If you need to run the same part of code several times from different places in your code, you can use call statement that will run label, and return to the line of code right next the line where it was called (you need a return statement as a last line of this called label).
Using labels and jump/call statements you can arrange the game flow or game loop. Like having each location in a different label, and jumping from one to another as player choose where to go. The simpliest gui would be the in-game menu with choices.

Screens are mainly made to visualise stuff to player, like showing date/time, player's hp, money, navigation buttons, etc. Also, you can create mini games, battle/inventory systems using screens.

If you don't need to show characters and their dialogues, like in normal vn, you can make screens for each location, and show them to player.
But if your game is a vn, it's better to make locations as labels, and use screens for GUI.
Hi Alex
I understood your speech, tomorrow I will look more carefully at certain things; however I didn't know that the Return statement at the end of a label should be used with the call ... command (I thought that return used at the end of the label would always bring the game to the main_menu, instead, if I didn't understand it wrong, if you use call to call a label, then return doesn't take you to the main_menu, but simply back where you used "call", right?)

see you

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: problem about screen sovrapposition, hiding wrong, jump wrong

#4 Post by Alex » Fri Nov 01, 2019 5:14 pm

deltadidirac wrote:
Fri Nov 01, 2019 3:30 pm
... if you use call to call a label, then return doesn't take you to the main_menu, but simply back where you used "call", right?) ...
Yes, when you call a label you need to return back (if you don't need to return just use jump statement). But if you didn't call a label and there's no place to return, the game will return to main menu.
Well, it looks like

Code: Select all

main_menu:
    start:
        label_1:
            label_2
            return #return to label_1 level
        return #return to start level
    return #return to main menu
https://www.renpy.org/doc/html/label.html

Post Reply

Who is online

Users browsing this forum: Ocelot