Navigating screen in screen world map. Coding advice needed,

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
Xaiyeon
Newbie
Posts: 12
Joined: Thu May 14, 2015 10:47 pm
Contact:

Navigating screen in screen world map. Coding advice needed,

#1 Post by Xaiyeon »

Hi I'm trying to make a world navigation screen, and whatnot. I need help, I can't really understand what's wrong with my code.
When I navigate back and fourth with this code, it stops working after 3 times.
Also is there a better way to implement this using variables and a condition switch? I'm not sure though. :P

Do I need to add something somewhere so I can go back to previous screens, or am I doing this the wrong way?
Please help me out ^_^;;.

My problem is that above, also my navigation stops working, but after right clicking to go back it goes back and I can navigate for 3 screens again and it does not work.

Code: Select all

label worldmaptime:
    window hide
    # MUSIC HERE SCENE
    play music "Music/3Sparkling_Ocean_by_Vandit.ogg" loop fadeout 2.0 fadein 1.0
    call screen worldmap ## calls the world map...



screen worldnav1():
# (83, 658)
    imagebutton idle "Map/mapup.png" hover "Map/mapup.png" xpos 75 ypos 500 action [Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapleft.png" hover "Map/mapleft.png" xpos 25 ypos 550 action [Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapright.png" hover "Map/mapright.png" xpos 125 ypos 550 action [Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapdown.png" hover "Map/mapdown.png" xpos 75 ypos 600 action [ShowMenu('mapc'), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff

screen worldnav2():
    imagebutton idle "Map/mapup.png" hover "Map/mapup.png" xpos 75 ypos 500 action [ShowMenu('mapn'), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff
    imagebutton idle "Map/mapleft.png" hover "Map/mapleft.png" xpos 25 ypos 550 action [Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapright.png" hover "Map/mapright.png" xpos 125 ypos 550 action [ShowMenu('mape'), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff
    imagebutton idle "Map/mapdown.png" hover "Map/mapdown.png" xpos 75 ypos 600 action [ShowMenu('maps'), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff

screen worldnav3():
    imagebutton idle "Map/mapup.png" hover "Map/mapup.png" xpos 75 ypos 500 action [ Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapleft.png" hover "Map/mapleft.png" xpos 25 ypos 550 action [ShowMenu('mapc'), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff
    imagebutton idle "Map/mapright.png" hover "Map/mapright.png" xpos 125 ypos 550 action [ Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapdown.png" hover "Map/mapdown.png" xpos 75 ypos 600 action [ Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff

screen worldnav4():
    imagebutton idle "Map/mapup.png" hover "Map/mapup.png" xpos 75 ypos 500 action [ShowMenu('mapc'), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff
    imagebutton idle "Map/mapleft.png" hover "Map/mapleft.png" xpos 25 ypos 550 action [Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapright.png" hover "Map/mapright.png" xpos 125 ypos 550 action [ Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapdown.png" hover "Map/mapdown.png" xpos 75 ypos 600 action [ Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff


# at wnav_eff
init -2:
    transform noff_eff:
        on idle:
            linear 0.2 alpha 0.5
        on hover:
            linear 0.2 alpha 0.5
    
    transform wnav_eff: #use ATL to make hovered arrow blink
        on idle:
            linear 0.2 alpha .9
        on hover:
            linear 0.2 alpha 1.5

    transform map_eff:
        on idle:
            linear 1.0 alpha 1.0
            linear 1.0 alpha 1.2
            repeat
        on hover:
            linear 0.5 alpha 1.5
            

## End of worldnav

init -2 python:
    e = 0
screen worldmap():  ## WORLD MAP

#    use worldnav
    
#    if e == 0:
#        use mapn
#        use worldnav

     use mapn

    
screen mapn():   ##(325, 221)
    add "Map/WMn.png"
    use worldnav1
    imagebutton idle "Map/house.png" hover "Map/house.png" xpos 294 ypos 168 action [Start(), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at map_eff
    
screen mapc():
    add "Map/WMc.png"
    use worldnav2
  
screen mape():
    add "Map/WMe.png"
    use worldnav3
  
screen maps():
    add "Map/WMs.png"
    use worldnav4
If people ignore others with a lack of understanding, then they are close-minded.

User avatar
orz
Regular
Posts: 126
Joined: Tue Apr 21, 2015 10:19 pm
Contact:

Re: Navigating screen in screen world map. Coding advice nee

#2 Post by orz »

Is it popping up only when you go from, for example, N to C to S back to C, or does it also happen when you try to go from N to C back to N?

At work and I don't have access to Renpy otherwise I'd run the stuff myself. :(

Xaiyeon
Newbie
Posts: 12
Joined: Thu May 14, 2015 10:47 pm
Contact:

Re: Navigating screen in screen world map. Coding advice nee

#3 Post by Xaiyeon »

Yea, when I go to N to C then S, the navigation stops working. If I go to N to C and back to N, it stops working. Basically after any three combination navigation it stops working. How would I fix it? T^T
If people ignore others with a lack of understanding, then they are close-minded.

User avatar
orz
Regular
Posts: 126
Joined: Tue Apr 21, 2015 10:19 pm
Contact:

Re: Navigating screen in screen world map. Coding advice nee

#4 Post by orz »

I'd like for you to try something for me.

Instead of doing 'action [ShowMenu('mapc') etc etc etc', I'd like for you to try doing 'action [ShowMenu('worldnav2') etc etc etc'

and put the 'add "Map/WMc.png"' line in the worldnav screens.

Like this:

Code: Select all

label worldmaptime:
    window hide
    # MUSIC HERE SCENE
    play music "Music/3Sparkling_Ocean_by_Vandit.ogg" loop fadeout 2.0 fadein 1.0
    call screen worldmap ## calls the world map...



screen worldnav1():
# (83, 658)
    add "Map/WMn.png"
    imagebutton idle "Map/mapup.png" hover "Map/mapup.png" xpos 75 ypos 500 action [Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapleft.png" hover "Map/mapleft.png" xpos 25 ypos 550 action [Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapright.png" hover "Map/mapright.png" xpos 125 ypos 550 action [Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapdown.png" hover "Map/mapdown.png" xpos 75 ypos 600 action [ShowMenu('worldnav2'), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff

screen worldnav2():
    add "Map/WMc.png"
    imagebutton idle "Map/mapup.png" hover "Map/mapup.png" xpos 75 ypos 500 action [ShowMenu('mapn'), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff
    imagebutton idle "Map/mapleft.png" hover "Map/mapleft.png" xpos 25 ypos 550 action [Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapright.png" hover "Map/mapright.png" xpos 125 ypos 550 action [ShowMenu('worldnav3'), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff
    imagebutton idle "Map/mapdown.png" hover "Map/mapdown.png" xpos 75 ypos 600 action [ShowMenu('worldnav4'), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff

screen worldnav3():
    add "Map/WMe.png"    
    imagebutton idle "Map/mapup.png" hover "Map/mapup.png" xpos 75 ypos 500 action [ Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapleft.png" hover "Map/mapleft.png" xpos 25 ypos 550 action [ShowMenu('worldnav2'), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff
    imagebutton idle "Map/mapright.png" hover "Map/mapright.png" xpos 125 ypos 550 action [ Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapdown.png" hover "Map/mapdown.png" xpos 75 ypos 600 action [ Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff

screen worldnav4():
    add "Map/WMs.png"
    imagebutton idle "Map/mapup.png" hover "Map/mapup.png" xpos 75 ypos 500 action [ShowMenu('mapc'), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff
    imagebutton idle "Map/mapleft.png" hover "Map/mapleft.png" xpos 25 ypos 550 action [Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapright.png" hover "Map/mapright.png" xpos 125 ypos 550 action [ Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff
    imagebutton idle "Map/mapdown.png" hover "Map/mapdown.png" xpos 75 ypos 600 action [ Play ("sfx2", "SFX/error.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at noff_eff


# at wnav_eff
init -2:
    transform noff_eff:
        on idle:
            linear 0.2 alpha 0.5
        on hover:
            linear 0.2 alpha 0.5
    
    transform wnav_eff: #use ATL to make hovered arrow blink
        on idle:
            linear 0.2 alpha .9
        on hover:
            linear 0.2 alpha 1.5

    transform map_eff:
        on idle:
            linear 1.0 alpha 1.0
            linear 1.0 alpha 1.2
            repeat
        on hover:
            linear 0.5 alpha 1.5
            

## End of worldnav

init -2 python:
    e = 0
screen worldmap():  ## WORLD MAP

#    use worldnav
    
#    if e == 0:
#        use mapn
#        use worldnav

    use worldnav1
    imagebutton idle "Map/house.png" hover "Map/house.png" xpos 294 ypos 168 action [Start(), Play ("sfx2", "SFX/MENU A_Select_by_Virix.ogg")] hovered [ Play ("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at map_eff
Let me know if it works or doesn't work. I have a suspicion as to what it might be.

Xaiyeon
Newbie
Posts: 12
Joined: Thu May 14, 2015 10:47 pm
Contact:

Re: Navigating screen in screen world map. Coding advice nee

#5 Post by Xaiyeon »

Ok ill try

Edit: Okay, so I tried what you suggested, but it is still the same problem as before XD... However, the code is more neat than before.
If people ignore others with a lack of understanding, then they are close-minded.

User avatar
orz
Regular
Posts: 126
Joined: Tue Apr 21, 2015 10:19 pm
Contact:

Re: Navigating screen in screen world map. Coding advice nee

#6 Post by orz »

Found it.

Short answer, make sure you're hiding your screen after you show the next one.

For example: imagebutton idle "Map/mapup.png" hover "Map/mapup.png" xpos 75 ypos 500 action [ShowMenu('mapc'), Play("sfx2", "SFX/MENU A_Select_by_Virix.ogg"), Hide('worldnav4')] hovered [Play("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff

Long answer, I'm not sure if it was simply doing nothing because technically the screen was already being shown (just buried underneath all the other screens so not visible), or if it was throwing an error that wasn't being seen, but there you go. Hmm, it might be possible to set the zorder on a screen as a way to bring it back to the front...

Xaiyeon
Newbie
Posts: 12
Joined: Thu May 14, 2015 10:47 pm
Contact:

Re: Navigating screen in screen world map. Coding advice nee

#7 Post by Xaiyeon »

orz wrote:Found it.

Short answer, make sure you're hiding your screen after you show the next one.

For example: imagebutton idle "Map/mapup.png" hover "Map/mapup.png" xpos 75 ypos 500 action [ShowMenu('mapc'), Play("sfx2", "SFX/MENU A_Select_by_Virix.ogg"), Hide('worldnav4')] hovered [Play("sfx1", "SFX/MENU_Pick_by_Virix.wav")] at wnav_eff

Long answer, I'm not sure if it was simply doing nothing because technically the screen was already being shown (just buried underneath all the other screens so not visible), or if it was throwing an error that wasn't being seen, but there you go. Hmm, it might be possible to set the zorder on a screen as a way to bring it back to the front...
Thank you very much for the help, it works wonderfully :D I'm interested in the z-order, I'll look that up.
If people ignore others with a lack of understanding, then they are close-minded.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]