[SOLVED]Possible To Directly Link To An External URL From The Player Choice Menu?

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
ChiCityFog
Newbie
Posts: 9
Joined: Fri Jul 22, 2022 7:19 pm
Completed: Andy & Rob Presents!: A Brave New World
Projects: Andy & Rob Presents!: A Halloween Special
itch: andyrobpresents
Contact:

[SOLVED]Possible To Directly Link To An External URL From The Player Choice Menu?

#1 Post by ChiCityFog »

Hey all,
Long time listener, first time caller. I'm creating a new project, and I want to create a behavior within the final player choice menu wherein every choice takes you to an external website. Here's a mockup of my thought process below:
Screenshot (243).png
Not knowing python so well (but growing in skill by the day thanks to my genetically Irish success in failing upward consistently), I initially thought it could be done with the following code:

Code: Select all

    menu:
            "{color=#FFFFFF}Test 1{/color}":
                action openurl("https://www.yahoo.com")
Easy. Clean. Ultimately Useless Garbage. It just generates errors. I looked around this forum, reddit, youtube, etc... I haven't been able to find anything specifically addressing this behavior. There's plenty of info out there about using the "a" tag in the text box. I can definitely go that route if I have to as a plan B, but it's a little clunkier and not as user intuitive as I'd like. I then thought to cram the a tag in with the choice itself, such that:

Code: Select all

    menu:
            "{a=https://renpy.org}Test 1{/a}?"
That just generates whatever the hell is happening here:
Screenshot (245).png
I've been trying to figure this out for a few weeks now but I guess it's time to admit I'm not gonna be able to get this done through good ol' fashioned force of will. Anyone know how to do this? All help is greatly appreciated.
Last edited by ChiCityFog on Tue Sep 27, 2022 10:26 am, edited 1 time in total.

enaielei
Veteran
Posts: 293
Joined: Fri Sep 17, 2021 2:09 am
Organization: enaielei
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: Possible To Directly Link To An External URL From The Player Choice Menu?

#2 Post by enaielei »

Code: Select all

action openurl("https://www.yahoo.com")
should be

Code: Select all

$ renpy.run(OpenURL("https://www.yahoo.com"))
.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2402
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Possible To Directly Link To An External URL From The Player Choice Menu?

#3 Post by Ocelot »

And to explain what you see:
In the end "Text 1" is not a choice. Choices have a colon after them and a block below them. That was not a choice, but a menu heading. By default it is displayed by say screen. You can change configuration to display it as first insensetive choice instead if you want. It is intended to be used as short description of choice you are making in this menu, something like "Where will you go?".

And your action attempt failed because it is part of Screen Language, not RenPy script. Screen language can be uses only within screens. ATL language can be used only within ATL blocks, RenPy script can be used while not within those blocks.
< < insert Rick Cook quote here > >

ChiCityFog
Newbie
Posts: 9
Joined: Fri Jul 22, 2022 7:19 pm
Completed: Andy & Rob Presents!: A Brave New World
Projects: Andy & Rob Presents!: A Halloween Special
itch: andyrobpresents
Contact:

Re: Possible To Directly Link To An External URL From The Player Choice Menu?

#4 Post by ChiCityFog »

Worked like charm, thank you so much!

Post Reply

Who is online

Users browsing this forum: Google [Bot], Yone28