Serching strings

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
User avatar
Posts: 56
Joined: Thu Feb 25, 2010 9:22 pm
Projects: Demon Lord & Yuki Academy
Deviantart: Sehad
Location: Sweden

Serching strings

#1 Post by Sehaf » Thu Nov 30, 2017 5:52 pm

Hi simple question really, but found no answers in search.

When the player is alowed to enter any text, I can check the text for key words

Code: Select all

if "Lego" in yc:
    p "LotR fan are you?"
Like so...

My question is, how do I have it check without bothering with if its capslock or not?


Code: Select all

if "Lego" of "lego" in yc:
    p "LotR fan are you?"
But then it trigered no mather what I wrote.
I'm a GameMaker!
My Portfolio:

Posts: 163
Joined: Wed Nov 08, 2017 4:32 pm
Projects: HSS

Re: Serching strings

#2 Post by Errilhl » Fri Dec 01, 2017 7:38 am

Code: Select all

if "LEGO" in yc.upper():
if "lego" in yc.lower():
Basically, what you do is not checking for either lower or upper, but matching the content of the word against a uniform string, regardless of capitalisation.
Currently working on: Image

Post Reply

Who is online

Users browsing this forum: No registered users