One: The input doesn't match any verbs, so jump to noVerb. This goes to the correct label, but I get a nameError.
Two: The input matches a verb, but it doesn't match a noun, so jump to noNoun. This goes to badCombo instead.
Three: There are matches for the verb and the noun, but there's no label with that name, so jump to badCombo. This also has a nameError.
Four: The inputs are valid and there is a label. This works without issue.
Code: Select all
init python:
verbcount = 0
nouncount = 0
getJump = ""
verbList = ["talk", "wait", "dance"]
nounList = ["sophia", "ground"]
knownVerbs = []
knownNouns = []
cknownVerbs = len(knownVerbs)
cknownNouns = len(knownNouns)
cnounList = len(nounList)
cverbList = len(verbList)
label start:
python:
getJump = ""
verbcount = 0
nouncount = 0
textinput = renpy.input(prompt='What should I do?', default='', allow=None, exclude='{}', length=30, with_none=None, pixel_width=None)
textinput = textinput.lower()
for verb in verbList:
if verb in textinput:
if verb not in knownVerbs:
knownVerbs.append(verb)
break
else:
verbcount = verbcount + 1
if verbcount > len(nounList):
renpy.jump(noVerb)
for noun in nounList:
if noun in textinput:
if noun not in knownNouns:
knownNouns.append(noun)
getJump = verb + "_" + noun
break
else:
nouncount = nouncount + 1
if nouncount > len(nounList):
renpy.jump(noNoun)
if renpy.has_label(getJump):
renpy.jump(getJump)
else:
renpy.jump(badCombo)
label noVerb:
"I become lost in my own thoughts and anxiety. What was I trying to do?"
return
label noNoun:
"I want to [verb], but my mind goes blank when I try to think why."
return
label badCombo:
"I can feel my mind crumbling in on itself."
return
label talk_sophia:
m "Hey, Sophia."
return
label talk_ground:
"I can't bring myself to look at her. I stare at the ground."
m "Sophia..."
return
I know I should be using "call" instead of "jump". I'll change it back once this bug is fixed.