Page 1 of 1

Imagebutton Code Problem

Posted: Mon Aug 15, 2022 12:15 pm
by Vaponizer
Hey there

I want to make an Imagebutton but something is wrong with my code. It says "File "game/script.rpy", line 147: expected statement. (see PNG)
I also attached my script....
This is where its not working;

if scene w17:

imagebutton auto "images/mm_w171a_%s.jpg"
action jump w17a
"Jason""Eine Leiche?"
" ""Gulp"
"Jason""Ich sollte an die Tür gehen"
show w17

Im really new into coding so im trying to get every expertise or help i become. If there is something fundamentally missing pls tell me!

Re: Imagebutton Code Problem

Posted: Mon Aug 15, 2022 1:06 pm
by Alex
Vaponizer wrote: Mon Aug 15, 2022 12:15 pm Hey there

I want to make an Imagebutton but something is wrong with my code. It says "File "game/script.rpy", line 147: expected statement. (see PNG)
...
First thing is that imagebutton should be a part of the screen. Then you need to show or call this screen to let player interact with it. And 'jump' is not valid action for imagebutton - should be 'Jump".
https://www.renpy.org/doc/html/screen_actions.html#Jump

Also, 'if scene w17:' will not work, 'cause name of variable should be a single word (that must start from letter and may have letters, digits and underscores).
So, try

Code: Select all

default flag_variable = False

screen some_screen_name():
    imagebutton auto "images/mm_w171a_%s.jpg" action Jump('w17a') align(0.5, 0.5)

label w17a:
    hide screen some_screen_name
    "Secret ending."
    return

label start:
    "no button on screen"
    menu:
        "Want to see the button?"
        "Yes":
            $ flag_variable = True
        "No":
            pass
    if flag_variable:
        show screen some_screen_name
        "now you can click the button..."
        "...if you wish."
        hide screen some_screen_name
    "well..."
    "neutral ending"
    return
https://www.renpy.org/doc/html/screens.html
https://www.renpy.org/doc/html/screen_actions.html
https://www.renpy.org/doc/html/python.html
https://www.renpy.org/doc/html/language ... statements