Clickable hyperlink Ren'py

i11uminati Productions

Member
Game Developer
Jan 29, 2020
134
231
Believe me I tried google, the renpy manual and youtube. Everything was either a bit different than what I want (and I'm not capable enough to adjust it) or the code they show no longer works. I assume ren'py has changed over time.
 

i11uminati Productions

Member
Game Developer
Jan 29, 2020
134
231
imagebutton:
idle "bleh.png"
action OpenURL(" is hard.com")

This is what I'm working with but renpy doesn't like it.
 

i11uminati Productions

Member
Game Developer
Jan 29, 2020
134
231
I tried that too. I get an error that says parsing the script failed. And end of line expected.
The one I quoted above was code I found on this site where someone else was asking a similar question.
That error goes away if I divide it into 3 separate lines similar to what I had above but then the
action OpenURL( ) line gets a new error of "expected statement".
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,958
16,192
That error goes away if I divide it into 3 separate lines similar to what I had above but then the
action OpenURL( ) line gets a new error of "expected statement".
Let me guess, the error you get looks exactly like this :
Code:
File "game/script.rpy", line XYZ: expected statement.
    imagebutton:
               ^
So, hmm...

Ren'py is a game engine that have three different languages. The first one is the " ", that you use in init blocks, label blocks and for some inline code. The second one is the " ", that you use in image blocks and show/scene blocks. And the third one is the " ", that you use in screens blocks.


You got an error because you are using what is part of the "screen language", inside a label. You should have something like :
Code:
screen myScreen():

    imagebutton:
         idle "bleh.png"
         action OpenURL("https://coding is hard.com")
and not the :
Code:
label whatever:
    imagebutton:
         idle "bleh.png"
         action OpenURL("https://coding is hard.com")
that you wrote.

Perhaps that you should dedicate some times to the study of , to learn at least . It's just a question of few hours, but it will permit you to avoid this kind of errors.
 
  • Like
Reactions: Shadow Fiend