So I have this script. It's supposed to check if the input (%skiller%) is in the variable %tree%. So if I input Sword, it'll look for the string "Sword" in the variable %tree%. The tree value is "Sword Shield". Afterward, it checks the variable %skillsunlocked% to see if it has the input. If it has the input, it'll say "You already unlocked it!". Strange thing is, when I input "Sword" it always says "You already unlocked Sword", even though %skillsunlocked% has no value. If I input "Mace", which isn't in the %tree% variable, it goes back to :FUNC, which is the intended behaviour. But when I input "Sword", it always says I unlocked Sword, even though %skillunlocked% does not contain Sword.
Code: Select all
:FUNC
set skillsunlocked="
set "tree=Sword Shield"
set /p skiller="Enter skill..."
echo.%tree% | findstr /C:"%skiller%" 1>nul
if "%errorlevel%" == "0" (
echo.%skillsunlocked% | findstr /C:"%skiller%" 1>nul
if "%errorlevel%" == "0" (
echo You already unlocked %skiller%^^!
pause
GOTO :FUNC
)
) else (
GOTO :FUNC
)
I thought maybe a blank variable was throwing it off, so I tried adding skillsunlocked=None, but it still behaved the same. The first findstr works, while the second one doesn't. Any hints or thoughts?