How do I make navigation buttons for specific pages?[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
MayuZane
Newbie
Posts: 6
Joined: Fri Sep 23, 2016 9:26 pm
Tumblr: mayuzane
Location: Brunei
Contact:

How do I make navigation buttons for specific pages?[SOLVED]

#1 Post by MayuZane »

Hello, I've been working on a storybook project for iOS and Android and I've hit a snag. What I'm trying to do is to create a navigation system that would show up only in scenes related to the main story.

Here's a sample page:
https://www.dropbox.com/s/i0pxb823o1xwl ... m.png?dl=0

There's a 'replay' button, a 'main menu' button, a 'next page' and 'previous page' button. I've been trying to use imagebutton to make it work, but to no avail.

Here is the code for this particular story page in the script:

Code: Select all

label melayu1:
        
        imagemap:
            ground "nextpagebutton.png"
            hover "nextpagebutton.png"
            hotspot (1896, 1088, 200, 1300) clicked Start("melayu2")
        
        play music "azim_ablost.mp3" loop
        
        play sound "ma_page1.mp3"
        
        scene page1malay
        with dissolve
        pause 3
        
        scene page1malay2
        with dissolve
        pause
        
        label melayu2:
            
        stop sound
            
        play sound "ma_page2.mp3"
        
        scene page2malay
        with dissolve
        pause 3
        
        scene page2malay2
        with dissolve
        pause 
        
        stop sound
        stop music 
When I try to launch it, I get the error:

File game/script.rpy:, line 363 expected statement.
Imagemap->:

I have a feeling I've misunderstood how imagemaps/imagebuttons work, and if so I apologize in advance. Currently using version 6.99.11.1749
Last edited by MayuZane on Sun Sep 25, 2016 7:49 pm, edited 1 time in total.

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: How do I make navigation buttons for specific pages?

#2 Post by OokamiKasumi »

MayuZane wrote:...When I try to launch it, I get the error:

File game/script.rpy:, line 363 expected statement.
Imagemap->:
I don't know if this will help your navigation problem, but your "label melayu2:" needs to be pushed OUT 4 spaces.

Like so:

Code: Select all

        scene page1malay2
        with dissolve
        pause
        
    label melayu2:
            
        stop sound
            
        play sound "ma_page2.mp3"
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

User avatar
MayuZane
Newbie
Posts: 6
Joined: Fri Sep 23, 2016 9:26 pm
Tumblr: mayuzane
Location: Brunei
Contact:

Re: How do I make navigation buttons for specific pages?

#3 Post by MayuZane »

OokamiKasumi wrote: I don't know if this will help your navigation problem, but your "label melayu2:" needs to be pushed OUT 4 spaces.
Okey dokes, fixed that. Here's what the error message says now:

Code: Select all

File game/script.rpy:, line 363 expected statement.
hotspot (1896, 1088, 200, 1300) clicked Start->("melayu2"):
Here's what the code looks like now

Code: Select all

    label melayu1:
        
        imagemap ground "nextpagebutton.png" 
        hover "nextpagebutton.png" 
        hotspot (1896, 1088, 200, 1300) clicked Start("melayu2"):

        play music "azimabfrom_afar.mp3" loop
            
        play sound "ma_page1.mp3"
            
        scene page1malay
        with dissolve
        pause 3
            
        scene page1malay2
        with dissolve
        pause
        
    label melayu2:
        
        stop sound   
        play sound "ma_page2.mp3"
       
        scene page2malay
        with dissolve
        pause 3
       
        scene page2malay2
        with dissolve
        pause
       
        stop sound
        stop music 

User avatar
SypherZent
Veteran
Posts: 362
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Location: Puerto Rico
Contact:

Re: How do I make navigation buttons for specific pages?

#4 Post by SypherZent »

Hello,

I would recommend taking that imagemap portion and relocating it somewhere within your screens.rpy as a new screen.

Code: Select all

screen example1:
    imagemap:
        ground "nextpagebutton.png" 
        hover "nextpagebutton.png" 
        hotspot (1896, 1088, 200, 1300) action Jump("melayu2")

Inside of your script.rpy, you can call this screen like this:

Code: Select all

show screen example1
To hide the screen later, you can change show for hide:

Code: Select all

hide screen example1

However, I would highly recommend separating your background from your click buttons.
This way you have more control over what displays and when, if you can show the background separately.
Not to mention the use of transitions when changing the background.

I hope this information helps!
Creator of Multiverse Heroes & Space Hamster in Turmoil

Want me to code your game?
Check my services thread!

User avatar
MayuZane
Newbie
Posts: 6
Joined: Fri Sep 23, 2016 9:26 pm
Tumblr: mayuzane
Location: Brunei
Contact:

Re: How do I make navigation buttons for specific pages?

#5 Post by MayuZane »

SypherZent wrote:Hello,

I would recommend taking that imagemap portion and relocating it somewhere within your screens.rpy as a new screen.

Code: Select all

screen example1:
    imagemap:
        ground "nextpagebutton.png" 
        hover "nextpagebutton.png" 
        hotspot (1896, 1088, 200, 1300) action Jump("melayu2")

Inside of your script.rpy, you can call this screen like this:

Code: Select all

show screen example1
To hide the screen later, you can change show for hide:

Code: Select all

hide screen example1
However, I would highly recommend separating your background from your click buttons.
This way you have more control over what displays and when, if you can show the background separately.
Not to mention the use of transitions when changing the background.

I hope this information helps!
Changed the code, it works perfectly now! Reckon I just didn't quite understand how screen functions work. Thank you. I will mark this thread as solved.

Post Reply

Who is online

Users browsing this forum: No registered users