Action If and if statement

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
ReAnimator
Regular
Posts: 67
Joined: Mon Dec 16, 2013 1:00 pm
Contact:

Action If and if statement

#1 Post by ReAnimator »

Code: Select all

timer 0.1 action If(x, Function(a), None) repeat True
and

Code: Select all

if x:
	timer 0.1 action Function(a) repeat True
These two are the same thing? If so which one is preferable?
The latter one saves the resource more?

User avatar
m_from_space
Miko-Class Veteran
Posts: 957
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Action If and if statement

#2 Post by m_from_space »

First method:
- timer is called every 0.1 seconds, even if x is not True

Second method:
- timer is called every 0.1 seconds, only after x is True

Second method is preferable.

By the way, you don't have to include "None" inside the If() function, the False statement is None by default.

ReAnimator
Regular
Posts: 67
Joined: Mon Dec 16, 2013 1:00 pm
Contact:

Re: Action If and if statement

#3 Post by ReAnimator »

Thanks for clarification! Much appreciated!

Post Reply

Who is online

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