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.
Hello,
I want to display text messages that emulate a chat,
I want the messages to appear one by one, and I want them to be reviewed with a scroll bar ...
Something like that:
This is the script I have, but I don't know how to put pauses between the messages ...
screen viewport_example():
side "c r":
area (60, 150, 1150, 470)
viewport id "vp":
draggable True
vbox:
spacing 10
xalign 0.5
yalign 0.8
frame:
background Solid("#00000070")
text "{color=#dea0b8}{b}PJ 1{/color}{/b}\nText1"
add "pic3.png"
frame:
background Solid("#00000070")
text "{color=#db9e7d}{b}PJ 2{/color}{/b} \nText 2"
frame:
background Solid("#00000070")
text "{color=#7db1db}{b}PJ 3{/color}{/b} \nText 3 text 3 text 3 \nText 3 text 3 text 3 text 3 text 3text 3 text 3 \nText 3 text 3 text 3\nText 3 text 3 text 3 text 3 text 3 \nText 3 text 3 text 3 text 3 text 3text 3 text 3 \nText 3 text 3 text 3\nText 3 text 3 text 3 text 3 text 3"
frame:
background Solid("#00000070")
text "{color=#db9e7d}{b}PJ 2{/color}{/b} \nText 4 text 4 text 4 \nText 4 text 4 text 4\ nText 4 text 4 text 4"
textbutton _("Reply") action Return()
vbar value YScrollValue("vp")
# El juego comienza aquí.
label start:
scene gui_cel2
call screen viewport_example
scene bg
menu:
"Reply1.-":
jump fin
"Reply2.-":
jump fin
label fin:
"End"
return
I have seen other topics with message systems but
1. one message replaces another
2. the messages are displayed but they are lost as they do not have a scroll bar
And that's not what I'm looking for...
I don't know if I'm on the right track or if there is an easier way to do things, I would really appreciate any help you can give me.
Last edited by neriowl on Tue Aug 03, 2021 9:09 am, edited 1 time in total.
neriowl wrote: ↑Mon Aug 02, 2021 11:22 am
...I don't know if I'm on the right track or if there is an easier way to do things, I would really appreciate any help you can give me.
If you don't need fully-functional message system but just a visual effect, you could try to make it like:
- make a counter variable,
- add check for this variable before each message in your screen,
- then increase the value of variable (manually or using timer in your screen).
default messages_counter = 0
screen viewport_example():
side "c r":
area (60, 150, 1150, 470)
viewport id "vp":
draggable True
vbox:
spacing 10
xalign 0.5
yalign 0.8
$ if messages_counter > 0:
frame:
background Solid("#00000070")
text "{color=#dea0b8}{b}PJ 1{/color}{/b}\nText1"
$ if messages_counter > 1:
add "pic3.png"
frame:
background Solid("#00000070")
text "{color=#db9e7d}{b}PJ 2{/color}{/b} \nText 2"
$ if messages_counter > 2:
frame:
background Solid("#00000070")
text "{color=#7db1db}{b}PJ 3{/color}{/b} \nText 3 text 3 text 3 \nText 3 text 3 text 3 text 3 text 3text 3 text 3 \nText 3 text 3 text 3\nText 3 text 3 text 3 text 3 text 3 \nText 3 text 3 text 3 text 3 text 3text 3 text 3 \nText 3 text 3 text 3\nText 3 text 3 text 3 text 3 text 3"
$ if messages_counter > 3:
frame:
background Solid("#00000070")
text "{color=#db9e7d}{b}PJ 2{/color}{/b} \nText 4 text 4 text 4 \nText 4 text 4 text 4\ nText 4 text 4 text 4"
textbutton _("Reply") action Return()
vbar value YScrollValue("vp")
But if you need more from this message system, then you need to store messages in a list and modify your screen to show messages from that list. So, later you could add new messages in a list.