What does "expression" do?
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.
What does "expression" do?
I'm really sorry if this is a stupid question, but I cant figure what is the difference between using just "call" or "jump" and using "call expression" or "jump expression". The code I'm using as a guide use expression constantly, so I suppose there must be some function, but even reading INCOUNTABLE TIMES in the official guide I just cant figure out what this actually does. I would REALLY apreciate if somebody could help me. Again, sorry if this is a dumb question. I really don't know where to look for anymore.
- PyTom
- Ren'Py Creator
- Posts: 16093
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: What does "expression" do?
So, normally when you do:
It will jump to the label foo. However, there are times where you want to jump to a label that's been stored in a variable. For example, one that's beenm computed. Take something like:
What this does it sot assign to day_label the strings "start_day_1", "start_day_2", and so on. Then the jump expression statement causes control to transfer to the appropriate label.
Code: Select all
jump foo
Code: Select all
default day = 0
label day_loop:
$ day += 1
"The dawn of day [day]."
$ day_label = "start_day_{}".format(day)
jump expression day_label
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: What does "expression" do?
So the "expression" just allow the variables to be transferred in the jump??
Re: What does "expression" do?
Not “transferred.” “expression” says “I am computing the name of the label you should jump to instead of giving it to you directly.”
Who is online
Users browsing this forum: Google [Bot]