Ren'Py Conditional Hyperlinks

Ying Ko

Member
Jun 16, 2018
419
766
How would you turn hyperlinks off/on based on a single variable? All I could find was an example .
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,964
16,210
How would you turn hyperlinks off/on based on a single variable? All I could find was an example .
Hmm, I haven't tested it, but it really looks like the cookbook code should still works without problem.

But why exactly do you want to do that ?
Hyperlinks are just exceptionally used in games. At most there's one at start, and/or at the end of the update, to tell players where they can support the dev. It's really not an annoyance and it's easy to not click on them.
 
  • Like
Reactions: Ying Ko

Ying Ko

Member
Jun 16, 2018
419
766
My A.I.F. shows a nvl/history type screen throughout and I wanted to imbed hyperlinks in the text, if a menu is shown from a label and a player clicks an {a=call:label} hyperlink it will skip the menu, auto selecting the first choice.

Hmm, I haven't tested it, but it really looks like the cookbook code should still works without problem.

But why exactly do you want to do that ?
Hyperlinks are just exceptionally used in games. At most there's one at start, and/or at the end of the update, to tell players where they can support the dev. It's really not an annoyance and it's easy to not click on them.
Edit. The cookbook code works just as you thought it would, just not in the way I would have liked.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,964
16,210
My A.I.F. shows a nvl/history type screen throughout and I wanted to imbed hyperlinks in the text, if a menu is shown from a label and a player clicks an {a=call:label} hyperlink it will skip the menu, auto selecting the first choice.
And you don't expect players to not clicks on something they don't want to click onto ?

Anyway, it will not works as you expect it. What you want to use is {a=jump:label}, because you don't intent to come back there.
 
  • Like
Reactions: Ying Ko

Ying Ko

Member
Jun 16, 2018
419
766
And you don't expect players to not clicks on something they don't want to click onto ?

Anyway, it will not works as you expect it. What you want to use is {a=jump:label}, because you don't intent to come back there.
The cookbook code works just as you thought it would, just not in the way I would have liked. Calling the label was correct in the context of my game.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,964
16,210
The cookbook code works just as you thought it would, just not in the way I would have liked.
I guess that it's because you loose the style. So, this would probably satisfy you more:
Python:
init python:
    def call_handlerEx(value):
        if persistent.hyperlinks_on:
            renpy.call(value)

    config.hyperlink_handlers = call_handlerEx
It prevent the link to have an action when clicked, unless persistent.hyperlinks_on is set at True. Everything else, therefore mostly the style, is kept as it.
 
  • Like
Reactions: Ying Ko