我有一个简单的代码块。所有变量之前都已定义。它所做的是要求输入 1-4,并根据响应检查某些变量是否处于特定水平。如果满足条件,它将根据发生的情况返回一个场景。以下摘录证明了这一点。不管你选择什么,它似乎总是会返回and was unexpected at this time.
set /p choice="By whom do you sit (1-4)? "
if !choice! GTR 4 echo Please enter a valid number. && goto thehogwartsexpress
if !choice! LSS 1 echo Please enter a valid number. && goto thehogwartsexpress
if "!choice!" EQU "1" (
echo It was an interesting ride. You find out their names are Fred and George Weasley, second-years who enjoy gags and jokes. You tell them your name is !char_name!.
if !char_ilvl! GTR 1 (
echo You think they're slackers, but then again, they seem friendly.
if !char_clvl! GTR 1 echo You talk to them occasionally throughout the ride. You've entered their frame of trust. You buy scrumptious delights from the witch's carriage. Character + 1. && set /a char_char=char_char+1
if !char_clvl! EQU 0 echo You smirk at a few of their jokes and talk once or twice, but no more.
echo [press enter]
pause>nul
goto hogwartsschoolarrival
) else (
if !char_clvl! GTR 1 echo You all jester around and get to know each other. Looks like you've made two new friends for life. Character + 1. && set /a char_char=char_char+1
if !char_clvl! EQU 0 echo You laugh a bit at their jokes and try to talk a bit. They think you're cool. Character + 1. && set /a char_char=char_char+1
echo [press enter]
pause>nul
goto hogwartsschoolarrival
)
) else if "!choice!" EQU "2" (
if "!char_gen!" EQU "male" (
if !char_rlvl! GTR 1 echo You introduce yourself as !char_name!, unveiling that their names are Angelina Johnson (black female) and Katie Bell (brunette). You easily become friends with the two. Charisma + 1. && set /a char_risma=char_risma+1
if !char_rlvl! LSS 2 echo You sort of talked to them. Nice attempt. They like you, but they don't like you enough. Keep trying.
echo [press enter]
pause>nul
goto hogwartsschoolarrival
) else (
if !char_clvl! GTR 1 echo You introduce yourself as !char_name!, unveiling that their names are Angelina Johnson (black female) and Katie Bell (brunette). You talk to them intently throughout the ride. They talk about Hogwarts and show you a bit of the ropes. Character + 1. && set /a char_char=char_char+1
if !char_clvl! LSS 2 echo You smiled at each other once or twice, but no more.
echo [press enter]
pause>nul
goto hogwartsschoolarrival
)
) else if "!choice!" EQU "3" (
if !char_ilvl! LSS 2 (
if !char_rlvl! GTR 2 echo You tried to talk to him, but to no avail. He simply glared at you, made a soft gag reflex and stared back out the window solemnly.
if !char_rlvl! LSS 3 echo You talked not once.
echo [press enter]
pause>nul
goto hogwartsschoolarrival
) else (
echo You sit opposite to him, not saying a word. You plan to keep to yourself, pulling out your edition of "Magical Drafts and Potions," reading page 327. After seven minutes, you notice out of peripheral vision that he looked at you intently. You ignored him. "And what would your name be?" he said in a low, monotonous voice. "!char_name!," you say in the monotonous voice of your own. "Well, you appear to be of some hope for the new students. My name is Severus Snape, your potions teacher," he began with a sharpness in his voice. "I expect to see you in class. Don't disappoint me." With that, you both returned to your own heads. Congratulations, you managed to make friends with one of the most feared teachers in the school. Do well in his class.
echo [press enter]
pause>nul
goto hogwartsschoolarrival
)
) else if "!choice!" EQU "4" (
echo You wonder what Hogwarts will be like.
echo [press enter]
pause>nul
goto hogwartsschoolarrival
)