[SOLVED] How to have two styles for input?

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
M0ti
Regular
Posts: 66
Joined: Mon Aug 15, 2011 1:06 pm
Contact:

[SOLVED] How to have two styles for input?

#1 Post by M0ti » Thu Mar 12, 2015 5:02 am

Hi, in my VN I want to use input two times, but because it's in different situations I want them to look differently. I have learned how to customize input_window but I don't know how to make second style and how to change between them in game.
I have tried something like this:

Code: Select all

init -1 python:
    if inp == 1:
        style.input_window.background =("input.png")
        style.input_window.yminimum = 79
        style.input_window.xminimum = 300
        style.input_window.left_padding = 10
        style.input_window.top_padding = 20
        etc.
    elif inp == 2:
        style.input_window.background =("hacking.png")
        style.input_window.yminimum = 40
        style.input_window.xminimum = 500
        etc.

label start:
    $ inp = 1
    $ hack = ""
    $ heslo = ""

    ...
    $ heslo = renpy.input (" ",length = 10) or ("nic")
    
    ...

    $ inp = 2
    $ hack = renpy.input (" ",length = 10) or ("nic")

    ...

But ren'py is not satisfied with it :D
It tells me that ... name 'inp' is not defined.
Last edited by M0ti on Fri Mar 13, 2015 5:10 am, edited 1 time in total.

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

Re: How to have two styles for input?

#2 Post by philat » Thu Mar 12, 2015 2:11 pm

You haven't defined inp before checking if it's 1 or 2. But anyway, renpy doesn't allow for changing styles with a variable like that mid-game.

You can use style preferences instead, although it's a bit more of a hassle. http://www.renpy.org/doc/html/style.htm ... references

User avatar
M0ti
Regular
Posts: 66
Joined: Mon Aug 15, 2011 1:06 pm
Contact:

Re: How to have two styles for input?

#3 Post by M0ti » Fri Mar 13, 2015 5:10 am

Thank you! I have learned from this more than I thought I would. :)

User avatar
xavimat
Eileen-Class Veteran
Posts: 1458
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: [SOLVED] How to have two styles for input?

#4 Post by xavimat » Sat Mar 14, 2015 7:29 am

Two possible solutions, working with the screens (not tested, only some thoughts):

1. Create a new screen "input2", using more or less the same elements from "input" screen, with the desired styles/format, and call that using:

Code: Select all

call screen input2
answer = _return
2. Edit the original input screen, using "if inp ==1" for a style and "else" for the other.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: No registered users