Ren'Py There is any if condition like [if not]?

Xenorav

Newbie
Game Developer
Sep 30, 2020
24
2,432
what I mean is if there is any way to create an if condition like for example:

$ example = "example1"

if example (are not) "example2":
jump example3

sorry if it's a stupid question, I'm new to renpy / python.
 

Loomenaro

New Member
Oct 5, 2018
11
12
I haven't used renpy, but if it is just python either

if example != "example2":
or
if not example == "example2":
should work.
 
  • Red Heart
Reactions: Xenorav

cooperdk

Engaged Member
Jul 23, 2017
3,375
4,911
It is Python, but Renpy only uses v2.7 as far as I remember. They have dropped development and support for it (and it is not safe to use anymore!).
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,170
14,886
It is Python, but Renpy only uses v2.7 as far as I remember.
Ren'py is switching to 3.x but obviously it need time.


They have dropped development and support for it (and it is not safe to use anymore!).
It's a language, the security threats aren't this numerous and rarely related to the language itself ; among the 23 advisories edited for Python 2.7, less than 10% effectively affected Ren'py.
Anyway the simple fact to play a Ren'py game represent more risks than the now lack of security support for Python 2.7.
 

cooperdk

Engaged Member
Jul 23, 2017
3,375
4,911
Ren'py is switching to 3.x but obviously it need time.

It's a language, the security threats aren't this numerous and rarely related to the language itself ; among the 23 advisories edited for Python 2.7, less than 10% effectively affected Ren'py.
Anyway the simple fact to play a Ren'py game represent more risks than the now lack of security support for Python 2.7.
It needs time ... but Python 3 was introduced twelve years ago! Even Python 3.5 is five years old.

There are vast differences from 2.7 to 3, including much higher speed, better runtime compilation and I don't even know where to begin...

As a built in interpreter, it will increase the safety of the application a great deal, and there are very few programmatic differences that would not take long to update - fx, the old print statement

print "Here I go"

is now

print("Here I go")

Most changes are on this level and don't require much adjustment.

The user might not see much of a difference, but much faster startup times and better speed is guaranteed.
 

cooperdk

Engaged Member
Jul 23, 2017
3,375
4,911
IF NOT... why i didn't tryed that?, thanks so much man!.
Don't use that, use

if example != "example2"

because the interpreter will spend more resources to handle the "if not". If you log bytecode execution you will see the difference.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,170
14,886
It needs time ... but Python 3 was introduced twelve years ago!
And therefore after Ren'py started.
As long as Python 2.x was still in development, there were no need to switch to Python 3.x. Especially since Ren'py had first to wait for PyGame to be ported on Python 3.x, what only happened 8 years ago.
Then as long as it was maintained, the transition have been done slowly with the help of __future__.


Most changes are on this level and don't require much adjustment.
"Most" don't mean all.

Python 3.x was developed in parallel of Python 2.x for a very good reason : They decided to break the backward compatibility in the core of the interpreter.
And since they were going this far, already rid of the said backward compatibility, they jumped on the occasion to fix some issues with, among other things, some of the build-in function, changing either their arguments or part of their behavior.
Thinking that there just few syntax changes to do, and that your Python 2.x code will works with Python 3.x is an illusion ; especially for an application as complex as Ren'py with more than 400 000 lines, and that need to works on three different OSes, and now in top of that two different architectures for each OSes.


But all this said, what exactly is the purpose of your comment ? I'm not PyTom, and I doubt that he come here.