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.
I'm currently working on a chatsim, and have edited the NVL menu to hold the "messaging client" part of the game. All works fine and as expected, but I was considering adding a "XYZ is typing..." indicator.
I actually have got this mostly working using renpy.scry(), but I find that it doesn't update fast enough. When it changes from one character to another typing, it lags behind a little, and won't update the variable for a couple of seconds, which makes it say "XYZ is typing..." when they aren't. When it changes from the player character back to the love interest typing, the typing indicator also doesn't appear UNTIL the message does.
Any suggestions? I've tried changing the timer around of course. If there's a better way to do the typing indicator, I'd be happy to hear it, too.
init python:
def getcurrentspeaker():
scry = renpy.scry()
store.grim_reaper_is_next = scry.who
screen nvl(dialogue, items=None):
timer 0.5 action Function(getcurrentspeaker)
window:
style "nvl_window"
has vbox:
spacing gui.nvl_spacing
viewport id "nvlscroll":
area (0, -50, 1470, 750)
yinitial 1.0
mousewheel True
vbox:
for d in dialogue:
if d.who is not None:
hbox:
add message_icon xoffset 30 yoffset 3
text d.who:
id d.who_id
text d.what:
id d.what_id
if str(grim_reaper_is_next) == "Grim Reaper":
text "[grim_reaper_name] is typing...":
xalign 0.2 yalign 0.8
It's tons of lines sprinkled between the dialogue, but you'll have full control over how it looks. Of course you can let the class calculate the duration of typing depending on the length of the dialogue too.
Gabmag wrote: ↑Tue May 09, 2023 8:15 am
Hello everyone!
I'm currently working on a chatsim, and have edited the NVL menu to hold the "messaging client" part of the game. All works fine and as expected, but I was considering adding a "XYZ is typing..." indicator.
I actually have got this mostly working using renpy.scry(), but I find that it doesn't update fast enough. When it changes from one character to another typing, it lags behind a little, and won't update the variable for a couple of seconds, which makes it say "XYZ is typing..." when they aren't. When it changes from the player character back to the love interest typing, the typing indicator also doesn't appear UNTIL the message does.
Any suggestions? I've tried changing the timer around of course. If there's a better way to do the typing indicator, I'd be happy to hear it, too.
The problem is due to the timer. It likely creates all the problems. Instead, you can use, for example, a transform.
I also did not understand why you get the current speaker. Is it your idea to predict the next character?
I like the idea of Kia, but if you are looking for a solution without additional lines, here is a possible example:
Kia wrote: ↑Fri May 12, 2023 2:12 am
The way I've handled it was by introducing an artificial pause, and calling a method in my phone class to mimic a typing animation
It's tons of lines sprinkled between the dialogue, but you'll have full control over how it looks. Of course you can let the class calculate the duration of typing depending on the length of the dialogue too.
Thank you! I did consider doing it manually like this, but I think I'd probably end up cutting the feature rather than adding this in between every single line, as the whole game is texting. Still, I appreciate the response!
Gabmag wrote: ↑Tue May 09, 2023 8:15 am
Hello everyone!
I'm currently working on a chatsim, and have edited the NVL menu to hold the "messaging client" part of the game. All works fine and as expected, but I was considering adding a "XYZ is typing..." indicator.
I actually have got this mostly working using renpy.scry(), but I find that it doesn't update fast enough. When it changes from one character to another typing, it lags behind a little, and won't update the variable for a couple of seconds, which makes it say "XYZ is typing..." when they aren't. When it changes from the player character back to the love interest typing, the typing indicator also doesn't appear UNTIL the message does.
Any suggestions? I've tried changing the timer around of course. If there's a better way to do the typing indicator, I'd be happy to hear it, too.
The problem is due to the timer. It likely creates all the problems. Instead, you can use, for example, a transform.
I also did not understand why you get the current speaker. Is it your idea to predict the next character?
I like the idea of Kia, but if you are looking for a solution without additional lines, here is a possible example:
screen nvl(dialogue, items=None):
window:
...
# next_who = nextspeaker()
if next_who:
text "[next_who] is typing ..." at nvl_typing:
xalign 0.2 yalign 0.8
Thanks for that! The getcurrentspeaker is just poor naming on my part.
I've implemented your idea, but unfortunately it leads to the same issue as my previous code. After the player characters message is sent, no matter who is saying the next line, it will say "player_name" is typing. Fortunately I don't want it to say when the player is typing, so I set it to only show when the love interest is typing - but the problem with the player character remains in that NOTHING will show after the player characters message, then the love interests message will appear. From then on it will work, but when it switches between characters nothing will show.
It's the same the other way around - it will show "love interest" is typing, then that will disappear, then the player options come up. I believe it's something to do with menus and choices.
Thank you very much for your help, but I think I'll probably just scrap the idea or come back to it later!