Two text boxes

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
Mad82
Newbie
Posts: 3
Joined: Sat Oct 20, 2012 8:03 am
Projects: Detective novel
Location: London
Contact:

Two text boxes

#1 Post by Mad82 » Sat Oct 20, 2012 8:29 am

Hello everybody,

Im trying to use two text boxes for my game (one for the normal text of the characters and another for the narration)

For the first one im using a pre-fitted image ( style.window.background = "textbox1.png") and im not having any problem with this. My problem is when im trying to put the second one (i want to use a frame btw) i dont know where i should write the code, in the options script? And most important what code should i write.

I hope you understand my question, and sorry english is not my first lenguage :)

Xoxoxo

User avatar
Ayutac
Regular
Posts: 150
Joined: Thu Oct 18, 2012 2:23 pm
Projects: Pokémon Dating Sim
Organization: A Breeze Of Science
Deviantart: Ubro
Location: Mayence, Germany
Contact:

Re: Two text boxes

#2 Post by Ayutac » Sat Oct 20, 2012 8:46 am

I would suggest to change the say-screen by making a condition if any character or the narrator is speaking. If I'm not wrong, it should work like that:

Code: Select all

screen say:
    if who: ## if person
        window:
            [...]
    else: ## if narrator
        window:
            [...]
Up next: An original, open source, text-based Dating Sim. Stay tuned ;)

User avatar
Mad82
Newbie
Posts: 3
Joined: Sat Oct 20, 2012 8:03 am
Projects: Detective novel
Location: London
Contact:

Re: Two text boxes

#3 Post by Mad82 » Sat Oct 20, 2012 9:27 am

Thanks! I will try it! If i undrestand exactly what do you mean , im very newbie here. Should i define the narrator in some way?

Thanks again!!

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: Two text boxes

#4 Post by OokamiKasumi » Mon Oct 22, 2012 12:28 am

This is coding shorthand.
-- It's used when the person trying to help us assumes that we have the same (high) level of coding experience that they do.

Code: Select all

screen say:
    if who: ## if person
        window:
            [...]
    else: ## if narrator
        window:
            [...]
There's a MUCH easier way to do this.

When you declare your characters on the first page of your script, you can also declare what textboxes you want to use for them too:

Code: Select all

# Declare characters used by this game.

define e = Character('Eileen', color="#c8ffc8")

# The game starts here.
label start:

    e "You've created a new Ren'Py game."

    e "Once you add a story, pictures, and music, you can release it to the world!"

    return
THIS is what you're going to play with.

Code: Select all

define e = Character('Eileen', color="#c8ffc8")
To declare an unnamed narrator box with a specific .png, add this:

Code: Select all

define narrator = Character(None, 
    window_background=Frame("textbox.png", 0, 0))
Just change textbox.png to the .png of your choice -- and don't forget to Leave In the indentation; the empty spaces.

You can do the same thing with individual characters too.

Code: Select all

define e = Character('Eileen',
    color="#c8ffc8", 
    show_two_window = True,
    window_background=Frame("textbox2.png", 0, 0))
NEVER forget to put a comma behind everything you add.

If you only want a different box for your narrator, and plan to use the same box for all your other characters, instead of changing all your character definitions, you can simply add this to your options.rpy page:

Code: Select all

    ## Frame ------------------------
    style.window.background = Frame("textbox.png", 0, 0)
    
    ## No Frame --------------------
    # style.window.background = "textbox.png"
For far more fun with Textboxes, read This Tutorial located in the Cookbook section of this forum.
Last edited by OokamiKasumi on Thu Oct 25, 2012 7:10 am, edited 1 time in total.
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

User avatar
Mad82
Newbie
Posts: 3
Joined: Sat Oct 20, 2012 8:03 am
Projects: Detective novel
Location: London
Contact:

Re: Two text boxes

#5 Post by Mad82 » Mon Oct 22, 2012 5:57 am

Omg! It works! Thank you so much, OokamiKasumi! Now i can move my game forward! Thank you both for helping me !

Xxxx

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: Two text boxes

#6 Post by OokamiKasumi » Thu Oct 25, 2012 7:13 am

Mad82 wrote:Omg! It works! Thank you so much, OokamiKasumi! Now i can move my game forward! Thank you both for helping me !

Xxxx
Glad I could help. :)
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

Post Reply

Who is online

Users browsing this forum: Google [Bot], _ticlock_