Pop-up menu on click [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
Exiscoming
Regular
Posts: 132
Joined: Tue Apr 29, 2014 5:37 pm
Contact:

Pop-up menu on click [Solved]

#1 Post by Exiscoming »

I'm hoping to make a inventory where you can click an item and a small menu pops up. Wondering if it's possible to do something like this in Ren'py:

Image

I'm pretty sure it is possible, but I have no idea what to look for on the wiki / google. I know nothing about Python, so I'm kinda hoping that it can be done within just normal ren'py. Any tips or tutorials would be much appreciated!
Last edited by Exiscoming on Sat Nov 21, 2015 2:08 pm, edited 1 time in total.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Pop-up menu on click

#2 Post by xela »

Exiscoming wrote:Any tips
Tip: Use Screen Language. You can condition anchor of a frame in simple menu screen based on the screen corner mouse is in (Like in Windows OS when you call similar menus). I use something similar in my game to a good degree of success, my implementation just got more python in it...

Code: Select all

screen simple_menu():
    modal True
    default x = renpy.get_mouse_pos()[0]
    default y = renpy.get_mouse_pos()[1]
    
    frame:
        pos (x + 10, y + 20)
        has vbox
        textbutton "Button 1":
            action Hide("simple_menu")
        textbutton "Button 2":
            action Hide("simple_menu")
        textbutton "Button 3":
            action Hide("simple_menu")
            
screen items():
    vbox:
        align (0.5, 0.5)
        for i in range(10):
            textbutton "Item":
                action Show("simple_menu")
            
label start:
    call screen items
Like what we're doing? Support us at:
Image

Exiscoming
Regular
Posts: 132
Joined: Tue Apr 29, 2014 5:37 pm
Contact:

Re: Pop-up menu on click

#3 Post by Exiscoming »

Hey man, this is great! Thanks! One question.

frame:
pos (x + 10, y + 20)
has vbox
textbutton "Inspect":
clicked Hide("simple_menu") and Jump("one")


When I do this, it jumps to label one, but doesn't hide the "simple_menu". Is there a way I can both hide the simple menu and jump to label one?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Pop-up menu on click

#4 Post by xela »

Code: Select all

textbutton "Inspect":
    action Hide("simple_menu"), Jump("one")
should both hide and jump.
Like what we're doing? Support us at:
Image

Exiscoming
Regular
Posts: 132
Joined: Tue Apr 29, 2014 5:37 pm
Contact:

Re: Pop-up menu on click

#5 Post by Exiscoming »

Oh damn, a comma? All right, thanks a ton man. You've been a great help.

Post Reply

Who is online

Users browsing this forum: No registered users