Display a chat-like interface alongside dialogue? [Solved]

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.
Message
Author
User avatar
Fuu
Newbie
Posts: 18
Joined: Tue Mar 03, 2015 3:10 pm
Completed: 404 Error: Connection Not Found Demo, NAOMI, Simple Answers
Projects: 404 Error: Connection Not Found, Ashes//Dust
Organization: CODE:Phantasm, Paper Star Studios
Tumblr: Rottenadel
itch: Codephantasm
Contact:

Display a chat-like interface alongside dialogue? [Solved]

#1 Post by Fuu » Tue Jul 04, 2017 12:05 am

Is it possible to have both NVL and regular textbox (is this called ADV?) at the same time? I'm trying to replicate something like what I have drawn out below (pardon the language).

Basically I want the dialogue (left side) to run independently of the chatbox (right side). Is this possible? It doesn't necessarily have to be NVL/ADV.
Attachments
^5B11B6DD7B77BCC7B1CCBC28F9712D83409A61607286F160AB^pimgpsh_fullsize_distr.jpg
Last edited by Fuu on Tue Jul 11, 2017 11:49 am, edited 1 time in total.

User avatar
vollschauer
Veteran
Posts: 228
Joined: Sun Oct 11, 2015 9:38 am
Github: vollschauer
Contact:

Re: Displaying textbox and NVL at the same time?

#2 Post by vollschauer » Mon Jul 10, 2017 4:37 am

Short answer would be no it's not possible... you can one set one kind (NVL or ADL) to your character. But what you can do is that you stay with the default ADL and create you own screen for the chat window... or your design a new say screen with 2 different window...maybe the better choice.

User avatar
Fuu
Newbie
Posts: 18
Joined: Tue Mar 03, 2015 3:10 pm
Completed: 404 Error: Connection Not Found Demo, NAOMI, Simple Answers
Projects: 404 Error: Connection Not Found, Ashes//Dust
Organization: CODE:Phantasm, Paper Star Studios
Tumblr: Rottenadel
itch: Codephantasm
Contact:

Re: Displaying textbox and NVL at the same time?

#3 Post by Fuu » Mon Jul 10, 2017 6:55 am

Would you know of a way to do that, or could you point me to a guide? Sorry I'm having a hard time finding one on here.

User avatar
chocoberrie
Veteran
Posts: 254
Joined: Wed Jun 19, 2013 10:34 pm
Projects: Marshmallow Days
Contact:

Re: Displaying textbox and NVL at the same time?

#4 Post by chocoberrie » Mon Jul 10, 2017 7:38 am

I'm curious to see how this can work! It sounds like an interesting game mechanic. :)

Here's the documentation about the say screen: https://www.renpy.org/doc/html/screen_s ... me-screens

And here's the documentation about screen language, which includes the kinds of things that go in the say screen: https://www.renpy.org/doc/html/screens.html

I also found this thread: viewtopic.php?f=8&t=41047 that seems to ask the same question you're asking here!

User avatar
Fuu
Newbie
Posts: 18
Joined: Tue Mar 03, 2015 3:10 pm
Completed: 404 Error: Connection Not Found Demo, NAOMI, Simple Answers
Projects: 404 Error: Connection Not Found, Ashes//Dust
Organization: CODE:Phantasm, Paper Star Studios
Tumblr: Rottenadel
itch: Codephantasm
Contact:

Re: Displaying textbox and NVL at the same time?

#5 Post by Fuu » Mon Jul 10, 2017 8:50 pm

chocoberrie wrote:I'm curious to see how this can work! It sounds like an interesting game mechanic. :)

Here's the documentation about the say screen: https://www.renpy.org/doc/html/screen_s ... me-screens

And here's the documentation about screen language, which includes the kinds of things that go in the say screen: https://www.renpy.org/doc/html/screens.html

I also found this thread: viewtopic.php?f=8&t=41047 that seems to ask the same question you're asking here!
I did look over those links! I appreciate the help.

One thing I'm running into is that I really have no idea how to customize the vbox for text as it says. I want to be able to post in the window like I would normal say dialogue.

Example:

Code: Select all

character "This text goes in the normal say dialogue box."

chatroom1 "This text goes in the chat window but doesn't make the say window disappear."

chatroom 2 "This goes beneath the last line of dialogue in the chat window."

character "The chat window stays on the screen and you can see my thoughts on the matter!"
Obviously it doesn't have to be that easy. I can throw in extra strings of code. But ultimately, I need it to be displayed at the same time as the character's dialogue and not erasing each time.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 659
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Displaying textbox and NVL at the same time?

#6 Post by Milkymalk » Mon Jul 10, 2017 9:23 pm

You could make a viewport inside a screen and display a list inside it:

Code: Select all

python:
    class Message:
        def __init__(self, name, message):
            self.name = name
            self.message = message

    class Chatlog:
        def __init__(self):
            self.history = []

        def addmessage(self, name, message):
            self.history.append(Message(name, message))

        def delchat(self):
            self.history = []

screen chatdisplay:
    frame:
        viewport id "chatwindow":
            mousewheel True
            side_area (100, 100, 300, 600)
            yinitial 0.0
            scrollbars "vertical"
            hbox:
                vbox:
                    for i in chat.history:
                        text i.name
                vbox:
                    for i in chat.history:
                        text i.message

init:
    default chat = Chatlog()
Whenever you want something to appear in the chat, you would instead do

Code: Select all

$ chat.addmessage("Ren", "Hi, is anybody online?")
This is all untested and not guaranteed to work without bugfixing, but it's how I would start with this.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
Fuu
Newbie
Posts: 18
Joined: Tue Mar 03, 2015 3:10 pm
Completed: 404 Error: Connection Not Found Demo, NAOMI, Simple Answers
Projects: 404 Error: Connection Not Found, Ashes//Dust
Organization: CODE:Phantasm, Paper Star Studios
Tumblr: Rottenadel
itch: Codephantasm
Contact:

Re: Displaying textbox and NVL at the same time?

#7 Post by Fuu » Mon Jul 10, 2017 9:57 pm

I get the following error when I try this.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/common/00start.rpy", line 178, in script
    python:
  File "renpy/common/00start.rpy", line 179, in <module>
    renpy.execute_default_statement(True)
  File "game/screens.rpy", line 596, in set_default
    default chat = Chatlog()
  File "game/screens.rpy", line 596, in <module>
    default chat = Chatlog()
NameError: name 'Chatlog' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "C:\Users\Adelei\Dropbox\Paper Star Studios\Ren'Py Engine and Tools\renpy-6.99.12.4-sdk\renpy\bootstrap.py", line 295, in bootstrap
    renpy.main.main()
  File "C:\Users\Adelei\Dropbox\Paper Star Studios\Ren'Py Engine and Tools\renpy-6.99.12.4-sdk\renpy\main.py", line 487, in main
    run(restart)
  File "C:\Users\Adelei\Dropbox\Paper Star Studios\Ren'Py Engine and Tools\renpy-6.99.12.4-sdk\renpy\main.py", line 147, in run
    renpy.execution.run_context(True)
  File "C:\Users\Adelei\Dropbox\Paper Star Studios\Ren'Py Engine and Tools\renpy-6.99.12.4-sdk\renpy\execution.py", line 761, in run_context
    context.run()
  File "renpy/common/00start.rpy", line 178, in script
    python:
  File "C:\Users\Adelei\Dropbox\Paper Star Studios\Ren'Py Engine and Tools\renpy-6.99.12.4-sdk\renpy\ast.py", line 814, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\Adelei\Dropbox\Paper Star Studios\Ren'Py Engine and Tools\renpy-6.99.12.4-sdk\renpy\python.py", line 1719, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/00start.rpy", line 179, in <module>
    renpy.execute_default_statement(True)
  File "C:\Users\Adelei\Dropbox\Paper Star Studios\Ren'Py Engine and Tools\renpy-6.99.12.4-sdk\renpy\exports.py", line 3108, in execute_default_statement
    i.set_default(start)
  File "game/screens.rpy", line 596, in set_default
    default chat = Chatlog()
  File "C:\Users\Adelei\Dropbox\Paper Star Studios\Ren'Py Engine and Tools\renpy-6.99.12.4-sdk\renpy\python.py", line 1743, in py_eval_bytecode
    return eval(bytecode, globals, locals)
  File "game/screens.rpy", line 596, in <module>
    default chat = Chatlog()
NameError: name 'Chatlog' is not defined

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
404 0.0

User avatar
Milkymalk
Miko-Class Veteran
Posts: 659
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Displaying textbox and NVL at the same time?

#8 Post by Milkymalk » Mon Jul 10, 2017 10:00 pm

Sorry, I should have seen that. Change "python:" into "init python:" The problem is the order of things, the classes need to be defined before that line with "default" is executed.

Maybe it's also necessary to change all "class Blah:" into "class Blah(object):"
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
Fuu
Newbie
Posts: 18
Joined: Tue Mar 03, 2015 3:10 pm
Completed: 404 Error: Connection Not Found Demo, NAOMI, Simple Answers
Projects: 404 Error: Connection Not Found, Ashes//Dust
Organization: CODE:Phantasm, Paper Star Studios
Tumblr: Rottenadel
itch: Codephantasm
Contact:

Re: Displaying textbox and NVL at the same time?

#9 Post by Fuu » Mon Jul 10, 2017 11:44 pm

Milkymalk wrote:Sorry, I should have seen that. Change "python:" into "init python:" The problem is the order of things, the classes need to be defined before that line with "default" is executed.

Maybe it's also necessary to change all "class Blah:" into "class Blah(object):"
You may be right. I'm getting the following error now.

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/screens.rpy", line 565: expected statement.
    class Message:
                 ^

File "game/screens.rpy", line 570: expected statement.
    class Chatlog:
                 ^

Ren'Py Version: Ren'Py 6.99.12.4.2187
I apologize for all the questions!

EDIT: Also it seems changing the first line to "init python:" causes the game to not go past the start menu.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 659
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Displaying textbox and NVL at the same time?

#10 Post by Milkymalk » Mon Jul 10, 2017 11:57 pm

Sorry, tired. Will try to get it to run by myself after sleep :)
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
Fuu
Newbie
Posts: 18
Joined: Tue Mar 03, 2015 3:10 pm
Completed: 404 Error: Connection Not Found Demo, NAOMI, Simple Answers
Projects: 404 Error: Connection Not Found, Ashes//Dust
Organization: CODE:Phantasm, Paper Star Studios
Tumblr: Rottenadel
itch: Codephantasm
Contact:

Re: Displaying textbox and NVL at the same time?

#11 Post by Fuu » Tue Jul 11, 2017 12:50 am

Thank you so much for the help!

I switched from Legacy screens to the updated one and the errors cleared, however when I use the $ chat.addmessage bit in the script, nothing happens and the game just skips over it.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 659
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Displaying textbox and NVL at the same time?

#12 Post by Milkymalk » Tue Jul 11, 2017 2:31 am

Dumb question: Did you show the screen? ;)
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
Fuu
Newbie
Posts: 18
Joined: Tue Mar 03, 2015 3:10 pm
Completed: 404 Error: Connection Not Found Demo, NAOMI, Simple Answers
Projects: 404 Error: Connection Not Found, Ashes//Dust
Organization: CODE:Phantasm, Paper Star Studios
Tumblr: Rottenadel
itch: Codephantasm
Contact:

Re: Displaying textbox and NVL at the same time?

#13 Post by Fuu » Tue Jul 11, 2017 2:48 am

Milkymalk wrote:Dumb question: Did you show the screen? ;)
welp, I feel like a bloody idiot. After all the fiddling that's what was wrong!

Thank you so much for helping with this!

User avatar
Milkymalk
Miko-Class Veteran
Posts: 659
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Displaying textbox and NVL at the same time?

#14 Post by Milkymalk » Tue Jul 11, 2017 9:31 am

:D
So it works now?
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
Fuu
Newbie
Posts: 18
Joined: Tue Mar 03, 2015 3:10 pm
Completed: 404 Error: Connection Not Found Demo, NAOMI, Simple Answers
Projects: 404 Error: Connection Not Found, Ashes//Dust
Organization: CODE:Phantasm, Paper Star Studios
Tumblr: Rottenadel
itch: Codephantasm
Contact:

Re: Displaying textbox and NVL at the same time?

#15 Post by Fuu » Tue Jul 11, 2017 11:47 am

Milkymalk wrote::D
So it works now?
It appears to! I haven't been able to do extensive testing yet but it's displaying as I wanted. I take it I would customize this as a viewport?

Post Reply

Who is online

Users browsing this forum: Google [Bot], hell_oh_world