xdb0wx Posted May 16, 2008 Share Posted May 16, 2008 (edited) ===== Post Nº 1 =====Well, I've been making a simple program with a friend or too just to pass around to the computers in school to entertain and I was in the process of debugging when an error occurred. Well, I would select a choice, and it would close. I will show you the code I'm using.@echo offtitle click on this QUIZcolor f0echo WELCOME!echo We, the programmers of the famous "Click on this" have echo created a questionaire to see what YOU the user wants!echo Yes! That's right! YOU! YOU! YOU!echo It's quite simple. And maybe fun?echo All you need to do is answer 5 questions with a 1,2,3,or 4.echo Ready?!echo Lets go! Press any key to begin.pause >nulclsecho Question A. What would you like to see in the next "Click on this"?echo 1. More interactive featuresecho 2. I DON'T WANT TO SEE ANY MORE! IT SUCKS! (?)echo 3. More humor (Is it possible?)echo 4. More interesting featuresset choice=set /p choice=Select a number from above:if not '%choice%'==" set choice=%choice:~0,1%if '%choice%'=='1' goto Aif '%choice%'=='2' goto Aif '%choice%'=='3' goto Aif '%choice%'=='4' goto A:Aecho Question B.I don't see any problem, but of course I'm just a nooby VB2005 programmer (and not that great at all).PROBLEM SOLVED! I changed '%choice%' to '%var%' and I took out "set choice=" and it works perfectly!===== Post Nº 2 =====Well, after a couple gummy worms and some headaches, its COMPLETE!@echo offtitle click on this QUIZcolor f0echo WELCOME!echo We, the programmers of the famous "Click on this" have echo created a questionaire to see what YOU the user wants!echo Yes! That's right! YOU! YOU! YOU!echo It's quite simple. And maybe fun?echo All you need to do is answer 2 questions with a 1,2,3,or 4.echo Ready?!echo Lets go! Press any key to begin.pause >nulclsecho Question A. What would you like to see in the next "Click on this"?echo 1. More interactive featuresecho 2. I DON'T WANT TO SEE ANY MORE! IT SUCKS! (?)echo 3. More humor (Is it possible?)echo 4. More interesting featuresset /p var= Please choose 1,2,3, or 4.if '%var%'=='1.' goto Aif '%var%'=='2.' goto Aif '%var%'=='3.' goto Aif '%var%'=='4.' goto A:Aclsecho You chose option '%var%'pauseclsecho Question B.echo What don't you like about "Click on this"?echo 1. The stupid typing (I personaly hate it.) echo 2. The non-interactiveness (is that a word?)echo 3. The difficulty of use?echo 4. The people who made it....set /p aar= Please choose 1,2,3, or 4.if '%aar%'=='1.' goto Bif '%aar%'=='2.' goto Bif '%aar%'=='3.' goto Bif '%aar%'=='4.' goto B :B clsecho You chose '%aar%'pauseclsEcho Thank you for taking this quiz. echo It will surely aid in our decision making process in "Click on this v2.0"echo.echo..echo...echo....echo...echo..echo. echo Just one more question. set /p bar= If you do not wish to answer the folowing question, type "no" (WARNING: Case sensative so make sure you put "no"if '%bar%' == 'no' GOTO :endif '%bar%' == 'yes' GOTO :C:C cls echo Was this quiz easy to use?set /p dar= Type "yes" or "No"if '%dar%' == 'yes' GOTO Dif '%dar%' == 'no' GOTO D:D:endclsEcho Thank you for taking this quiz.Echo Press any key to exit.pause >nulIt's almost completely bug free! Edited May 16, 2008 by Yzöwl Link to comment Share on other sites More sharing options...
Yzöwl Posted May 16, 2008 Share Posted May 16, 2008 I have made a few changes to your script which I hope may help you a little. They are really methods of making sure that incorrect or inappropriate answers are not given to your questions or that the script isn't mistreated in running.You very likely will not understand it all but with a little research and possibly a few questions you should quickly improve your script thought processes.@Echo offSetlocalTitle Click on this QUIZColor f0Mode 72,12Echo WELCOME!Echo We, the programmers of the famous "Click on this" haveEcho created a questionaire to see what YOU the user wants!Echo Yes! That's right! YOU! YOU! YOU!Echo It's quite simple. And maybe fun?Echo All you need to do is answer 2 questions with a 1,2,3,or 4.Echo Ready?!Echo Lets go!Pause:AClsSet "aar="Echo Question A.Echo What would you like to see in the next "Click on this"?Echo 1. More interactive featuresEcho 2. I DON'T WANT TO SEE ANY MORE! IT SUCKS! (?)Echo 3. More humor (Is it possible?)Echo 4. More interesting featuresSet /p "aar= Please choose 1,2,3, or 4. "If Not Defined aar Goto AIf %aar% Geq 1 (If %aar% Leq 4 ( Cls Echo You chose option '%aar%' Pause Goto B))Goto A:BClsSet "bar="Echo Question B.Echo What don't you like about "Click on this"?Echo 1. The stupid typing (I personaly hate it.)Echo 2. The non-interactiveness (is that a word?)Echo 3. The difficulty of use?Echo 4. The people who made it....Set /p "bar= Please choose 1,2,3, or 4. "If Not Defined bar Goto B If %bar% Geq 1 (If %bar% Leq 4 ( Cls Echo You chose option '%bar%' Pause Goto Next))Goto B:NextClsSet "var="Echo Thank you for taking this quiz.Echo It will surely aid in the "Click on this v2.0" decision making process.Echo..Echo...Echo....Echo.....Echo....Echo...Echo..Echo Just one more question.Set /p "var= Do you wish to answer it? [Yes|No]: "If Not Defined var Goto NextIf /i %var% Equ Yes Goto CGoto End:CClsSet "car="Echo Question C.Set /p "car= Was this quiz easy to use? [Yes|No]: "If Not Defined car Goto CIf /i %car:~0,1% Neq Y ( If /i %car:~0,1% Equ N (Echo Sorry to here that!) Else (Goto C) ) Else (Echo Glad to here it!)Ping -n 4 127.0.0.1>Nul:EndClsEcho Thank you for taking this quiz.Echo Press any key to exit.Pause>NulPS Please use the edit facility to append to your previous post if nobody else has replied since posting it and try to use code tags too! Link to comment Share on other sites More sharing options...
xdb0wx Posted May 17, 2008 Author Share Posted May 17, 2008 Thanks. =) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now