Label and Screen problem [solved]

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
Turtle Joshua
Newbie
Posts: 7
Joined: Thu Jun 21, 2018 12:12 pm
Contact:

Label and Screen problem [solved]

#1 Post by Turtle Joshua »

Heyo everyone !
So basically I've made an imagemap that lead you in the inventory screen.
Imagemap

Code: Select all

screen inventory_screen:
    imagemap:
        ground "inventory_idle.png"
        hover "inventory_hover.png"
        
        hotspot (113,25,228,136) action Jump("TV")
        hotspot (355,25,470,136) clicked Jump ("Journal")
        hotspot (588,25,703,136) clicked Jump ("P1")
        hotspot (830,25,945,136) clicked Jump ("P2")
        hotspot (113,185,228,297) clicked Jump ("Audiow")
        hotspot (355,185,470,297) clicked Jump ("Pa1")
        hotspot (588,185,703,297) clicked Jump ("Pa2")
        hotspot (830,185,945,297) clicked Jump ("P3")
        hotspot (111,356,226,468) clicked Jump ("Pa3")
        hotspot (355,356,470,468) clicked Jump ("Pa4")
        hotspot (588,356,703,468) clicked Jump ("Note_sur_10")
        
        
        textbutton "RETURN" action [ Hide("inventory_screen"), Show("inventorybutton"), Return(None)] hovered [ Play ("sound", "sfx_click.wav")] focus_mask True:
            xalign .95 yalign .05
            idle_background Frame("button glossy idle", 99, 99)
            hover_background Frame("button glossy hover", 99, 99)
Everything is good here.
Then I've made the "TV" label...

label TV:

Code: Select all

label TV:
hide beach
hide screen inventory_screen
scene void with dissolve
e "Here it is?"
show screw at center with dissolve:
    yalign 0.2
e "Does it works ?"
show beach
show screen inventory_screen

label TV_done:
And when this label ends, the game ends too. However I just want it to return to the "inventory_screen".( And you can return to the game from this "inventory_screen" with the "RETURN" button.)



Do you know by any chance what I've done wrong there ?
Last edited by Turtle Joshua on Sat Jun 23, 2018 6:25 am, edited 1 time in total.

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

Re: Label and Screen problem

#2 Post by Alex »

Try something like this - viewtopic.php?f=8&t=48359#p478960

User avatar
Turtle Joshua
Newbie
Posts: 7
Joined: Thu Jun 21, 2018 12:12 pm
Contact:

Re: Label and Screen problem

#3 Post by Turtle Joshua »

I just tried it, and it works perfectly and all, but with this part:

Code: Select all

label place_1:
    "Ah, it's place 1."
    "^-^"
    return
label place_2:
    "Ah, it's place 2."
    "^-^"
    return
label place_3:
    "Ah, it's place 3."
    "^-^"
    return
When the label is finished, it ends the game, but I want it to go back to:

Code: Select all

label loop:
        "Where do we go now?"
        "... ..."
        jump loop
Or if I can be more precise (with the code I've put above):
when label TV is finished > Jump inventory_screen
if "RETOUR" button is clicked > go back to where we were. (I mean if at the sentence "Hey, how are you?" we decided to have a look at the inventory screen, when we quit this screen, the text that should appear is "Hey, how are you?")

I'm sorry to bother you like that ^^'

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

Re: Label and Screen problem

#4 Post by Alex »

Mmm, if I get it correct you need such a system

Code: Select all

screen inv_btn():
    textbutton "Inventory" action [Hide("inv_btn"), Show("inventory_screen"), Call("inv_loop")] align (0.05, 0.05) # hide the button so player can't click it while in inventory
        
screen inventory_screen():
    frame:
        align(0.5, 0.3)
        vbox:
            textbutton "Label 1" action Jump("lbl_1")
            textbutton "Label 2" action Jump("lbl_2")
            textbutton "Return" action [Show("inv_btn"), Hide("inventory_screen"),Jump("rtrn_lbl")] # show inv_btn on return from inventory


label inv_loop: #place to return from different labels
    $ ui.interact() #do nothing just waits
    jump inv_loop
    
label rtrn_lbl: # return from inventory
    return
            
            
label start:
    "..."
    show screen inv_btn # button to show inventory screen
    "Line 1"
    "Line 2"
    "Line 3"
    "Line 4"
    "Line 5"
    "?"
    return # end of the game
    
label lbl_1:
    "Label 1"
    "... ..."
    "?"
    jump inv_loop

label lbl_2:
    "Label 2"
    "... ... ..."
    "?"
    jump inv_loop

User avatar
Turtle Joshua
Newbie
Posts: 7
Joined: Thu Jun 21, 2018 12:12 pm
Contact:

Re: Label and Screen problem

#5 Post by Turtle Joshua »

Yes, that's it ! I've made something like that with the code you suggested :

Code: Select all

# Images
image black = "black.png"
image void = "inventory_bg.png"

# --------------------------------------------------------

screen inv_btn():
    textbutton "Inventory" action [Hide("inv_btn"), Show("inventory_screen"), Call("inv_loop")] xalign .95 yalign .05: # hide the button so player can't click it while in inventory
        idle_background Frame("button glossy idle", 99, 99)
        hover_background Frame("button glossy hover", 99, 99)
        
screen inventory_screen():
    imagemap:
        ground"inventory_idle.png"
        hover "inventory_hover.png"
        
        hotspot (113,25,228,136) action Jump("lbl_1")
        hotspot (355,25,470,136) clicked Jump ("lbl_2")
        textbutton "Return" action [Show("inv_btn"), Hide("inventory_screen"),Jump("rtrn_lbl")] xalign .95 yalign .05:# show inv_btn on return from inventory
            idle_background Frame("button glossy idle", 99, 99)
            hover_background Frame("button glossy hover", 99, 99)


label inv_loop: #place to return from different labels
    $ ui.interact() #do nothing just waits
    jump inv_loop
    
label rtrn_lbl: # return from inventory
    return
            
            
label start:
    show black
    "..."
    show screen inv_btn # button to show inventory screen
    "Line 1: Hello ?"
    "Line 2: How are you ?"
    "Line 3: Who are you ?"
    "Line 4 : Huh, well..."
    "Line 5 : It's near finished !"
    "... ?"
    return # end of the game
    
label lbl_1:
    hide screen inventory_screen
    scene void with dissolve
    "Label 1"
    "... ..."
    "?"
    hide void with dissolve
    show screen inventory_screen
    jump inv_loop
My (I hope) last question is now :
When I come back to the main label (label start), the background (here : "black") does not show. Do you know why ?

(Again, I am sorry to bother you with this)

edit : Maybe I need to show the background again at the end of label lbl_1 ?

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

Re: Label and Screen problem

#6 Post by Alex »

Try

Code: Select all

label start:
    scene black
(not show)

User avatar
Turtle Joshua
Newbie
Posts: 7
Joined: Thu Jun 21, 2018 12:12 pm
Contact:

Re: Label and Screen problem

#7 Post by Turtle Joshua »

I've just tried but it doesn't work for some reasons °^°

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

Re: Label and Screen problem

#8 Post by Alex »

Well, another thing

Code: Select all

label lbl_1:
    hide screen inventory_screen
    scene void with dissolve
    "Label 1"
    "... ..."
    "?"
    hide void with dissolve
here try to change

Code: Select all

scene void with dissolve
to

Code: Select all

show void with dissolve
to not replace background image with 'void'.

User avatar
Turtle Joshua
Newbie
Posts: 7
Joined: Thu Jun 21, 2018 12:12 pm
Contact:

Re: Label and Screen problem

#9 Post by Turtle Joshua »

Wow, thanks Alex, it works now !

_____________________________________
Attachments
inventory2.txt
Download it if you need it ! (it's an edit of the first one)
(1.32 KiB) Downloaded 16 times

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Ocelot