A Few Questions - 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.
Message
Author
Hollow Gourd
Regular
Posts: 79
Joined: Wed Dec 01, 2010 11:25 pm
Projects: Gatemaster!
Contact:

A Few Questions - SOLVED!!

#1 Post by Hollow Gourd »

I've been messing around with it for I don't even want to think about how long, so I figured it couldn't hurt to ask...^^;

1. How do I get rid of the box indicated by the arrow in the attached example? Solved!
2. Is it possible to have a sound effect play when the start button is clicked? And, is there any way to delay the game's start until the sound finishes playing? Solved!
3. When I add an 'Exit' button, it has the same effect as the start button, even though I specified its functionality. What could be the possible reasons for this? (Code below.) No longer necessary!
4. How do I center the text inside the name box? Solved!
5. How do I make a BMFont the default font? I couldn't quite figure it out through the documentation. Discovered an alternative!
6. Is it possible to delay the text box's appearance at the beginning of the game? What I'm trying to do is have just the background show, followed by a sound effect after a few seconds, and then for the window to show. Solved!
7. How would I go about lengthening the time it takes for the game to fade in? To be more specific, rather than just clicking the start button and the game immediately fading in, could I possibly have the screen remain black for a few seconds, and the slowly fade in? Solved!

Code: Select all

has vbox

        $ ui.vbox(xpos=-300, ypos=60)
        $ ui.imagebutton("startb1.png", "startb2.png", clicked=ui.returns("start"))
        $ ui.close()
        $ ui.vbox(xpos=-100, ypos=60)
        $ ui.imagebutton("exitb1.png", "exitb2.png", clicked=ui.returns("quit"))
        $ ui.close()
Attachments
HELP!.png
Last edited by Hollow Gourd on Sun Jul 17, 2011 4:47 pm, edited 5 times in total.

Hollow Gourd
Regular
Posts: 79
Joined: Wed Dec 01, 2010 11:25 pm
Projects: Gatemaster!
Contact:

Re: A Few Questions

#2 Post by Hollow Gourd »

This project is actually part of an English assignment, and I really need it to be presentable by tomorrow evening. Any help would be very much appreciated...x.x;

Lotus
Veteran
Posts: 298
Joined: Thu Jan 06, 2011 9:28 am
Projects: Unnamed Slenderman VN, Secret 10560
Location: USA
Contact:

Re: A Few Questions

#3 Post by Lotus »

For #1, can we see the rest of your code for the main menu? I think it may be a frame or something.

#4, I'm assuming you mean where the speaker's name is in a box by itself. Find this code in your options.rpy

Code: Select all

    ## This is the minimum height of the window, including the margins
    ## and padding
And then customize the say_who window there. (You don't ~technically~ need to put it in that particular location I think, but I put it there for organization's sake, since we're customizing a window.)

Here are some ways you can customize the say_who window.

Code: Select all

##You'll need to edit these codes to get it to look right for your game
##I doubt my measurements will work for you ^^;

    style.window.yminimum = 125
    style.window.ymaximum = 150
    style.say_who_window.xminimum = 120
    style.say_who_window.yminimum = 5
    style.say_who_window.yminimum = 10
    style.say_who_window.yminimum = 10

##These are what you are looking for specifically, but I thought I'd include the others above in case you need them
##I just put 5 so there'd be a number, you'll have to fiddle to get it to look right.

    style.say_who_window.left_padding = 5
    style.say_who_window.right_padding = 5
    style.say_who_window.top_padding = 5
    style.say_who_window.bottom_padding = 5   

#6, you can hide the window with

Code: Select all

    window hide ##this code and its counterpart can take a dissolve
and then reshow the window with

Code: Select all

    window show
I have no clue about the rest of the stuff, unfortunately. Sorry!

Edit: I may have found out how to have a sound effect play when you click a button. You attach activate_sound "yoursoundfile.soundfileformat" to your main menu's start button. So for my game, this is what it would look like:

Code: Select all

screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"

    imagemap:
        ground "menuidle.png"
        hover "menuhover.png"
       
        hotspot (52,70,342,141) activate_sound "music/1 up.mp3" action Start() ## this is what you want. 
        hotspot (46,159,336,216) action ShowMenu("load")##my music file was located in a folder within the game folder, hence the "music/"
        hotspot (50,245,343,302) action ShowMenu("preferences")
        hotspot (130,334,265,389) action Help()
        hotspot (130,422,265,480) action Quit()
        
init -2 python:

    # Make all the main menu buttons be the same size.
    style.mm_button.size_group = "mm"

Hollow Gourd
Regular
Posts: 79
Joined: Wed Dec 01, 2010 11:25 pm
Projects: Gatemaster!
Contact:

Re: A Few Questions

#4 Post by Hollow Gourd »

Here's the rest of the main menu code:

Code: Select all

# Main Menu 
#
# Screen that's used to display the main menu, when Ren'Py first starts
# http://www.renpy.org/doc/html/screen_special.html#main-menu

screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"

    # The main menu buttons.
    frame:
        style_group "mm"
        xalign .98
        yalign .98

        has vbox

        $ ui.vbox(xpos=-300, ypos=60)
        $ ui.imagebutton("startb1.png", "startb2.png", clicked=ui.returns("start"))
        $ ui.close()
        $ ui.vbox(xpos=-100, ypos=60)
        $ ui.imagebutton("exitb1.png", "exitb2.png", clicked=ui.returns("quit"))
        $ ui.close()
        

init -2 python:

    # Make all the main menu buttons be the same size.
    style.mm_button.size_group = "mm"
4. Yes, that worked! I could've sworn I tried something similar to that and it was doing all sorts of strange things, but apparently not...xD;

6. Unfortunately, this doesn't seem to be having any effect.

I'd actually tried the activate_sound thing myself, but it keeps giving me a syntax error. Perhaps I'm putting it in the wrong spot...? Or maybe it works different with imagebutton than imagemap?

Thanks a ton for all of your help!

Lotus
Veteran
Posts: 298
Joined: Thu Jan 06, 2011 9:28 am
Projects: Unnamed Slenderman VN, Secret 10560
Location: USA
Contact:

Re: A Few Questions

#5 Post by Lotus »

Yep, as I expected you have a frame in there. I'm not sure how you would remove it, I'll have to look up customizing the main menu again (I've never used imagebuttons before, imagemaps are easier to me).

#6 That code should work (I use it a lot). What version of Ren'py are you using?
You just put the code in the script, like

Code: Select all

label start:
    scene black with dissolve
    window hide dissolve
    centered "Secret 10560, A Ren'py Visual Novel{w=7}{nw}"
    scene white
    window show dissolve
    e "You've created a new Ren'Py game."
#2 (sound thing), can you post the code you used? I can't fix it if I don't know what you did.

Hollow Gourd
Regular
Posts: 79
Joined: Wed Dec 01, 2010 11:25 pm
Projects: Gatemaster!
Contact:

Re: A Few Questions

#6 Post by Hollow Gourd »

6. The window will dissolve in, but it won't stay hidden until the sound finishes playing, which is what I want.

Code: Select all

label start:

    stop music
    scene bg park entrance with fade
    window hide
    play music "parkbm.mp3"
    play sound "bike.mp3"
    
    window show dissolve
    j unimpressed "\"I've never seen this place so empty.\""
    "...Not that I find much time to come to the park these days."

    return 
2.

Code: Select all

has vbox

        $ ui.vbox(xpos=-300, ypos=60)
        $ ui.imagebutton("startb1.png", "startb2.png", activate_sound "startsound.wav", clicked=ui.returns("start"))
        $ ui.close()
        $ ui.vbox(xpos=-100, ypos=60)
        $ ui.imagebutton("exitb1.png", "exitb2.png", clicked=ui.returns("quit"))
        $ ui.close()

Lotus
Veteran
Posts: 298
Joined: Thu Jan 06, 2011 9:28 am
Projects: Unnamed Slenderman VN, Secret 10560
Location: USA
Contact:

Re: A Few Questions

#7 Post by Lotus »

You could pause that scene to wait until the sound effect stops? That's the only thing I can think of.

Code: Select all

label start:

    stop music
    scene bg park entrance with fade
    window hide
    $ renpy.pause(2.0)##this makes the current scene pause for 2 seconds, then continues
    play music "parkbm.mp3"
    play sound "bike.mp3"
   
    window show dissolve
    j unimpressed "\"I've never seen this place so empty.\""
    "...Not that I find much time to come to the park these days."

    return 

I believe your problem with the sound effect is that you're using an archaic form of image buttons. I don't know the new imagebutton screen language because I've never used them (I find them waaaaay more confusing than imagemaps) so I can't help with that, sorry!

Hollow Gourd
Regular
Posts: 79
Joined: Wed Dec 01, 2010 11:25 pm
Projects: Gatemaster!
Contact:

Re: A Few Questions

#8 Post by Hollow Gourd »

OH!! That worked...xD!
Thank you so much!

I'll give the imagemap thing a shot and see if that works instead.

Lotus
Veteran
Posts: 298
Joined: Thu Jan 06, 2011 9:28 am
Projects: Unnamed Slenderman VN, Secret 10560
Location: USA
Contact:

Re: A Few Questions

#9 Post by Lotus »

Woo! : D

Sorry 'bout making you do an imagemap instead, but since your project is due tomorrow and I have a feeling using imagebuttons would be a lot of hassle since it's hard to find documentation on it, it's probably for the best. That also solves your frame problem!

Hollow Gourd
Regular
Posts: 79
Joined: Wed Dec 01, 2010 11:25 pm
Projects: Gatemaster!
Contact:

Re: A Few Questions

#10 Post by Hollow Gourd »

It's giving me an expected statement error...x.x;

Code: Select all

screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"

    # The main menu buttons.
    frame:
        style_group "mm"
        xalign .98
        yalign .98


imagemap:
        ground "startb1.png"
        hover "startb2.png"
       
        hotspot (52, 70, 342, 141) activate_sound "startsound.wav" action Start()
        

init -2 python:

    # Make all the main menu buttons be the same size.
    style.mm_button.size_group = "mm"

Lotus
Veteran
Posts: 298
Joined: Thu Jan 06, 2011 9:28 am
Projects: Unnamed Slenderman VN, Secret 10560
Location: USA
Contact:

Re: A Few Questions

#11 Post by Lotus »

DERP. I made a mistake in my first revision of this post. It's because you have

Code: Select all


    # The background of the main menu.
    window:
        style "mm_root"

    # The main menu buttons.
    frame:
        style_group "mm"
        xalign .98
        yalign .98
still in your main menu code.

Here's my main menu code:

Code: Select all

screen main_menu:
    tag menu

    imagemap:
        ground 'menu.png'
        hover 'menuhover.png'
       
        hotspot (522, 251, 722, 300) action Start()
        hotspot (522, 315, 722, 363) action ShowMenu('load')
        hotspot (522, 378, 722, 426) action ShowMenu('preferences')
        hotspot (522, 443, 722, 492) action Help()
        hotspot (522, 506, 722, 554) action Quit(confirm=False)   
        

Hollow Gourd
Regular
Posts: 79
Joined: Wed Dec 01, 2010 11:25 pm
Projects: Gatemaster!
Contact:

Re: A Few Questions

#12 Post by Hollow Gourd »

There we go...^^
It was actually my mistake, though. I think I had something indented incorrectly.

Which number corresponds to what? I'm having a hard time getting it positioned, since I can't tell where the box is.
Last edited by Hollow Gourd on Sun Jul 17, 2011 4:06 pm, edited 2 times in total.

Lotus
Veteran
Posts: 298
Joined: Thu Jan 06, 2011 9:28 am
Projects: Unnamed Slenderman VN, Secret 10560
Location: USA
Contact:

Re: A Few Questions

#13 Post by Lotus »

Aleema has a Menu Customization tut that explains that, http://lemmasoft.renai.us/forums/viewto ... f=8&t=9812 . Scroll down to "Finding your coordinates".

(In other words, I don't remember off the top of my head : D )

Hollow Gourd
Regular
Posts: 79
Joined: Wed Dec 01, 2010 11:25 pm
Projects: Gatemaster!
Contact:

Re: A Few Questions

#14 Post by Hollow Gourd »

Eep! I forgot that thread existed.
That...sort of worked. The link is now positioned correctly, but it places a black box over the start button. I'm guessing, though, that I'm missing some bit of coding or some such, so I'll look over the thread a bit more.
Last edited by Hollow Gourd on Sun Jul 17, 2011 4:16 pm, edited 1 time in total.

Lotus
Veteran
Posts: 298
Joined: Thu Jan 06, 2011 9:28 am
Projects: Unnamed Slenderman VN, Secret 10560
Location: USA
Contact:

Re: A Few Questions

#15 Post by Lotus »

Can you post your main menu code as it is now, and your imagemap's images?

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot