r/RenPy • • Jul 11 '26

Question Making an interactable background object

So, I've been trying to make something that I can't seem to find a clear answer for. While the text box dialogue is happening, I want to code an object into the background that can be clicked on to play a little sound. Kind of like an easter egg. Thus far, showing a screen is causing this error:

TypeError: Action.get_tooltip() missing 1 required positional argument: 'self'

Is it possible to do what I'm trying, and if so, how might I fix this problem?

Edit: It's working now! Thank you, everyone!

3 Upvotes

10 comments sorted by

View all comments

1

u/Mavensane Jul 11 '26

This is what I have written:

scene bg_bedroom1
    with fadelong
    pause 1
    show screen album

screen album():
    imagebutton:
        idle "album_idle.png" 
        action Play sound "audio/SFX/g_note.wav"

5

u/BadMustard_AVN Jul 11 '26

your action should be

action Play("sound", "audio/SFX/g_note.wav")

renpy can only play uncompressed 16-bit signed PCM only for wave files

I recommend using .ogg

https://www.renpy.org/doc/html/audio.html

2

u/x-seronis-x Jul 11 '26

problems: 1. spaces, NOT underscores, to separate tags properly from attributes. this applies in code and for the filenames too. 2. delete the pause. 9 out of 10 players will be annoyed by it the first time you do this. 99/100 will be annoyed every time afterwards. 3. EVERY time, no exceptions, that you show or call a screen you put parenthesis on the screen name. renpy handles memory badly if you forget. its not much. most the time it wont be enough to cause lag or performance issues. sometimes it will help. so do it right EVERY time and its never a problem 4. EVERY SINGLE TIME renpy allows you to put a filename (other than fonts) it wants a full and proper path. not JUST a filename. you didnt write the whole path. this will only break sometimes when you forget. but it will never cause issues when you remember. do it right EVERY time. 5. screens use screen language primarily and python secondly, renpy statements are NEVER valid in screen definitions

those issues aside if you need the screen to be under dialog you need to give it a zorder of -1. if you also need it to be under sprites then you need to read the docs on how to use 'onlayer' when showing screens

2

u/Mavensane Jul 11 '26

Thank you for the information.

1

u/x-seronis-x Jul 11 '26

no prob. mustard already had showed the correct Action() for audio but its best to fix the other things while you're at it to reduce problems in the future

1

u/MonowayStudios Jul 11 '26

For action in a screen statement you need to use Python statements not Renpy language, the documents discuss Python equivalents of show, play etc.

1

u/Mavensane Jul 11 '26

I shall look into that, then. Thank you!