Interact, hyperlinks and screen language [solved I think]

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
User avatar
korova
Veteran
Posts: 217
Joined: Sat Jun 27, 2009 5:15 pm
Completed: Ivy, Chocolate, Time, Clair Obscur
Projects: Writing exercises, The House [Nano18]
Tumblr: korova08
itch: korova
Location: Normandie, France
Contact:

Interact, hyperlinks and screen language [solved I think]

#1 Post by korova » Sat Apr 05, 2014 6:34 am

Hello !

I use a lot of creative commons material in my games, and i want to credit authors for it.

At the moment I'm struggling with screen language to do so.
I tried to create screens to display credits to show at the end of my game, but I have trouble with interacting with them.

What I want to do :
  • when called, screen show an image + text according to arguments that are passed to the screen when calling it
  • In the text there are hyperlinks, that open in a web browser when you click on them
  • If you click anywhere else (or use space or whatever is usually used to go forward), you go the next screen

What I have done so far :

code put in screen.rpy

Code: Select all

screen credit(illu,texte):  
 
# show the image "illu" on the left of the screen            
    add illu anchor (0.5,0.5) ypos 300 xpos 300

#show text "texte" on the right of the screen
    
    vbox:
        xpos 635
        ypos 100
        xsize 330
        text texte
    
    key "dismiss" action Return(True)
"illu" is the name of an image, and "texte" is the description

In the main script I put that code

Code: Select all

label credits:
    scene fond2 with fade
  
    call screen credit("credits auteur","Histoire et textes : Korova\n\nsous licence\nCreative Commons\n{image=cc/Cc-by.png} {image=cc/Cc-sa.png}  {a=http://creativecommons.org/licenses/by-sa/2.0/fr/} CC-BY-SA{/a}")
and I call as many screens as I have people to credit

My image and text appear on the screen where I want them.
My problem is :
  • if I don't put the

    Code: Select all

     key "dismiss" action Return(True)
    in screen.rpy code, my screen get stuck forever (and i have other screens to show...)
  • if i put it,hen i try to click on the hyperlinks in my text, the game show the next screen, instead of opening the hyperlink in the webbrowser.
Can someone explain what I'm doing wrong or what I can do better ?

(Sorry if my explanations are not cristal clear, english is not my native language)
Last edited by korova on Tue Apr 08, 2014 2:41 am, edited 1 time in total.

User avatar
saguaro
Miko-Class Veteran
Posts: 560
Joined: Sun Feb 12, 2012 9:17 am
Completed: Locked-In, Sunrise, The Censor
Organization: Lucky Special Games
itch: saguarofoo
Location: USA
Contact:

Re: Interact, hyperlinks and screen language

#2 Post by saguaro » Sat Apr 05, 2014 8:20 am

If you don't mind using a textbutton, you can do something like this:

Code: Select all

screen credit(illu, texte, link):  
    default link_hover = False
 
# show the image "illu" on the left of the screen            
    add illu anchor (0.5,0.5) ypos 300 xpos 300

#show text "texte" on the right of the screen
    
    vbox:
        xpos 635
        ypos 100
        xsize 330
        textbutton texte action OpenURL(link) hovered SetScreenVariable("link_hover", True) unhovered SetScreenVariable("link_hover", False)
        
    if not link_hover:    
        key "dismiss" action Return(True)

User avatar
korova
Veteran
Posts: 217
Joined: Sat Jun 27, 2009 5:15 pm
Completed: Ivy, Chocolate, Time, Clair Obscur
Projects: Writing exercises, The House [Nano18]
Tumblr: korova08
itch: korova
Location: Normandie, France
Contact:

Re: Interact, hyperlinks and screen language

#3 Post by korova » Sat Apr 05, 2014 1:13 pm

Actually, using a textbutton came to my mind.

This is what I will try if I don't find a better solution.

Thanks for your suggestion anymay !

User avatar
korova
Veteran
Posts: 217
Joined: Sat Jun 27, 2009 5:15 pm
Completed: Ivy, Chocolate, Time, Clair Obscur
Projects: Writing exercises, The House [Nano18]
Tumblr: korova08
itch: korova
Location: Normandie, France
Contact:

Re: Interact, hyperlinks and screen language

#4 Post by korova » Mon Apr 07, 2014 4:53 pm

Tried it, does not work at my convenience.

When I click the textbuttons, I change screen, not performing the action I programmed.

Seems that I am stuck... :(

Any other suggestion ?

User avatar
korova
Veteran
Posts: 217
Joined: Sat Jun 27, 2009 5:15 pm
Completed: Ivy, Chocolate, Time, Clair Obscur
Projects: Writing exercises, The House [Nano18]
Tumblr: korova08
itch: korova
Location: Normandie, France
Contact:

Re: Interact, hyperlinks and screen language [solved I think

#5 Post by korova » Tue Apr 08, 2014 2:49 am

I finanlly found a solution, so simple I am pratically ashamed.

So I keep my code in screens.rpy untouched, except for the

Code: Select all

key "dismiss" action Return(True)
that I don't use any more.

Then in my main script, i don't "call" the screen any more but simply "show" it, and I add a "pause" statement, so that my screen stays on screen until I click (or hit space)

Code: Select all

label credits:
    scene fond2 with fade
 
    show screen credit("credits auteur","Histoire et textes : Korova\n\nsous licence\nCreative Commons\n{image=cc/Cc-by.png} {image=cc/Cc-sa.png}  {a=http://creativecommons.org/licenses/by-sa/2.0/fr/} CC-BY-SA{/a}")
    pause

    show screen credit(etc...)
hyperlinks and buttons work fine and screen wait till I click to change to the next one.

Problem solved so far !

Post Reply

Who is online

Users browsing this forum: Google [Bot]