[Solved] Hiding text box using a button.

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
number473
Regular
Posts: 195
Joined: Tue Dec 15, 2009 4:20 am
Projects: The Duke's Daughter
Location: Cape Town
Contact:

[Solved] Hiding text box using a button.

#1 Post by number473 »

This seemed to me something easy, but I'm having no success. What I want is an on-screen button that has the same effect as pressing 'h' or the middle mouse button has, i.e. it hides the text box. Then when the user clicks a button, reveals the same text that was previously displayed. The closest I could figure is using the Hide() function as the action of the button, but when I click to get the text box back it goes on to the next line, which is not the behavior I want. Have I missed the simple solution to this?
Last edited by number473 on Wed Jan 18, 2012 4:11 pm, edited 2 times in total.
Mental weather report: Cloudy with a possibility of brain storms.

Mild Curry
Regular
Posts: 107
Joined: Fri Jul 02, 2010 3:03 pm
Projects: That's The Way The Cookie Crumbles
Organization: TwinTurtle Games
Contact:

Re: Hiding text box using a button.

#2 Post by Mild Curry »

How are you re-showing the text box? If you're just left-clicking the mouse, then of course it's going to go to the next line of text.

You could try it this way

Put this on top of the say screen
if show_screen:

And instead of Hide() your button action would be ToggleVariable("show_screen").

number473
Regular
Posts: 195
Joined: Tue Dec 15, 2009 4:20 am
Projects: The Duke's Daughter
Location: Cape Town
Contact:

Re: Hiding text box using a button.

#3 Post by number473 »

Thank you for the suggestion. However, the button will be hidden as well with the text box. I want to avoid putting an unbidden button on the screen if possible.

I think you gave me an idea, however. I'll try adding a transparent full-screen button that shows the window :)
Will try that later.

edit: That didn't work. There was an error when trying to reshow the say screen.
You could try it this way
Put this on top of the say screen
if show_screen:
The above did work. I managed to get the desired behavior by using the key screen statement to check when the mouse button is clicked or a button pressed, so I didn't have to put an on-screen button.
Mental weather report: Cloudy with a possibility of brain storms.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: [Solved] Hiding text box using a button.

#4 Post by PyTom »

Use HideInterface() as the action.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

number473
Regular
Posts: 195
Joined: Tue Dec 15, 2009 4:20 am
Projects: The Duke's Daughter
Location: Cape Town
Contact:

Re: [Solved] Hiding text box using a button.

#5 Post by number473 »

Aha! I guessed there must be an easy way, I just couldn't find it. Thank you.
Mental weather report: Cloudy with a possibility of brain storms.

Post Reply

Who is online

Users browsing this forum: Google [Bot], henne, Majestic-12 [Bot]