Defining a variable from another variable

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
Luxee
Newbie
Posts: 13
Joined: Mon May 21, 2018 5:02 pm
Projects: Parental Love, Apartment #69
Contact:

Defining a variable from another variable

#1 Post by Luxee »

Seems like a silly thing. But for some reason, I can't figure out how to define variable "01checkday" as the value of variable "day"

I need to remember what day the player was on during this particular event. And although this seems like it would be really easy to code, I simply can't figure it out.
Here's what I've tried

Code: Select all

    $ 01checkday = day

Code: Select all

    $ 01checkday = "[day]"

Code: Select all

    $ 01checkday = [day]
But every single one of these gives me a syntax error. I feel like the answer to this is going to be really obvious and I'm going to feel dumb. But I'd love some help either way

Thanks.

rames44
Veteran
Posts: 233
Joined: Sun May 29, 2016 4:38 pm
Contact:

Re: Defining a variable from another variable

#2 Post by rames44 »

Variable names cannot start with a digit. (That's a Python rule.)

Code: Select all

    $ checkday01 = day
should work.

Luxee
Newbie
Posts: 13
Joined: Mon May 21, 2018 5:02 pm
Projects: Parental Love, Apartment #69
Contact:

Re: Defining a variable from another variable

#3 Post by Luxee »

Ah damn, I feel like I did know this. Just always forget. Thanks either way. It works now.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]