Solved Sentinel Number being skipped

September 14, 2016 at 07:36:44
Specs: Windows 10
I'm trying to use a loop to copy ten thousand of a .dds file in order to find some user content items in a game known as Pirates of the Burning Sea. My script with which I intend to accomplish this is skipping my sentinel values to break out of each loop, however.

:start
@ECHO off
SET var=2
SET endvar=89453
ECHO %var%


:copy
COPY "C:\Users\Owner\Documents\Pirates of the Burning Sea\usercontent\image1_.dds" "C:\Users\Owner\Documents\Pirates of the Burning Sea\usercontent\uc_%var%.dds"
ECHO %var%
SET /A var=%var% + 1
IF %var%==10000 goto secondcopy
goto copy

:secondcopy
COPY "C:\Users\Owner\Documents\Pirates of the Burning Sea\usercontent\image2_.dds" "C:\Users\Owner\Documents\Pirates of the Burning Sea\usercontent\uc_%var%.dds"
ECHO %var%
SET /A var=%var% + 1
IF %var%==20000 goto thirdcopy
goto copy

:thirdcopy
COPY GAMEPATH GAMEPATH
ECHO %var%
SET /A var=%var% + 1
IF %var%==30000 goto fourthcopy
goto copy

:fourthcopy
COPY GAMEPATH GAMEPATH
ECHO %var%
SET /A var=%var% + 1
IF %var%==40000 goto fifthcopy
goto copy

:fifthcopy
COPY GAMEPATH GAMEPATH
ECHO %var%
SET /A var=%var% + 1
IF %var%==50000 goto sixthcopy
goto copy

:sixthcopy
COPY GAMEPATH GAMEPATH
ECHO %var%
SET /A var=%var% + 1
IF %var%==60000 goto seventhcopy
goto copy

:seventhcopy
COPY GAMEPATH GAMEPATH
ECHO %var%
SET /A var=%var% + 1
IF %var%==70000 goto eighthcopy
goto copy

:eighthcopy
COPY GAMEPATH GAMEPATH
ECHO %var%
SET /A var=%var% + 1
IF %var%==80000 goto ninethcopy
goto copy

:ninethcopy
COPY GAMEPATH GAMEPATH
ECHO %var%
SET /A var=%var% + 1
IF %var%==90000 goto end
goto copy

:end
PAUSE

I have omitted the gamepath for privacy reasons.


See More: Sentinel Number being skipped

Report •

#1
September 14, 2016 at 08:49:08
Hard tellin' not knowin' what sentinel value means.
Nor why endvar is set but never used.

There's plenty of lost motion & commotion to weed out but we'll get to that when we get to it.

=====================

M2 Get custom script or take private lessons


Report •

#2
September 14, 2016 at 09:53:26
✔ Best Answer
A sentinel value is some condition you're watching for, typically to break out of a loop. For instance, in
:loop
REM Work goes here
IF NOT EXIST some.file GOTO loop
your sentinel value would be the existence of "some.file".

NightOwlKOJ:
When you're trying to figure out what your script is doing, leave your ECHO on. Just quickly scanning your script, it looks like when %var%==10000, you jump to :secondcopy. You then add 1 to %var%, check to see if IF %var%==20000, it doesn't (%var%==10001), so you jump back to the inital :copy, where you keep incrementing %var% and checking to see if %var%==10000 again.

How To Ask Questions The Smart Way

message edited by Razor2.3


Report •
Related Solutions


Ask Question