So at the beggining of my game you have to enter your name.
Is there a way to prevent people from writting certain names?
If they writte the name of one of the characters it creates a total confussion on the story.
Name Input restrictions
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.
- Roselia-Thorns
- Regular
- Posts: 27
- Joined: Tue Sep 13, 2016 10:01 pm
- Projects: Undertale: Kissy Cutie
- Tumblr: roseradetea
- itch: roseradetea
- Contact:
- Milkymalk
- Miko-Class Veteran
- Posts: 753
- Joined: Wed Nov 23, 2011 5:30 pm
- Completed: Don't Look (AGS game)
- Projects: KANPEKI! ★Perfect Play★
- Organization: Crappy White Wings
- Location: Germany
- Contact:
Re: Name Input restrictions
Easy.
Code: Select all
label entername:
# enter name here
if name in [charactername1, charactername2, ... ]:
"Another charakter already has this name. Please choose another."
jump entername
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
- Roselia-Thorns
- Regular
- Posts: 27
- Joined: Tue Sep 13, 2016 10:01 pm
- Projects: Undertale: Kissy Cutie
- Tumblr: roseradetea
- itch: roseradetea
- Contact:
Re: Name Input restrictions
I got this error
this is my code
I'm very noob sorry
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 424, in script
python:
File "game/script.rpy", line 429, in <module>
if povname in [Chara]:
NameError: name 'Chara' is not defined
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 424, in script
python:
File "C:\Users\cabal_000\Desktop\renpy\renpy\ast.py", line 814, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "C:\Users\cabal_000\Desktop\renpy\renpy\python.py", line 1695, in py_exec_bytecode
exec bytecode in globals, locals
File "game/script.rpy", line 429, in <module>
if povname in [Chara]:
NameError: name 'Chara' is not defined
Code: Select all
label entername:
python:
povname = renpy.input("How should I call you?", exclude='{}#$%&?¡¿')
povname = povname.strip()
if not povname:
povname = "Toby"
if povname in [Chara, Frisk, Sans, Papyrus]:
"That's not your name"
jump entername
- Milkymalk
- Miko-Class Veteran
- Posts: 753
- Joined: Wed Nov 23, 2011 5:30 pm
- Completed: Don't Look (AGS game)
- Projects: KANPEKI! ★Perfect Play★
- Organization: Crappy White Wings
- Location: Germany
- Contact:
Re: Name Input restrictions
You have to put the names in quotes:
["Chara", "Frisk", "Sans", "Papyrus"]
Also, "jump" can not used inside a Python block.
You are obviously not used to Python or coding in general. If you expect to do anything more than VERY basic Ren'Py stuff, I suggest you read a beginner's guide to Python before you proceed. It's easy stuff, you just need to know it. The same goes for Ren'Py script language: You can't mix it with Python. There are Python equivalents for most Ren'Py statements though, but it's alyways easier to use the script language itself unless you absolutely can't.
["Chara", "Frisk", "Sans", "Papyrus"]
Also, "jump" can not used inside a Python block.
You are obviously not used to Python or coding in general. If you expect to do anything more than VERY basic Ren'Py stuff, I suggest you read a beginner's guide to Python before you proceed. It's easy stuff, you just need to know it. The same goes for Ren'Py script language: You can't mix it with Python. There are Python equivalents for most Ren'Py statements though, but it's alyways easier to use the script language itself unless you absolutely can't.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
- Roselia-Thorns
- Regular
- Posts: 27
- Joined: Tue Sep 13, 2016 10:01 pm
- Projects: Undertale: Kissy Cutie
- Tumblr: roseradetea
- itch: roseradetea
- Contact:
Re: Name Input restrictions
Ok, thanks! Now I understand my problem!
It worked.
It worked.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]