Question: How to make text fade after it's been read?
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.
Question: How to make text fade after it's been read?
Like this: https://www.youtube.com/watch?v=dg3sZOG-EjE
I really like the effect and can't for the life of me figure out how the hell to do it...
Any ideas?
I really like the effect and can't for the life of me figure out how the hell to do it...
Any ideas?
Re: Question: How to make text fade after it's been read?
Try:
thanks to Kinsman http://lemmasoft.renai.us/forums/viewto ... 75#p269905
Code: Select all
screen nvl:
$ global new_dialogue
$ new_dialogue = dialogue
window:
style "nvl_window"
has vbox:
style "nvl_vbox"
# Display dialogue.
if say_lock == False:
$ index = 0
if len(dialogue) > 2:
for who, what, who_id, what_id, window_id in new_dialogue:
if index < len(new_dialogue)-2:
window:
id window_id
has hbox:
spacing 10
if who is not None:
text who id who_id at my_fade
text what id what_id at my_fade
$ index += 1
elif index < len(new_dialogue)-1:
window:
id window_id
has hbox:
spacing 10
if who is not None:
text who id who_id at my_tr
text what id what_id at my_tr
$ index += 1
else:
window:
id window_id
has hbox:
spacing 10
if who is not None:
text who id who_id
text what id what_id
elif len(dialogue) > 1:
for who, what, who_id, what_id, window_id in new_dialogue:
if index < len(new_dialogue)-1:
window:
id window_id
has hbox:
spacing 10
if who is not None:
text who id who_id at my_tr
text what id what_id at my_tr
$ index += 1
else:
window:
id window_id
has hbox:
spacing 10
if who is not None:
text who id who_id
text what id what_id
else:
for who, what, who_id, what_id, window_id in new_dialogue:
window:
id window_id
has hbox:
spacing 10
if who is not None:
text who id who_id
text what id what_id
else:
$ index = 0
if len(old_dialogue) > 1:
for who, what, who_id, what_id, window_id in old_dialogue:
if index < len(old_dialogue)-1:
window:
id window_id
has hbox:
spacing 10
if who is not None:
text who id who_id at my_fade
text what id what_id at my_fade
$ index += 1
else:
window:
id window_id
has hbox:
spacing 10
if who is not None:
text who id who_id
text what id what_id
else:
for who, what, who_id, what_id, window_id in old_dialogue:
window:
id window_id
has hbox:
spacing 10
if who is not None:
text who id who_id
text what id what_id
# Display a menu, if given.
if items:
vbox:
id "menu"
for caption, action, chosen in items:
if action:
button:
style "nvl_menu_choice_button"
action action
text caption style "nvl_menu_choice"
else:
text caption style "nvl_dialogue"
add SideImage() xalign 0.0 yalign 1.0
use quick_menu
transform my_fade:
alpha 0.5
transform my_tr:
linear 0.5 alpha 0.5
init python:
config.empty_window = nvl_show_core
def say_aware(event,interact,type):
global old_dialogue
global new_dialogue
global say_lock
if event == "begin":
say_lock = False
if event == "end":
say_lock = True
old_dialogue = new_dialogueCode: Select all
# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8", kind=nvl, callback=say_aware)
define narrator = Character(None, kind=nvl, callback=say_aware)
# The game starts here.
label start:
#window show
scene black
"Hello, Eileen."
window show # if needed place it after line of text
e "Hi!"
scene expression Solid ("#c00") with Dissolve (1.0)
"... some bg changes ..."
"????"
nvl clear
"Some other text"
"..."Re: Question: How to make text fade after it's been read?
Any wizards around here know why Alex's script isn't working?
Getting the errors:
File "renpy/common/00nvl_mode.rpy, line 285, in do_display
**display_args)
File "game/script.rpy",line 32, in say_aware
old_dialogue = new_dialogue
NameError: global name 'new_dialogue' is not defined
Thanks
Getting the errors:
File "renpy/common/00nvl_mode.rpy, line 285, in do_display
**display_args)
File "game/script.rpy",line 32, in say_aware
old_dialogue = new_dialogue
NameError: global name 'new_dialogue' is not defined
Thanks
Re: Question: How to make text fade after it's been read?
You prolly didn't define the variable. Like:
Code is a bit messy as well 
Code: Select all
new_dialouge = ""Re: Question: How to make text fade after it's been read?
Add somewhere:
Replace similar bit in screens.rpy file with:
Code: Select all
transform my_fade(t, alpha):
alpha 1.0
linear t alpha alphaCode: Select all
# Display dialogue.
for who, what, who_id, what_id, window_id in dialogue:
$ index = dialogue.index((who, what, who_id, what_id, window_id))
$ l = len(dialogue)
window:
id window_id
has hbox:
spacing 10
if index == l - 1:
$ pass
elif index == l - 2:
at my_fade(1, 0.5)
else:
at my_fade(0, 0.5)
if who is not None:
text who id who_id
text what id what_idRe: Question: How to make text fade after it's been read?
After several months getting angry with a piece of code, desperately trying to learn ren'py to figure out why it wasn't working, only for it to turn out the solution was something as simply as adding: " " ... It's somewhat bitter sweet.
-_-
Thank you ever so much, Xela!
I don't know if this wants to be added to the "cookbook" or something, but we have ourselves a working "read text fade"
-_-
Thank you ever so much, Xela!
I don't know if this wants to be added to the "cookbook" or something, but we have ourselves a working "read text fade"
Re: Question: How to make text fade after it's been read?
Omega_93 wrote:After several months getting angry with a piece of code, desperately trying to learn ren'py to figure out why it wasn't working, only for it to turn out the solution was something as simply as adding: " " ... It's somewhat bitter sweet.
-_-
Thank you ever so much, Xela!
I don't know if this wants to be added to the "cookbook" or something, but we have ourselves a working "read text fade"
In case it wasn't clear. There is no need to define new globals, callback function, two transforms and a new screen with endless if/else forks. 11 lines of added code from my second post do the same thing. They were not meant as an addon to the previous code, they were meant to replace it completely.
Re: Question: How to make text fade after it's been read?
No no, I understood that you meant to replace some code, I just didn't get what you meant to replace. So I tried your first suggestion of simply adding the " " to the code and the code by Alex worked.
What needed to be replaced? And what's the difference, if you don't mind me asking?
What needed to be replaced? And what's the difference, if you don't mind me asking?
Re: Question: How to make text fade after it's been read?
I am not sure that there is a big difference other than length.
You need to open screens.rpy file, find nvl screen and copy/paste the code over the bit that starts with:
Transform can be placed in any file.
You need to open screens.rpy file, find nvl screen and copy/paste the code over the bit that starts with:
Code: Select all
# Display dialogue.- shivanshs9
- Regular
- Posts: 54
- Joined: Sun Jul 20, 2014 1:59 pm
- Projects: The Destiny(http://thedestiny-cxz.blogspot.com)
- Organization: Cyber-X-Zone
- Location: India
- Contact:
Re: Question: How to make text fade after it's been read?
You're awesome, Xela! I was using the same code from Kinsman, but your code's definitely more neat, simple, short and easy to understand! 5 stars for your code!
"Destiny is a no matter of chance
It is a matter of choice
It is not a thing to be waited for
It is a thing to be achieved..."
-William Jennings Bryan
It is a matter of choice
It is not a thing to be waited for
It is a thing to be achieved..."
-William Jennings Bryan
If you can dream and not make dreams your master;
If you can think and not make thoughts your aim,
If you can meet with Triumph and Disaster;
And treat those two impostors just the same,
Only then can you ever win against yourself...
If you can think and not make thoughts your aim,
If you can meet with Triumph and Disaster;
And treat those two impostors just the same,
Only then can you ever win against yourself...
Who is online
Users browsing this forum: Google [Bot], _ticlock_
