SetVariable action ignored?

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.
Post Reply
Message
Author
nananame
Newbie
Posts: 9
Joined: Fri Oct 13, 2017 1:40 pm
Contact:

SetVariable action ignored?

#1 Post by nananame » Sat Oct 14, 2017 1:48 pm

It may be that I'm just really tired but I'm stumped with the following

Code: Select all

screen My_screen
    $variable_name = "Test"
    textbutton _("T") action SetVariable("variable_name","New text"), Return(variable_name)
What should I get as a Return? Cause I keep getting "Test". The SetVariable is ignored....am I just too tired or what?

User avatar
Alex
Eileen-Class Veteran
Posts: 1826
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: SetVariable action ignored?

#2 Post by Alex » Sat Oct 14, 2017 3:05 pm

That happened 'cause your "variable_name" is a screen variable, so you need SetScreenVariable action.
https://www.renpy.org/doc/html/screen_a ... enVariable

nananame
Newbie
Posts: 9
Joined: Fri Oct 13, 2017 1:40 pm
Contact:

Re: SetVariable action ignored?

#3 Post by nananame » Sat Oct 14, 2017 3:27 pm

Nope, still doesn't work... it must be conflicting with something else in the code. Perhaps I should look into retain after load or persistent...

Thanks for the try though.

Post Reply

Who is online

Users browsing this forum: Corynth