When certain choices are viewable

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Message
Author
iAsobu
Regular
Posts: 45
Joined: Wed Apr 14, 2010 7:56 pm
Projects: [TBA]
Contact:

When certain choices are viewable

#1 Post by iAsobu »

In a menu, I would like to make it so one certain choice isn't seen/selectable until ever other choice in the menu has been selected and gone through. Like in a menu with "Option 1" and "Option 2", the player would select Option 1, then after viewing and reading everything in Option 1, the player could click Option 2, see everything that has to offer, and after selection both Option 1 and Option 2, Option 3 would be selectable. How would this be possible?

fluffycurry
Regular
Posts: 29
Joined: Sun Apr 18, 2010 9:43 am
Projects: IDOL WORLD(UI)
Location: Private Island
Contact:

Re: When certain choices are viewable

#2 Post by fluffycurry »

iAsobu wrote:In a menu, I would like to make it so one certain choice isn't seen/selectable until ever other choice in the menu has been selected and gone through. Like in a menu with "Option 1" and "Option 2", the player would select Option 1, then after viewing and reading everything in Option 1, the player could click Option 2, see everything that has to offer, and after selection both Option 1 and Option 2, Option 3 would be selectable. How would this be possible?

there are a couple of solution, it depends on where are you going to use it :>.
so uhhh.. questions :D
are you going to put it into your main menu? or just another custom menu?
do you want the game to remember that the player already activated an option?
(ex: the player already activated option 2, even if the player quits the game and returns back, the option 2 will still be activated)
I SUCKED at English you see, so please forgive me for any grammatical errors. I'm trying to improve you know
BLOG BLOG BLOG BLOG

GONE UNTIL FURTHER NOTICE

fluffycurry
Regular
Posts: 29
Joined: Sun Apr 18, 2010 9:43 am
Projects: IDOL WORLD(UI)
Location: Private Island
Contact:

Re: When certain choices are viewable

#3 Post by fluffycurry »

since I won't be active in the forums tom, here is my solution (i feel programmers there can give a much shorter solution):

The logic of the code below is that
if the player finished viewing option 1, persistent.option_finish = 2 *enabling option 2
if the player finished viewing option 2, persistent.option_finish = 3 *enabling option 3 *option 2 is still enabled

the contents of the option

Code: Select all

label option_1_contents:
    #here are the contents of option 1
    $ persistent.option_finish = 2
    return

label option_2_contents:
    #here are the contents of option 2
    $ persistent.option_finish = 3
    return

label option_3_contents:
    #here are the contents of option 3
    return
the only important part there is the change in value of the persistent.option_finish, having "persistent.varname" enables the game to remember the accomplishment of the player if he/she already unlocks an option it will remain unlock even if he/she quits.

below is the solution considering its inside the main menu and also it uses image map

(seen but not selectable)

Code: Select all

label main_menu:
    $ _game_menu_screen = None
    if not persistent.option_finish:    #since i used number not "True of False", i know that "If" gives out a numerical           
       $ persistent.option_finish = 1  #value i just forgot what it is, so i have this code just to be sure 
################################################
    if persistent.option_finish == 1:
        python:
            result = renpy.imagemap(
                "UI/main_menu_1.png",
                "UI/main_menu_2.png",
                [ (10, 24, 361, 63, "option_1"),
                #(10, 72, 361, 112, "option_2"), disables option 2
                #(10, 122, 361, 161, "option_3"), disables option 3
                (450, 551, 792, 590, "Exit")
                ], focus="imagemap")
        if result == "option_1":
            jump option_1_contents
        elif result == "back":
            $ renpy.quit()
        return
################################################        
    elif persistent.option_finish == 2 :
        python:
            result = renpy.imagemap(
                "UI/main_menu_1.png",
                "UI/main_menu_2.png",
                [ (10, 24, 361, 63, "option_1"),
                (10, 72, 361, 112, "option_2"), #option 2 is now enabled
                #(10, 122, 361, 161, "option_3"), still disable option 3
                (450, 551, 792, 590, "Exit")
                ], focus="imagemap")
        if result == "option_1":
            jump option_1_contents
        elif result == "option_2":
            jump option_2_contents
        elif result == "back":
            $ renpy.quit()
        return    
 ################################################       
    elif persistent.option_finish == 3 :
        python:
            result = renpy.imagemap(
                "UI/main_menu_1.png",
                "UI/main_menu_2.png",
                [ (10, 24, 361, 63, "option_1"),
                (10, 72, 361, 112, "option_2"), #all of the option is enabled
                (10, 122, 361, 161, "option_3"),
                (450, 551, 792, 590, "Exit")
                ], focus="imagemap")
        if result == "option_1":
            jump option_1_contents
        elif result == "option_2":
            jump option_2_contents
        elif result == "option_3":
            jump option_3_contents
        elif result == "back":
            $ renpy.quit()
        return    
Note Again: i made it persistent so that whenever it is played again by the player the options he/she already activated will be active. (prevents reactivation)

(unseen and obviously cannot be selected)

Code: Select all

label main_menu:
    $ _game_menu_screen = None
    if not persistent.option_finish:
        $ persistent.option_finish = 1
################################################
    if persistent.option_finish == 1:
        python:
            result = renpy.imagemap(
                "UI/main_menu_1.png",
                "UI/main_menu_2.png",
                [ (10, 24, 361, 63, "option_1"),
                (450, 551, 792, 590, "Exit")
                ], focus="imagemap")
        if result == "option_1":
            jump option_1_contents
        elif result == "back":
            $ renpy.quit()
        return
################################################        
    elif persistent.option_finish == 2 :
        python:
            result = renpy.imagemap(
                "UI/main_menu_1a.png",
                "UI/main_menu_2a.png",
                [ (10, 24, 361, 63, "option_1"),
                (10, 72, 361, 112, "option_2"),
                (450, 551, 792, 590, "Exit")
                ], focus="imagemap")
        if result == "option_1":
            jump option_1_contents
        elif result == "option_2":
            jump option_2_contents
        elif result == "back":
            $ renpy.quit()
        return    
 ################################################       
    elif persistent.option_finish == 3 :
        python:
            result = renpy.imagemap(
                "UI/main_menu_1b.png",
                "UI/main_menu_2b.png",
                [ (10, 24, 361, 63, "option_1"),
                (10, 72, 361, 112, "option_2"),
                (10, 122, 361, 161, "option_3"),
                (450, 551, 792, 590, "Exit")
                ], focus="imagemap")
        if result == "option_1":
            jump option_1_contents
        elif result == "option_2":
            jump option_2_contents
        elif result == "option_3":
            jump option_3_contents
        elif result == "back":
            $ renpy.quit()
        return    
It also depends on how you draw the menu itself in imagemap, notice in the second code I used different set of images, which has different look. (ex:UI/main_menu_1.png, UI/main_menu_1a.png, UI/main_menu_1b.png)

if this is not what your looking for do tell me, there is also about using ui.textbuttons *etc*. :D
Last edited by fluffycurry on Mon Apr 26, 2010 11:22 am, edited 1 time in total.
I SUCKED at English you see, so please forgive me for any grammatical errors. I'm trying to improve you know
BLOG BLOG BLOG BLOG

GONE UNTIL FURTHER NOTICE

fluffycurry
Regular
Posts: 29
Joined: Sun Apr 18, 2010 9:43 am
Projects: IDOL WORLD(UI)
Location: Private Island
Contact:

Re: When certain choices are viewable

#4 Post by fluffycurry »

sorry for triple posting (i will never do it again)

this is using ui.text buttons

UNSEEN NOT SELECTABLE

Code: Select all

label main_menu:
    scene mainmenu
    if not persistent.option_finish:          
        $ persistent.option_finish = 1

    if persistent.option_finish == 1:
       $ ui.vbox(xpos=364, ypos=215)
       $ ui.imagebutton("newgame1.png", "newgame2.png", clicked=ui.returns("start"))
       $ ui.imagebutton("loadgame1.png", "loadgame2.png", clicked=ui.returns("load"))
       $ ui.imagebutton("option1a.png", "option1b.png", clicked=ui.returns("option_1"))
       $ ui.imagebutton("pref1.png", "pref2.png", clicked=ui.returns("preference"))
       $ ui.imagebutton("exit1.png", "exit2.png", clicked=ui.returns("quit"))
       $ ui.close()
    elif persistent.option_finish == 2:
       $ ui.vbox(xpos=364, ypos=215)
       $ ui.imagebutton("newgame1.png", "newgame2.png", clicked=ui.returns("start"))
       $ ui.imagebutton("loadgame1.png", "loadgame2.png", clicked=ui.returns("load"))
       $ ui.imagebutton("option1a.png", "option1b.png", clicked=ui.returns("option_1"))
       $ ui.imagebutton("option2a.png", "option2b.png", clicked=ui.returns("option_2"))
       $ ui.imagebutton("pref1.png", "pref2.png", clicked=ui.returns("preference"))
       $ ui.imagebutton("exit1.png", "exit2.png", clicked=ui.returns("quit"))
       $ ui.close()
    elif persistent.option_finish == 3:
       $ ui.vbox(xpos=364, ypos=215)
       $ ui.imagebutton("newgame1.png", "newgame2.png", clicked=ui.returns("start"))
       $ ui.imagebutton("loadgame1.png", "loadgame2.png", clicked=ui.returns("load"))
       $ ui.imagebutton("option1a.png", "option1b.png", clicked=ui.returns("option_1"))
       $ ui.imagebutton("option2a.png", "option2b.png", clicked=ui.returns("option_2"))
       $ ui.imagebutton("option3a.png", "option3b.png", clicked=ui.returns("option_3"))
       $ ui.imagebutton("pref1.png", "pref2.png", clicked=ui.returns("preference"))
       $ ui.imagebutton("exit1.png", "exit2.png", clicked=ui.returns("quit"))
       $ ui.close()
    $ result = ui.interact()
    if result == "start":
        hide mainmenu
        $ renpy.jump_out_of_context("start")
    elif result == "load":
        jump load_screen
    elif result == "option_1":
        hide mainmenu
        $ renpy.jump_out_of_context("option_1_contents")
    elif result == "option_2":
        hide mainmenu
        $ renpy.jump_out_of_context("option_2_contents")
    elif result == "option_3":
        hide mainmenu
        $ renpy.jump_out_of_context("option_3_contents")
    elif result == "preference":
        jump preferences_screen
    elif result == "quit":
        $ renpy.quit()
same effect as the image map, but this uses small images for the buttons, still it needs the first code at the previous post to work,
I SUCKED at English you see, so please forgive me for any grammatical errors. I'm trying to improve you know
BLOG BLOG BLOG BLOG

GONE UNTIL FURTHER NOTICE

iAsobu
Regular
Posts: 45
Joined: Wed Apr 14, 2010 7:56 pm
Projects: [TBA]
Contact:

Re: When certain choices are viewable

#5 Post by iAsobu »

fluffycurry wrote:are you going to put it into your main menu? or just another custom menu?
Another custom, in-gameplay menu.

I looked at the first code you posted. Rather than what your code seems to do, I was thinking like...
OK, here's what you see in the menu at first:
"-Option 1
-Option 2"
Then after looking at both options, the menu looks like this:
"-Option 1
-Option 2
-Option 3"
So options 1 and 2 need to both be present at first-seen menu.
How would that look like?

fluffycurry
Regular
Posts: 29
Joined: Sun Apr 18, 2010 9:43 am
Projects: IDOL WORLD(UI)
Location: Private Island
Contact:

Re: When certain choices are viewable

#6 Post by fluffycurry »

iAsobu wrote:
fluffycurry wrote:are you going to put it into your main menu? or just another custom menu?
Another custom, in-gameplay menu.

I looked at the first code you posted. Rather than what your code seems to do, I was thinking like...
OK, here's what you see in the menu at first:
"-Option 1
-Option 2"
Then after looking at both options, the menu looks like this:
"-Option 1
-Option 2
-Option 3"
So options 1 and 2 need to both be present at first-seen menu.
How would that look like?

Code: Select all

label option_1_contents:
    #here are the contents of option 1
    $ persistent.option_finish = 2
    return

label option_2_contents:
    #here are the contents of option 2
    $ persistent.option_finish = 3
    return

label option_3_contents:
    #here are the contents of option 3
    return
so the logic of the code below is:
persistent.option_finish = 1 >>option 1 and option 2 are visible but option 2 can't be selected(till option 1 is viewed),
persistent.option_finish = 2 >>option 1 and option 2 are visible and option 2 can now be selected
persistent.option_finish = 3 >>option 1, option 2 and option 3 are visible and option 3 can be selected

Code: Select all

label other_menu:
    $ _game_menu_screen = None
    if not persistent.option_finish:
        $ persistent.option_finish = 1
################################################
    if persistent.option_finish == 1 or persistent.option_finish == 2:
        python:
            result = renpy.imagemap(
                "main_menu_1a.png",
                "main_menu_1b.png",
                [ (10, 24, 361, 63, "option_1"),
                 (10, 72, 361, 112, "option_2"),
                (450, 551, 792, 590, "Exit")
                ], focus="imagemap")
        if result == "option_1":
            jump option_1_contents
        elif result == "option_2":
            if persistent.option_finish == 1:  #since persistent.option_finish = 1, still option 1 hasn't been viewed
                e "please view option 1"  
                jump other_menu
            else:
                jump option_2_contents
        elif result == "back":
            $ renpy.quit()
        return
################################################       
    elif persistent.option_finish == 3 :
        python:
            result = renpy.imagemap(
                "main_menu_2a.png",
                "main_menu_2b.png",
                [ (10, 24, 361, 63, "option_1"),
                (10, 72, 361, 112, "option_2"),
                (10, 122, 361, 161, "option_3"),
                (450, 551, 792, 590, "Exit")
                ], focus="imagemap")
        if result == "option_1":
            jump option_1_contents
        elif result == "option_2":
            jump option_2_contents
        elif result == "option_3":
            jump option_3_contents
        elif result == "back":
            $ renpy.quit()
        return
so attached is the imagemap image i used, so you can visualize how the code works
Attachments
main_menu_1a.png
main_menu_1a.png (10.19 KiB) Viewed 1421 times
hovered
hovered
option 3 is visible
option 3 is visible
hovered
hovered
I SUCKED at English you see, so please forgive me for any grammatical errors. I'm trying to improve you know
BLOG BLOG BLOG BLOG

GONE UNTIL FURTHER NOTICE

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

Re: When certain choices are viewable

#7 Post by Alex »

If you mean in-game menus, then just add the conditions you want in the line with specific choice

Code: Select all

init:
    $ opt1 = False
    $ opt2 = False

label start:

    scene black
    
    menu my_menu:
        "Option 1":
            "This is option 1"
            $ opt1 = True
            jump my_menu
        "Option 2" if opt1:
            "This is option 2"
            $ opt2 = True
            jump my_menu
        "Option 3" if opt1 and opt2:
            "This is option 3"
            jump my_menu
        "Option... just option" if opt1 and not opt2:
            "This option available if you saw option1 but not the option2"
            jump my_menu
Last edited by Alex on Wed Apr 28, 2010 10:53 am, edited 1 time in total.

iAsobu
Regular
Posts: 45
Joined: Wed Apr 14, 2010 7:56 pm
Projects: [TBA]
Contact:

Re: When certain choices are viewable

#8 Post by iAsobu »

Ah! That helps!
So I can understand it more, can you explain what purpose the $ opt2 = True serves under option 3?

fluffycurry
Regular
Posts: 29
Joined: Sun Apr 18, 2010 9:43 am
Projects: IDOL WORLD(UI)
Location: Private Island
Contact:

Re: When certain choices are viewable

#9 Post by fluffycurry »

sorry *bow* ,..i kept thinking about a menu :D ;) haha
I SUCKED at English you see, so please forgive me for any grammatical errors. I'm trying to improve you know
BLOG BLOG BLOG BLOG

GONE UNTIL FURTHER NOTICE

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

Re: When certain choices are viewable

#10 Post by Alex »

Oops, copy / paste, you know...))
*fixed*

iAsobu
Regular
Posts: 45
Joined: Wed Apr 14, 2010 7:56 pm
Projects: [TBA]
Contact:

Re: When certain choices are viewable

#11 Post by iAsobu »

So the $ [previous option] = True under the final option isn't necessary? Alright.

I belive I've figured it out. Thanks for the help, everyone.

SaMeino
Regular
Posts: 49
Joined: Tue Jan 26, 2010 9:39 pm
Location: Georgia, USA
Contact:

Re: When certain choices are viewable

#12 Post by SaMeino »

Do you guys know how to fix this?
I tried doing some of the codes you guys did but this error keeps coming

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


On line 32 of C:\Users\Alex Nguyen\Desktop\renpy-6.10.2\Goddess Selection/game/script.rpy: menu statement expects a non-empty block.
menu begin_menu:
    ^

On line 33 of C:\Users\Alex Nguyen\Desktop\renpy-6.10.2\Goddess Selection/game/script.rpy: expected statement.
"Prologue":
          ^

On line 35 of C:\Users\Alex Nguyen\Desktop\renpy-6.10.2\Goddess Selection/game/script.rpy: expected statement.
"Act 1"  if act_1:
         ^

Heres what i had to show you

Code: Select all

# The game starts here.
label start:
        menu begin_menu:
        "Prologue":
            jump Prologue_1
        "Act 1"  if act_1:
           jump Act_1:
Nya~

iAsobu
Regular
Posts: 45
Joined: Wed Apr 14, 2010 7:56 pm
Projects: [TBA]
Contact:

Re: When certain choices are viewable

#13 Post by iAsobu »

The one thing I might know how to fix in there would be...

Code: Select all

"Act 1"  if act_1:
         ^
I believe there are too many spaces here.

SaMeino
Regular
Posts: 49
Joined: Tue Jan 26, 2010 9:39 pm
Location: Georgia, USA
Contact:

Re: When certain choices are viewable

#14 Post by SaMeino »

still didnt work
Nya~

iAsobu
Regular
Posts: 45
Joined: Wed Apr 14, 2010 7:56 pm
Projects: [TBA]
Contact:

Re: When certain choices are viewable

#15 Post by iAsobu »

Well, that was just one thing. For the rest to be fixed, you'll have to wait for a proffessional to drop by and post.

Post Reply

Who is online

Users browsing this forum: No registered users