How would i make an ok button?(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
amaturemanga
Regular
Posts: 94
Joined: Sun Mar 08, 2015 6:55 pm
Deviantart: amaturemanga
Skype: amature.manga
Contact:

How would i make an ok button?(SOLVED)

#1 Post by amaturemanga » Thu Apr 23, 2015 11:34 am

Hey everyone recently with help from leon i added character customization to my game. But i realized something i still need to make an ok button so that when its clicked my game moves on to my renpy.input window so the player can name their character but im stumped on how to do that any ideas on how i can do that? Here is my script along with livecomposite code.

script:

Code: Select all

# Declare images below this line, using the image statement.
image mainmenu = "hypnotic_student.png"
image ctc_animation = Animation("ctcarrow01.png", 0.2, "ctcarrow02.png", 0.2, xalign=0.9, yalign=0.9)
image ccbackground = "cc_background.png"


# Declare characters used by this game.
define story = Character(None, kind = nvl, ctc = None)

define player = Character("[playername]")

# The game starts here.
label splashscreen:
    scene black 
    $ renpy.pause(1)
    
    show text "The following story is a work of fiction and contain fantasy situations and does not reflect hypnosis in real life" with dissolve
    $ renpy.pause(2)
    
    hide text with dissolve
    $renpy.pause(1)
    
    $ renpy.pause(1)
    
    show text "AmatureManga Productions Presents\na story by: AmatureManga   and   Art by: SilverKazeNinja" with dissolve ## fix
    $ renpy.pause(2)
    play music "Metaphysik.mp3"
    hide text with dissolve
    $renpy.pause(2)
    return ## fix
    
label start:
    stop music
    play music "Necropolis.mp3"
    with dissolve
    scene ccbackground
    show screen character_customization_screen
    $renpy.pause()
    $ story = Character(None, ctc="ctc_animation", ctc_position="fixed", kind=nvl)
    stop music
    with dissolve
    
    window show fade
    $ playername = renpy.input("Please enter your character's name below.")
    $ playername = playername.strip()
    window hide fade  
    
window show fade 
story "I am walking down a dark corridor. It is a corridor i am very familiar with."
story "As this is a dream i have almost every night."
story "I can feel the darkness telling every fiber in my body to turn back,"
story "but i know... i know i have to press forward as i reach the familiar corner..."
nvl clear 
window hide fade

window show fade
story "I turn the corner and find myself in a familiar dark abandoned room"
nvl clear
window hide fade

 
return
    
character_script:

Code: Select all

init python:
    hair = 1
    def draw_character(st, at): # combine the dressup items into one displayable
        return LiveComposite(
            (361, 702), # image size
            (0, 0), "base.png",
            (0, 0), "hair%d.png"%hair,
            ),.1

init:
    image character = DynamicDisplayable(draw_character)

screen character_customization_screen:
    modal True
    tag menu

    frame:
        xalign .7
        yalign .5

        has vbox
        
        hbox:
            vbox:
                $ ui.text("Hair styles", size= 23,color="#496682")
                textbutton _("hairstyle1") action [ SetVariable("hair", 1)]
                textbutton _("hairstyle2") action [ SetVariable("hair", 2)]
                textbutton _("hairstyle3") action [ SetVariable( "hair", 3)]
                textbutton _("hairstyle4") action [ SetVariable( "hair", 4)]
                textbutton _("hairstyle5") action [ SetVariable( "hair", 5)]
                textbutton _("hairstyle6") action [ SetVariable( "hair", 6)]
                
    add "character":
        pos (-60,81)
  
thank you any help would really be appreciated.
Last edited by amaturemanga on Thu Apr 23, 2015 6:42 pm, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1853
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: How would i make an ok button?

#2 Post by philat » Thu Apr 23, 2015 11:40 am

Added a couple lines (with ## to explain). Haven't run it, but it should work.
amaturemanga wrote: script:

Code: Select all

    
label start:
    stop music
    play music "Necropolis.mp3"
    with dissolve
    scene ccbackground
    call screen character_customization_screen ## changed from show to call
    ## since we changed to call, don't need this pause / $renpy.pause() 
    $ story = Character(None, ctc="ctc_animation", ctc_position="fixed", kind=nvl)
    stop music
    with dissolve
    
    window show fade
    $ playername = renpy.input("Please enter your character's name below.")
    $ playername = playername.strip()
    window hide fade  
    
    
character_script:

Code: Select all

screen character_customization_screen:
    modal True
    tag menu

    frame:
        xalign .7
        yalign .5

        has vbox
        
        hbox:
            vbox:
                $ ui.text("Hair styles", size= 23,color="#496682")
                textbutton _("hairstyle1") action [ SetVariable("hair", 1)]
                textbutton _("hairstyle2") action [ SetVariable("hair", 2)]
                textbutton _("hairstyle3") action [ SetVariable( "hair", 3)]
                textbutton _("hairstyle4") action [ SetVariable( "hair", 4)]
                textbutton _("hairstyle5") action [ SetVariable( "hair", 5)]
                textbutton _("hairstyle6") action [ SetVariable( "hair", 6)]
                
    add "character":
        pos (-60,81)
    
    textbutton "OK" action Return() xpos 100 ypos 100 ## adjust numbers as needed

User avatar
amaturemanga
Regular
Posts: 94
Joined: Sun Mar 08, 2015 6:55 pm
Deviantart: amaturemanga
Skype: amature.manga
Contact:

Re: How would i make an ok button?

#3 Post by amaturemanga » Thu Apr 23, 2015 11:59 am

philat wrote:Added a couple lines (with ## to explain). Haven't run it, but it should work.
amaturemanga wrote:
character_script:

Code: Select all

screen character_customization_screen:
    modal True
    tag menu

    frame:
        xalign .7
        yalign .5

        has vbox
        
        hbox:
            vbox:
                $ ui.text("Hair styles", size= 23,color="#496682")
                textbutton _("hairstyle1") action [ SetVariable("hair", 1)]
                textbutton _("hairstyle2") action [ SetVariable("hair", 2)]
                textbutton _("hairstyle3") action [ SetVariable( "hair", 3)]
                textbutton _("hairstyle4") action [ SetVariable( "hair", 4)]
                textbutton _("hairstyle5") action [ SetVariable( "hair", 5)]
                textbutton _("hairstyle6") action [ SetVariable( "hair", 6)]
                
    add "character":
        pos (-60,81)
    
    textbutton "OK" action Return() xpos 100 ypos 100 ## adjust numbers as needed
the ok button isnt showing up

User avatar
thebackup
Veteran
Posts: 317
Joined: Fri Mar 27, 2009 7:36 pm
Completed: Final Week, CardioQuiz, Cafe Memoria, All I Want for Christmas is a Girlfriend, Dating Sim! Re:Mastered
Projects: Memoria (on hiatus), Cafe Memoria Deux
Organization: PixaelSoft
Location: Southern CA
Contact:

Re: How would i make an ok button?

#4 Post by thebackup » Thu Apr 23, 2015 12:09 pm

amaturemanga wrote:the ok button isnt showing up
Have you tried adjusting the xpos and ypos values for the OK button?

User avatar
amaturemanga
Regular
Posts: 94
Joined: Sun Mar 08, 2015 6:55 pm
Deviantart: amaturemanga
Skype: amature.manga
Contact:

Re: How would i make an ok button?

#5 Post by amaturemanga » Thu Apr 23, 2015 12:12 pm

thebackup wrote:
amaturemanga wrote:the ok button isnt showing up
Have you tried adjusting the xpos and ypos values for the OK button?
yea i tried changing it to 50, 50 and still nothing

User avatar
amaturemanga
Regular
Posts: 94
Joined: Sun Mar 08, 2015 6:55 pm
Deviantart: amaturemanga
Skype: amature.manga
Contact:

Re: How would i make an ok button?

#6 Post by amaturemanga » Thu Apr 23, 2015 2:29 pm

Never mind its working now i moved it up to where the other textbuttons are and now its working can someone close this thread.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How would i make an ok button?

#7 Post by trooper6 » Thu Apr 23, 2015 6:35 pm

amaturemanga wrote:Never mind its working now i moved it up to where the other textbuttons are and now its working can someone close this thread.
Nobody external closes threads. What happens is the person who started the thread edits their first post to include [SOLVED] in the title.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Bing [Bot]