Xavimat's code:
Code: Select all
# Reply and Reply2
# by xavimat (cc-by, 2013)
# inspired by fiorica's "The Doll's Stories" and SusanTheCat's "Thera'Py"
# improved with help of jw2pfd
init python:
def reply(question = "Yes or no?",
answers = "yes,no",
invalid_character = None,
invalid_answer = "(Invalid answer)",
show_answers = False):
thequestion = question
found_it = ""
ans = answers.replace(" ", "")
ans = ans.split(",")
if show_answers:
thequestion += " {size=-10}("
for element in ans:
thequestion += element + ', '
thequestion = thequestion[:-2] + "){/size}"
while found_it == "":
phrase = renpy.input(thequestion)
phrase = phrase.lower()
for chara in ',.;:!?-+*()[]{}&%$':
phrase = phrase.replace(chara, ' ')
phras = phrase.split()
for element in ans:
for theword in phras:
if found_it == '' and element == theword:
found_it = element
if found_it == "":
found_it = "WRONG"
return found_itCode: Select all
label naming:
$ player_name = renpy.input("What is my name?")
$ player_name = player_name.strip()
if player_name == "":
jump naming
else:
play sound "pong.wav"
hide youCode: Select all
"Note: Input your name in the EXACT form that you entered in the beginning."
$ r = reply("What is your name?", "[player_name]")
if r == "[player_name]":
$ Kyo += 1
show kyo smile
kyo "*laughs* Sorry, sorry. {w}I was just kidding with you."
elif r == "WRONG":
$ renpy.block_rollback()
show kyo urgh
kyo "... ..."I don't know where I went wrong...
*Completely lost now*
Thank you so much for reading this/replying!
