Click Sound for CtC

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
GlitchyReal
Newbie
Posts: 17
Joined: Mon Apr 09, 2018 12:28 am
IRC Nick: GlitchyReal
Deviantart: GlitchyReal
Contact:

Click Sound for CtC

#1 Post by GlitchyReal » Wed Aug 11, 2021 3:03 am

Image

I got a system for CtC with a little icon to appear (the yellow triangle), but I can't for the life of me figure out how to get a sound effect to play when the player clicks.

Code: Select all

define jL = Character("Jui", window_style="leftwindow", callback=midvoice, color="#7187D1", ctc="ctc", ctc_pause="ctc", ctc_position="fixed")

image ctc:
    "gui/button/ctc.png"
    yalign 0.9 xalign 0.5
    linear 0.75 alpha 1.0
    linear 0.75 alpha 0.0
    repeat
I'm just not sure how to crack ctc open. Is it a built-in function of Ren'Py? Must be or else I couldn't call it since I haven't defined it. I'm just not sure what arguments it accepts or in what way or where.

Bonus points:
Using {w=.05} in dialogue allows the text to hold for a second, as it should, but the current CtC setup makes the icon appear during the wait, disappear when text resumes, and reappear when the text ends finally. I want it to only appear at the end of ALL the dialogue, not just while the cps is running.

BONUS Bonus points:
I'd like this to be a button that can animate. I know how to do the animations just fine, it's buttons I don't understand, particularly how to associate them with a character definition so it appears per character (needs to be like there are two dialogue boxes, one on each side). Even if this is a design people won't generally like, I wanna know how to do it and see how it feels.

In summary:
Need a button that has to be clicked to continue, doesn't disappear on wait {w=0.5}, and-- most importantly-- makes a *click!* noise when progressing text.
I'm a writer first, artist second, and a programmer... somewhere else. (I'm learning!)

Check out my work here!
http://www.DeviantArt.com/GlitchyReal

Support my work here!
http://www.Patreon.com/GlitchyReal

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1882
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Click Sound for CtC

#2 Post by Ocelot » Wed Aug 11, 2021 4:39 am

1) Use character callbacks for that: https://www.renpy.org/doc/html/character_callbacks.html
You will need to listen for "end" event.

2) ctc_pause defines indicator to use for {w} tags. If you don't need it, remove it.

3) Not quite sure what do you want. Do you want to remove all default ways to advance dialogue and make it so only buttons can be used?
< < insert Rick Cook quote here > >

User avatar
GlitchyReal
Newbie
Posts: 17
Joined: Mon Apr 09, 2018 12:28 am
IRC Nick: GlitchyReal
Deviantart: GlitchyReal
Contact:

Re: Click Sound for CtC

#3 Post by GlitchyReal » Thu Aug 12, 2021 2:49 am

Ocelot wrote:
Wed Aug 11, 2021 4:39 am
1) Use character callbacks for that: https://www.renpy.org/doc/html/character_callbacks.html
You will need to listen for "end" event.

2) ctc_pause defines indicator to use for {w} tags. If you don't need it, remove it.

3) Not quite sure what do you want. Do you want to remove all default ways to advance dialogue and make it so only buttons can be used?


1) Aaaaah, THAT'S what I've been looking for. "Callbacks". I knew the concept, but the actual term (and therefore my ability to Google it) kept slipping from memory.
I'll play around with these to see if I get what I'm looking for.

2) That's what I get for blindly copying someone else's code that was for solving a different problem :P Thank you.

3) Yeah, I want to make buttons the only way to advance text.
Not sure it'll feel good, but I want to try it out and expand my programming ability at the very least.
Currently, the ctc I'm calling in the character definition refers to an 'image' block (please forgive me if I'm using the wrong terminology). I *think* I want a 'button', not an 'image'. But if they can work functionally the same, it makes no difference. I want an exclusive button that must be clicked to advance text, however that looks in the code.
I'm a writer first, artist second, and a programmer... somewhere else. (I'm learning!)

Check out my work here!
http://www.DeviantArt.com/GlitchyReal

Support my work here!
http://www.Patreon.com/GlitchyReal

Post Reply

Who is online

Users browsing this forum: No registered users