Trying to create a "chat" system in game menu
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.
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.
- jingleriot
- Regular
- Posts: 25
- Joined: Mon Sep 05, 2016 7:53 pm
- Projects: Ventio Mortis, Sector Chimera, Monster Party
- Deviantart: jingleriot
- itch: https://jingleriotga
- Contact:
Trying to create a "chat" system in game menu
I want to create a chat screen/menu to change to in game. The character has the ability to speak to other characters over the computer with a chat program, and I'm not sure how to go about creating that type of menu, myself, yet. I saw something very close, but not quite the right thing, which was littanana's text message system.
The screen design I'm planning on using for now is attached. I'll be using this until I create a different asset, but It'd very likely still be set up the same (positions wise). Just different, aesthetically.
I'd like to be able to put the text in the text box area, and the MC's responses in the box beneath that. I think the only other thing I'd like to be able to control is a spot to be able to put in the name variable for the custom character, but I'm not going to be torn up if it can't be done. I'll just leave it as undefined and say that the chat system in game is messed up .
I'd probably just change the background asset for the chat menu to "change tabs", so it doesn't have to be fancy and clickable in that aspect as long as I can change the background image.
Any help is appreciated and thanks in advanced!!
The screen design I'm planning on using for now is attached. I'll be using this until I create a different asset, but It'd very likely still be set up the same (positions wise). Just different, aesthetically.
I'd like to be able to put the text in the text box area, and the MC's responses in the box beneath that. I think the only other thing I'd like to be able to control is a spot to be able to put in the name variable for the custom character, but I'm not going to be torn up if it can't be done. I'll just leave it as undefined and say that the chat system in game is messed up .
I'd probably just change the background asset for the chat menu to "change tabs", so it doesn't have to be fancy and clickable in that aspect as long as I can change the background image.
Any help is appreciated and thanks in advanced!!
- namastaii
- Eileen-Class Veteran
- Posts: 1350
- Joined: Mon Feb 02, 2015 8:35 pm
- Projects: Template Maker for Ren'Py, What Life
- Github: lunalucid
- Skype: Discord: lunalucid#1991
- Soundcloud: LunaLucidMusic
- itch: lunalucid
- Location: USA
- Contact:
Re: Trying to create a "chat" system in game menu
For the custom name thing, you can use one of my examples as a base and then design on top of that? viewtopic.php?f=51&t=38080&hilit=+cookbook
I haven't looked into that text message system but if you combine that with deciding how to position everything or look into viewports and whatnot, you could figure out something and maybe someone could come up with an example who knows littana's system.
edit: Okay so I looked at that code and it's basically just a bunch of animations, so you would need to open up the script and edit the offset numbers and such for the transforms and look over all that stuff to place it in the right spots. But this also means that the messages disappear after they show up so if you're looking for a message system that keeps messages there, you'll need to look up 'basic message system' for renpy and go off of that instead or if you know how, to create something from scratch. It will take some trial and error.
I haven't looked into that text message system but if you combine that with deciding how to position everything or look into viewports and whatnot, you could figure out something and maybe someone could come up with an example who knows littana's system.
edit: Okay so I looked at that code and it's basically just a bunch of animations, so you would need to open up the script and edit the offset numbers and such for the transforms and look over all that stuff to place it in the right spots. But this also means that the messages disappear after they show up so if you're looking for a message system that keeps messages there, you'll need to look up 'basic message system' for renpy and go off of that instead or if you know how, to create something from scratch. It will take some trial and error.
- andrewngn13
- Regular
- Posts: 65
- Joined: Thu Nov 13, 2014 2:41 pm
- Projects: Recast
- Skype: andrewngn13
- Location: Glued to my desktop
- Contact:
Re: Trying to create a "chat" system in game menu
To add on to namastaii's reply, the example here does some nifty things using an array to hold the text and display them.
viewtopic.php?f=51&t=19295
I wasn't too sure about what you intended as the messaging went on though. Are you having the reader inputting actual replies(which sounds like messy business) or giving them choices then having the text appear in the system?
*I'm guessing the latter
viewtopic.php?f=51&t=19295
I wasn't too sure about what you intended as the messaging went on though. Are you having the reader inputting actual replies(which sounds like messy business) or giving them choices then having the text appear in the system?
*I'm guessing the latter
"Feel feel to idea-bounce off me."
No, like seriously, just send a pm and I'll respond what I think. I'm open to reading anything.
No, like seriously, just send a pm and I'll respond what I think. I'm open to reading anything.
- jingleriot
- Regular
- Posts: 25
- Joined: Mon Sep 05, 2016 7:53 pm
- Projects: Ventio Mortis, Sector Chimera, Monster Party
- Deviantart: jingleriot
- itch: https://jingleriotga
- Contact:
Re: Trying to create a "chat" system in game menu
I want the chat log to stay there, but maybe scroll up as the text comes in? If that's possible? Just trying to give it the appearance of an actual instant messaging app like Skype or whatever.
And yes, the latter! Select choices, I am definitely not giving that much freedom, haha.
And yes, the latter! Select choices, I am definitely not giving that much freedom, haha.
Last edited by jingleriot on Wed Sep 28, 2016 6:28 pm, edited 1 time in total.
- xavimat
- Eileen-Class Veteran
- Posts: 1461
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Discord: xavimat
- Contact:
Re: Trying to create a "chat" system in game menu
Something like this?
Code: Select all
init -1 python hide:
config.screen_width = 868
config.screen_height = 576
define cht = Character(None, what_suffix="{p=.1}{nw}", what_color="#000", what_size=18, what_slow_cps=50, window_background=None, what_xoffset=155, what_yoffset=90, what_xsize=649)
label start:
$ chat("Anto#`Ugh!’ said the Lory, with a shiver.")
menu:
"What can I say..."
"Option 1":
$ chat("Dr. Sarah#`I beg your pardon!’ said the Mouse, frowning, but very politely: `Did you speak?’")
"Option 2":
$ chat("Dr. Sarah#`Not I!’ said the Lory hastily.")
$ chat("Vincent#I thought you did,’ said the Mouse. `–I proceed. “Edwin and Morcar, the earls of Mercia and Northumbria, declared for him: and even Stigand, the patriotic archbishop of Canterbury, found it advisable–“‘")
$ chat("Ren#`Found WHAT?’ said the Duck.")
$ chat("Undefined#`Found IT,’ the Mouse replied rather crossly: `of course you know what “it” means.’")
$ chat("Anto#`I know what “it” means well enough, when I find a thing,’ said the Duck: `it’s generally a frog or a worm. The question is, what did the archbishop find?’")
menu:
"What can I say..."
"Option 1":
$ chat("Dr. Sarah#The Mouse did not notice this question...")
"Option 2":
$ chat("Dr. Sarah#But the insolence of his Normans–” How are you getting on now, my dear?’")
$ chat("Vincent#`As wet as ever,’ said Alice in a melancholy tone: `it doesn’t seem to dry me at all.’")
$ chat("Ren#`In that case,’ said the Dodo solemnly, rising to its feet, `I move that the meeting adjourn, for the immediate adoption of more energetic remedies–‘")
$ chat("Undefined#`Speak English!’ said the Eaglet. `I don’t know the meaning of half those long words, and, what’s more, I don’t believe you do either!’")
$ chat("Anto#And the Eaglet bent down its head to hide a smile: some of the other birds tittered audibly.")
menu:
"What can I say..."
"Option 1":
$ chat("Dr. Sarah#`What I was going to say,’")
"Option 2":
$ chat("Dr. Sarah#`said the Dodo in an offended tone, ")
$ chat("Vincent#`was, that the best thing to get us dry would be a Caucus-race.’")
$ chat("Ren#What IS a Caucus-race?’ said Alice; not that she wanted much to know,")
$ chat("Undefined#but the Dodo had paused as if it thought that SOMEBODY ought to speak, and no one else seemed inclined to say anything.")
$ chat("Anto#`Why,’ said the Dodo, `the best way to explain it is to do it.’")
menu:
"What can I say..."
"Option 1":
$ chat("Dr. Sarah#(And, as you might like to try the thing yourself,")
"Option 2":
$ chat("Dr. Sarah#some winter day, I will tell you how the Dodo managed it.)")
$ chat("Ren#First it marked out a race-course, in a sort of circle,")
$ chat("Undefined#(`the exact shape doesn’t matter,’ it said,)")
$ chat("Anto#and then all the party were placed along the course, here and there.")
menu:
"What can I say..."
"Option 1":
$ chat("Dr. Sarah#x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x ")
"Option 2":
$ chat("Dr. Sarah#There was no `One, two, three, and away,’")
$ chat("Vincent#TO BE CONTINUED...")
return
default chatlines = [ ]
default colors = {
"Dr. Sarah": "#6081bd",
"Anto": "#4bc4c8",
"Vincent": "#6ab668",
"Ren": "#c0263c",
"Undefined": "#9c77bc"
}
init python:
def chat(t):
t = t.split("#")
if t[0] in colors:
txt = "{color=" + colors[t[0]] + "}" + t[0] + "{/color}: " + t[1]
else:
return ## There is an error in the speaker's name
if t[0] == "Dr. Sarah":
## Here speaks the protagonist
renpy.say(cht, t[1])
chatlines.append(txt)
renpy.hide_screen("chatboard")
renpy.show_screen("chatboard")
renpy.pause()
screen chatboard():
tag chat
add "groupchat.png"
fixed:
area (157, 103, 555, 379)
viewport:
draggable True
scrollbars "vertical"
mousewheel True
yinitial 1.0
vbox:
for i in chatlines:
text i color "#000" size 18
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)
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)
- namastaii
- Eileen-Class Veteran
- Posts: 1350
- Joined: Mon Feb 02, 2015 8:35 pm
- Projects: Template Maker for Ren'Py, What Life
- Github: lunalucid
- Skype: Discord: lunalucid#1991
- Soundcloud: LunaLucidMusic
- itch: lunalucid
- Location: USA
- Contact:
Re: Trying to create a "chat" system in game menu
You'll want to maybe look into viewports
- jingleriot
- Regular
- Posts: 25
- Joined: Mon Sep 05, 2016 7:53 pm
- Projects: Ventio Mortis, Sector Chimera, Monster Party
- Deviantart: jingleriot
- itch: https://jingleriotga
- Contact:
Re: Trying to create a "chat" system in game menu
First, I'd like to apologize immediately to everyone trying to help me! I am fairly fresh with all of this so I'm not sure I am personally capable yet of doing this on my own so forgive me if I don't get it at first.xavimat wrote:Something like this?Code: Select all
init -1 python hide: config.screen_width = 868 config.screen_height = 576 define cht = Character(None, what_suffix="{p=.1}{nw}", what_color="#000", what_size=18, what_slow_cps=50, window_background=None, what_xoffset=155, what_yoffset=90, what_xsize=649) label start: $ chat("Anto#`Ugh!’ said the Lory, with a shiver.") menu: "What can I say..." "Option 1": $ chat("Dr. Sarah#`I beg your pardon!’ said the Mouse, frowning, but very politely: `Did you speak?’") "Option 2": $ chat("Dr. Sarah#`Not I!’ said the Lory hastily.") $ chat("Vincent#I thought you did,’ said the Mouse. `–I proceed. “Edwin and Morcar, the earls of Mercia and Northumbria, declared for him: and even Stigand, the patriotic archbishop of Canterbury, found it advisable–“‘") $ chat("Ren#`Found WHAT?’ said the Duck.") $ chat("Undefined#`Found IT,’ the Mouse replied rather crossly: `of course you know what “it” means.’") $ chat("Anto#`I know what “it” means well enough, when I find a thing,’ said the Duck: `it’s generally a frog or a worm. The question is, what did the archbishop find?’") menu: "What can I say..." "Option 1": $ chat("Dr. Sarah#The Mouse did not notice this question...") "Option 2": $ chat("Dr. Sarah#But the insolence of his Normans–” How are you getting on now, my dear?’") $ chat("Vincent#`As wet as ever,’ said Alice in a melancholy tone: `it doesn’t seem to dry me at all.’") $ chat("Ren#`In that case,’ said the Dodo solemnly, rising to its feet, `I move that the meeting adjourn, for the immediate adoption of more energetic remedies–‘") $ chat("Undefined#`Speak English!’ said the Eaglet. `I don’t know the meaning of half those long words, and, what’s more, I don’t believe you do either!’") $ chat("Anto#And the Eaglet bent down its head to hide a smile: some of the other birds tittered audibly.") menu: "What can I say..." "Option 1": $ chat("Dr. Sarah#`What I was going to say,’") "Option 2": $ chat("Dr. Sarah#`said the Dodo in an offended tone, ") $ chat("Vincent#`was, that the best thing to get us dry would be a Caucus-race.’") $ chat("Ren#What IS a Caucus-race?’ said Alice; not that she wanted much to know,") $ chat("Undefined#but the Dodo had paused as if it thought that SOMEBODY ought to speak, and no one else seemed inclined to say anything.") $ chat("Anto#`Why,’ said the Dodo, `the best way to explain it is to do it.’") menu: "What can I say..." "Option 1": $ chat("Dr. Sarah#(And, as you might like to try the thing yourself,") "Option 2": $ chat("Dr. Sarah#some winter day, I will tell you how the Dodo managed it.)") $ chat("Ren#First it marked out a race-course, in a sort of circle,") $ chat("Undefined#(`the exact shape doesn’t matter,’ it said,)") $ chat("Anto#and then all the party were placed along the course, here and there.") menu: "What can I say..." "Option 1": $ chat("Dr. Sarah#x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x ") "Option 2": $ chat("Dr. Sarah#There was no `One, two, three, and away,’") $ chat("Vincent#TO BE CONTINUED...") return default chatlines = [ ] default colors = { "Dr. Sarah": "#6081bd", "Anto": "#4bc4c8", "Vincent": "#6ab668", "Ren": "#c0263c", "Undefined": "#9c77bc" } init python: def chat(t): t = t.split("#") if t[0] in colors: txt = "{color=" + colors[t[0]] + "}" + t[0] + "{/color}: " + t[1] else: return ## There is an error in the speaker's name if t[0] == "Dr. Sarah": ## Here speaks the protagonist renpy.say(cht, t[1]) chatlines.append(txt) renpy.hide_screen("chatboard") renpy.show_screen("chatboard") renpy.pause() screen chatboard(): tag chat add "groupchat.png" fixed: area (157, 103, 555, 379) viewport: draggable True scrollbars "vertical" mousewheel True yinitial 1.0 vbox: for i in chatlines: text i color "#000" size 18
Secondly, at xavimat, I can't get this to work. I'm assuming I'm just doing something wrong with putting these parts in the right locations, but It comes back with the error:
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.
File "game/screens.rpy", line 563: expected statement.
default chatlines = [ ]
^
File "game/screens.rpy", line 564: expected statement.
default colors = {
^
"Dr. Sarah": "#6081bd",
"Anto": "#4bc4c8",
"Vincent": "#6ab668",
"Ren": "#c0263c",
"Undefined": "#9c77bc"
}
namastaii wrote:For the custom name thing, you can use one of my examples as a base and then design on top of that? viewtopic.php?f=51&t=38080&hilit=+cookbook
I haven't looked into that text message system but if you combine that with deciding how to position everything or look into viewports and whatnot, you could figure out something and maybe someone could come up with an example who knows littana's system.
edit: Okay so I looked at that code and it's basically just a bunch of animations, so you would need to open up the script and edit the offset numbers and such for the transforms and look over all that stuff to place it in the right spots. But this also means that the messages disappear after they show up so if you're looking for a message system that keeps messages there, you'll need to look up 'basic message system' for renpy and go off of that instead or if you know how, to create something from scratch. It will take some trial and error.
I don't know anything about viewports yet, personally. I'll have to look into them! And thank you for suggesting a way to create the custom name. When it gets to that point, I'll probably end up using that, so thank you very much. Sorry for not giving a better response, earlier, I was on my phone! Thank you so much for responding.namastaii wrote:You'll want to maybe look into viewports
- xavimat
- Eileen-Class Veteran
- Posts: 1461
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Discord: xavimat
- Contact:
Re: Trying to create a "chat" system in game menu
The "expected statement" error probably comes from bad indentation. Please check it.
If you are starting with renpy, maybe you need to get familiar first with basic things. Indentation is the most important thing at all, it decides when every line will be executed.
In my examples I use a viewport, as suggested. The doc (with an example) is here: https://www.renpy.org/doc/html/screens.html#viewport
If you are starting with renpy, maybe you need to get familiar first with basic things. Indentation is the most important thing at all, it decides when every line will be executed.
In my examples I use a viewport, as suggested. The doc (with an example) is here: https://www.renpy.org/doc/html/screens.html#viewport
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)
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)
Who is online
Users browsing this forum: Google [Bot]