How to know first letter of renpy.input?

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
EternalVoid
Newbie
Posts: 10
Joined: Thu Oct 15, 2020 9:59 am
Soundcloud: DivinePlane
Contact:

How to know first letter of renpy.input?

#1 Post by EternalVoid » Wed Sep 29, 2021 2:46 pm

Ok, so I want to check the first letter of an input. So if for example I write ",commandhere" then it does something, but if it starts with "," but has something else behind I want to put an error message like "Unknown command" or something.

If I haven't explained myself good enough please tell me so I can explain it the best I can.

Please help!

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: How to know first letter of renpy.input?

#2 Post by hell_oh_world » Wed Sep 29, 2021 9:01 pm

If you're familiar with lists, strings are pretty much like a list (a list of characters), and just like any other list, you can access its elements by indices.

EternalVoid
Newbie
Posts: 10
Joined: Thu Oct 15, 2020 9:59 am
Soundcloud: DivinePlane
Contact:

Re: How to know first letter of renpy.input?

#3 Post by EternalVoid » Thu Sep 30, 2021 10:09 am

Even though it's useful, i meant knowing what the first character is (for example "a" in "animal")

EternalVoid
Newbie
Posts: 10
Joined: Thu Oct 15, 2020 9:59 am
Soundcloud: DivinePlane
Contact:

Re: How to know first letter of renpy.input?

#4 Post by EternalVoid » Thu Sep 30, 2021 10:25 am


Post Reply

Who is online

Users browsing this forum: No registered users