Problem with my variables

September 22, 2012 at 21:19:59
Specs: Windows 7
so for my fallout game i am having issues. in each line, there needs to be 12 random characters. Here's what I got, but it isn't working right. And btw, those 12 characters need to be one of the following (!@#$%^&*()_+{}:"<>?[]\;'./,|). Anyway here it is:
set 1d=^! OR ^@ OR ^# OR ^% OR ^$ OR ^% OR ^* OR ^& OR ^* OR ^( OR ^) OR ^_ OR ^- OR ^+ OR ^[ OR ^{ OR ^} OR ^] OR ^\ OR ^| OR ^; OR ^: OR ^" OR ^' OR ^, OR ^< OR ^> OR ^. OR ^? OR ^/
set 2d=^! OR ^@ OR ^# OR ^% OR ^$ OR ^% OR ^* OR ^& OR ^* OR ^( OR ^) OR ^_ OR ^- OR ^+ OR ^[ OR ^{ OR ^} OR ^] OR ^\ OR ^| OR ^; OR ^: OR ^" OR ^' OR ^, OR ^< OR ^> OR ^. OR ^? OR ^/
set 3d=^! OR ^@ OR ^# OR ^% OR ^$ OR ^% OR ^* OR ^& OR ^* OR ^( OR ^) OR ^_ OR ^- OR ^+ OR ^[ OR ^{ OR ^} OR ^] OR ^\ OR ^| OR ^; OR ^: OR ^" OR ^' OR ^, OR ^< OR ^> OR ^. OR ^? OR ^/
set 4d=^! OR ^@ OR ^# OR ^% OR ^$ OR ^% OR ^* OR ^& OR ^* OR ^( OR ^) OR ^_ OR ^- OR ^+ OR ^[ OR ^{ OR ^} OR ^] OR ^\ OR ^| OR ^; OR ^: OR ^" OR ^' OR ^, OR ^< OR ^> OR ^. OR ^? OR ^/
set 5d=^! OR ^@ OR ^# OR ^% OR ^$ OR ^% OR ^* OR ^& OR ^* OR ^( OR ^) OR ^_ OR ^- OR ^+ OR ^[ OR ^{ OR ^} OR ^] OR ^\ OR ^| OR ^; OR ^: OR ^" OR ^' OR ^, OR ^< OR ^> OR ^. OR ^? OR ^/
set 6d=^! OR ^@ OR ^# OR ^% OR ^$ OR ^% OR ^* OR ^& OR ^* OR ^( OR ^) OR ^_ OR ^- OR ^+ OR ^[ OR ^{ OR ^} OR ^] OR ^\ OR ^| OR ^; OR ^: OR ^" OR ^' OR ^, OR ^< OR ^> OR ^. OR ^? OR ^/
set 7d=^! OR ^@ OR ^# OR ^% OR ^$ OR ^% OR ^* OR ^& OR ^* OR ^( OR ^) OR ^_ OR ^- OR ^+ OR ^[ OR ^{ OR ^} OR ^] OR ^\ OR ^| OR ^; OR ^: OR ^" OR ^' OR ^, OR ^< OR ^> OR ^. OR ^? OR ^/
set 8d=^! OR ^@ OR ^# OR ^% OR ^$ OR ^% OR ^* OR ^& OR ^* OR ^( OR ^) OR ^_ OR ^- OR ^+ OR ^[ OR ^{ OR ^} OR ^] OR ^\ OR ^| OR ^; OR ^: OR ^" OR ^' OR ^, OR ^< OR ^> OR ^. OR ^? OR ^/
set 9d=^! OR ^@ OR ^# OR ^% OR ^$ OR ^% OR ^* OR ^& OR ^* OR ^( OR ^) OR ^_ OR ^- OR ^+ OR ^[ OR ^{ OR ^} OR ^] OR ^\ OR ^| OR ^; OR ^: OR ^" OR ^' OR ^, OR ^< OR ^> OR ^. OR ^? OR ^/
set 10d=^! OR ^@ OR ^# OR ^% OR ^$ OR ^% OR ^* OR ^& OR ^* OR ^( OR ^) OR ^_ OR ^- OR ^+ OR ^[ OR ^{ OR ^} OR ^] OR ^\ OR ^| OR ^; OR ^: OR ^" OR ^' OR ^, OR ^< OR ^> OR ^. OR ^? OR ^/
set 11d=^! OR ^@ OR ^# OR ^% OR ^$ OR ^% OR ^* OR ^& OR ^* OR ^( OR ^) OR ^_ OR ^- OR ^+ OR ^[ OR ^{ OR ^} OR ^] OR ^\ OR ^| OR ^; OR ^: OR ^" OR ^' OR ^, OR ^< OR ^> OR ^. OR ^? OR ^/
set 12d=^! OR ^@ OR ^# OR ^% OR ^$ OR ^% OR ^* OR ^& OR ^* OR ^( OR ^) OR ^_ OR ^- OR ^+ OR ^[ OR ^{ OR ^} OR ^] OR ^\ OR ^| OR ^; OR ^: OR ^" OR ^' OR ^, OR ^< OR ^> OR ^. OR ^? OR ^/
set /A D=1d += 2d += 3d += 4d += 5d += 6d += 7d += 8d += 9d += 10d += 11d += 12d
ECHO.
ECHO.
ECHO LINE 1 %D% LINE 13 %D% %Q%
ECHO.
ECHO LINE 2 %D% LINE 14 %D% %Q%
ECHO.
ECHO LINE 3 %D% LINE 15 %D% %Q%
ECHO.
ECHO LINE 4 %D% LINE 16 %D% %Q%
ECHO.
ECHO LINE 5 %D% LINE 17 %D% %Q%
ECHO.
ECHO LINE 6 %D% LINE 18 %D% %Q%
ECHO.
ECHO LINE 7 %D% LINE 19 %D% %Q%
ECHO.
ECHO LINE 8 %D% LINE 20 %D% %Q%
ECHO.
ECHO LINE 9 %D% LINE 21 %D% %Q%
ECHO.
ECHO LINE 10 %D% LINE 22 %D% %Q%
ECHO.
ECHO LINE 11 %D% LINE 23 %D% %Q%
ECHO.
ECHO.
ECHO.

See More: Problem with my variables

Report •


#1
September 23, 2012 at 00:54:03
"there needs to be 12
random characters"

Separated by spaces? or what?


====================================
Life is too important to be taken seriously.

M2


Report •

#2
September 23, 2012 at 09:26:40
no spaces. http://img.ehowcdn.com/article-new/... is what it will look like. all random generated characters. there will also be 8 random words mixed in but ima start by just figuring out how to generate 12 random characters per line w/o spaces. do u know how to do this?

Report •

#3
September 23, 2012 at 09:40:10
http://www.youtube.com/watch?v=zBCY... here is what the actual batch is suppose to replicate when i am done...

Report •

Related Solutions

#4
September 23, 2012 at 11:50:17
Given the system-sensitive nature of the collection of characters you want, you will beat yourself to death trying to do this with batch. It may be possible, but it will be VERY frustrating and take years of work (I've tried it). I highly recomment switching to another language or vbscript. Here's the idea (pseudocode sort of):
x="(!@#$%^&*()_+{}:"&chr(34)&"<>?[]\;'./,|)."
xl=len(x)
for j=1 to 11
line=""
for i=1 to12
line=line&mid(x,rand(len(x)),1)
next i
print line
next j

Report •

#5
September 25, 2012 at 09:39:03
I see that you posted a new topic. I am posting to this one to keep the other unanswered in case someone gets it better than I do.

It looks like it displays what you were looking for(spacing is wonky looking?).

The question is: What did you want to do when the user types in the variable m?
If you want it to post an error and reset: then add a goto at the end, and a counter at the top aka you have 4 attempts left, then 3, then 2. then 1 when it reaches 1 add a kill option to lock the system.)

This could be accomplished by
setting a variable to equal 4(set /a count=4), and then using it at the beginning of the program, followed by a :begins

Then at the end of the program you can decrease the count (set /a count=count-1) and add a goto begins

then an if statement if count lss 1 then echo what ever your warning is.

If it is something else, please make it a bit more specific. I dont know if you are trying to actually make a password comparison in the set, however, I didn't see it. Based on the coding I would say you intend failure.

:: mike


Report •

#6
September 26, 2012 at 18:35:02
Hey thanks for this response.
I just finished the user input code yesterday. I have it so that it checks the input and compares it to the password and if they aren't the same it sets a variable named tries to tries -1 and only allows you to make an input if variable tries > 0. so it is pretty much what your describing in your post. although, i did find something in your post i should impliment. That is the goto begin part after subtracting a try in order to keep it in that loop until you run out of tries. thanks a lot for that idea!!

Report •

#7
September 26, 2012 at 18:38:26
My code for that part is (i got it commented out because i didn't think it was time to impliment it yet into the rest of the program)

rem user input
rem set /a _tries=4
rem set /p _try:
rem IF %_try%==%_pass% GOTO nextscreen
rem IF %_try%==%_gdud% set /a %_tries%=%_tries%+1 & set /a %_pdud%=%_pdud%+1
rem IF %_try%==%_neither% set /a %_tries%=%_tries%-1
rem IF %_tries% EQU 0 goto :termlock

rem termlock is what happens if you run out of tries. the terminal locks
rem if user input is == %_pass% then goto next screen ELSE if user input isn't == %_pass% set /a _tries=%_tries%-1
rem if %tries% > 4 set tries=4


Report •


Ask Question