Help with the typewriter effect and noise?

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
Allu
Newbie
Posts: 4
Joined: Sat Aug 23, 2014 11:56 pm
Contact:

Help with the typewriter effect and noise?

#1 Post by Allu »

Okay, so I have taken a beep from what the Harvest Moon games use as text appears and saved it as a .wav file. It is just one beep, because I assume it will be continuously played as the text appears?

Here is the script I'm using, it's a slightly modified version of the one Ren'Py offers here: http://www.renpy.org/wiki/renpy/doc/FAQ ... _Wright.3F
init python:
def callback(event, **kwargs):
if event == "show":
renpy.music.play("C:/my user/my name/Desktop/the folder it's in/Sounds/beep.wav", channel="sound")
elif event == "slow_done" or event == "end"
renpy.music.stop(channel="sound")

init:
$ k = Character("Kitsu", callback=callback)


label start:

k "Why do people always wind up dead in these games?"
k "Maybe it's because these beeps are driving people insane!"
The sound will not play. That being said, is it because the text doesn't type itself out, but instead appears all at once? How do I go about making the text have the typewriter effect as well?

Any help is appreciated, thanks!

(On a side note, is it possible for you to make the game display it's script while running? I would love to know how to have the player be able to enter text, but the tutorial just mentions that I can do it, and doesn't tell me how.)

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

Re: Help with the typewriter effect and noise?

#2 Post by Alex »

To set text speed you need to go to preferences menu while playing the game and adjust text speed slider. You can set the default text speed - http://www.renpy.org/wiki/renpy/doc/coo ... ed_Setting

Code: Select all

renpy.music.play("C:/my user/my name/Desktop/the folder it's in/Sounds/beep.wav", channel="sound")
Note, that you should place all the game resources (like sounds) inside the game folder of your project and write the path to it from the game folder (it is possible to make individual subfolders for sfx, images etc.)
Like

Code: Select all

renpy.music.play("beep.wav", channel="sound")    # will use file from the "game' folder
renpy.music.play("sounds/beep.wav", channel="sound") will use file from the "game/sounds" folder
Also, this might be interesting for you - http://www.renpy.org/wiki/renpy/doc/coo ... ext_Bleeps

Allu
Newbie
Posts: 4
Joined: Sat Aug 23, 2014 11:56 pm
Contact:

Re: Help with the typewriter effect and noise?

#3 Post by Allu »

I have the file in the folder now. Also, I used the scripts everything provided, and the text speed link you sent, and now I am getting errors.

Here is my script:
config.default_text_cps = 20
init python:
def callback(event, **kwargs):
if event == "show":
renpy.music.play("beep.wav", channel="sound")
elif event == "slow_done" or event == "end"
renpy.music.stop(channel="sound")

init:
$ k = Character("Kitsu", callback=callback)


label start:

k "Why do people always wind up dead in these games?"
k "Maybe it's because these beeps are driving people insane!"
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 1: expected statement.
config.default_text_cps = 20
^

File "game/script.rpy", line 2: python block expects a non-empty block.
init python:
^

File "game/script.rpy", line 3: expected statement.
def callback(event, **kwargs):
^

File "game/script.rpy", line 4: if statement expects a non-empty block.
if event == "show":
^

File "game/script.rpy", line 5: expected statement.
renpy.music.play("beep.wav", channel="sound")
^

File "game/script.rpy", line 6: expected statement.
elif event == "slow_done" or event == "end"
^

File "game/script.rpy", line 7: expected statement.
renpy.music.stop(channel="sound")
^

File "game/script.rpy", line 9: init statement expects a non-empty block.
init:
^

Ren'Py Version: Ren'Py 6.17.7.521

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Help with the typewriter effect and noise?

#4 Post by SundownKid »

You sure it's indented correctly? Make sure the indents are correct for each line.

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

Re: Help with the typewriter effect and noise?

#5 Post by Alex »

As SundownKid said - check the indentation. Should look like

Code: Select all

init python:
    config.default_text_cps = 20   # no $-sign if this line inside an init python block

    def callback(event, **kwargs):
        if event == "show":
            renpy.music.play("beep.wav", channel="sound")
        elif event == "slow_done" or event == "end"
            renpy.music.stop(channel="sound")

init:
    $ k = Character("Kitsu", callback=callback)
    $ config.default_text_cps = 20    # required $-sign if this line inside an init block


label start:

    k "Why do people always wind up dead in these games?"
    k "Maybe it's because these beeps are driving people insane!"
http://www.renpy.org/doc/html/quickstar ... statements
http://www.renpy.org/wiki/renpy/FAQ#How ... _blocks.3F
http://www.renpy.org/doc/html/language_ ... and-blocks

Allu
Newbie
Posts: 4
Joined: Sat Aug 23, 2014 11:56 pm
Contact:

Re: Help with the typewriter effect and noise?

#6 Post by Allu »

Alex wrote:As SundownKid said - check the indentation. Should look like

Code: Select all

init python:
    config.default_text_cps = 20   # no $-sign if this line inside an init python block

    def callback(event, **kwargs):
        if event == "show":
            renpy.music.play("beep.wav", channel="sound")
        elif event == "slow_done" or event == "end"
            renpy.music.stop(channel="sound")

init:
    $ k = Character("Kitsu", callback=callback)
    $ config.default_text_cps = 20    # required $-sign if this line inside an init block


label start:

    k "Why do people always wind up dead in these games?"
    k "Maybe it's because these beeps are driving people insane!"
http://www.renpy.org/doc/html/quickstar ... statements
http://www.renpy.org/wiki/renpy/FAQ#How ... _blocks.3F
http://www.renpy.org/doc/html/language_ ... and-blocks
I used that and now the only error I'm getting is:
File "game/script.rpy", line 7: invalid syntax
elif event == "slow_done" or event == "end"
Perhaps I am just bad at this...

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

Re: Help with the typewriter effect and noise?

#7 Post by Alex »

Mmmm... the colon at the end of line...

Code: Select all

elif event == "slow_done" or event == "end":

Allu
Newbie
Posts: 4
Joined: Sat Aug 23, 2014 11:56 pm
Contact:

Re: Help with the typewriter effect and noise?

#8 Post by Allu »

It worked! Thanks!

Now, uh, can somebody tell me how to allow the player to enter a name?

I have too many questions, I'm sorry.

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

Re: Help with the typewriter effect and noise?

#9 Post by Alex »


Post Reply

Who is online

Users browsing this forum: decocloud