Overriding hyperlink handlers? [Solved]

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
the wiseman
Newbie
Posts: 3
Joined: Wed Jun 05, 2019 10:01 pm
Contact:

Overriding hyperlink handlers? [Solved]

#1 Post by the wiseman »

I'd like to override the jump_handler with my own function, the goal being to give mods a place to hook into my event system and thus trigger their mods to fire without modifying my core game code. I might also want to use this for some debugging purposes.

I've been testing ways to override the handler, but so far it doesn't seem to be working the way I would expect:

Code: Select all

init -1499 python hide:
    def modified_jump_handler(value):
        print(value)
        renpy.jump(value)

    config.hyperlink_handlers["jump"] = modified_jump_handler
but this doesn't seem to actually be working (although if I check config.hyperlink_handlers in the console, it does have the right handler listed for jump)

Is there a way to do what I'm attempting?
Last edited by the wiseman on Mon Jun 17, 2019 11:46 am, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Overriding hyperlink handlers?

#2 Post by philat »

What is the issue? Seems to work fine.

the wiseman
Newbie
Posts: 3
Joined: Wed Jun 05, 2019 10:01 pm
Contact:

Re: Overriding hyperlink handlers?

#3 Post by the wiseman »

It doesn't seem to be printing anything for me. I thought value might be empty so I replaced it with just a print("foo") and still get nothing in the console, though jumps are still occurring.

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Overriding hyperlink handlers?

#4 Post by philat »

Prints fine for me. In any case, if it's jumping but not printing, then it's probably a console issue, not an issue with the handler itself.

the wiseman
Newbie
Posts: 3
Joined: Wed Jun 05, 2019 10:01 pm
Contact:

Re: Overriding hyperlink handlers?

#5 Post by the wiseman »

I think I was misunderstanding what those handlers were for, config.label_callback seems to be what I want. Thanks!

Post Reply

Who is online

Users browsing this forum: Stampaw