I Need This Working A Batch Spelling

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
NiceNickeyBoot
Posts: 1
Joined: 19 Apr 2010 20:42

I Need This Working A Batch Spelling

#1 Post by NiceNickeyBoot » 19 Apr 2010 20:46

:: Created by Nickolas

@echo off
title Spelling!
cd TalkingFolder
color 0f
:Reset
set spellingw1=ok
set spellingw2=compact
set spellingw3=connect
set spellingw4=conservation
set spellingw5=converge
set spellingw6=transform
set spellingw7=translate
set spellingw8=interrupt
set spellingw9=interstate
set spellingw10=interjection
set spellingw11=committee
set spellingw12=compete
set spellingw13=confident
set spellingw14=constitution
set spellingw15=transaction
set spellingw16=transfuse
set spellingw17=transport
set spellingw18=intermission
set spellingw19=intersection
set spellingw20=conquer
set level=0
set play=0
set Spell = error
:Play
echo This Program Is Made By NiceNickey! (Nickolas)
echo.
echo Wanna Play
echo Notice All Words Needs To Be
echo LOWER CASE and HAVE NO SPACES
echo.
echo If The Word Has Spaces Then Do Not Put A Space Put A _ For A Space
echo (Hit any key)
pause>nul
cls
goto SpellingALL

:SpellingALL
cls
set /a level=%level:~0,4%+1
set /a play=%play:~0,4%+1
if %play%==21 set play=1
echo Spelling Word %play% And Level %level%
call Spelling%play%
echo Type What The Computer Saied
set /p Spell=""
if %Spell%==%spellingw%%play% goto SpellingALL
echo You Have Lost
pause>nul
:Score
cls
set /p Name="Name To Save Score =D >"
echo %Name% Was Level %level% >> Score.txt
echo Replay?
pause>nul
goto Reset


















Every time it says you lost but its supposed to do stuff

jeb
Expert
Posts: 1055
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: I Need This Working A Batch Spelling

#2 Post by jeb » 19 Apr 2010 22:14

Hi NiceNickeyBoot,

I suppose the problem is the line

Code: Select all

if %Spell%==%spellingw%%play% goto SpellingALL


This expands to (if you type "OK")

Code: Select all

if OK==1 goto SpellingALL

because %spellingw% expands to nothing

You should try this

Code: Select all

if "%Spell%"=="!spellingw%play%!" goto :SpellingALL


and at the second line in your batch

Code: Select all

SETLOCAL EnableDelayedExpansion 


This works, because first the %play% expands to the number, then the !spellingw1! expands to OK

The "" are used to allow empty strings or strings with spaces

jeb

Post Reply