Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 01-30-2011, 10:53 PM   #1
Baseband Member
 
Chamblin's Avatar
 
Join Date: Jul 2009
Posts: 34
Send a message via MSN to Chamblin Send a message via Yahoo to Chamblin
Default New To ComputerForums Saying Hello With A Script.

Hello everyone, Im new to the computer forums and new to scripting. I've just started Basic programming in my computers class. I was messing around and wrote this little code just to get my fingers wet and to start learning the fundamentals of coding and such. I know its not much but Im just learning so look at my code please and tell me what you think?

COLOR 2, 0
CLS

DIM color1 AS STRING
DIM white AS STRING
DIM background AS STRING
DIM black AS STRING
DIM dakota AS STRING
DIM animal AS STRING
DIM math AS STRING




PRINT "Hello"
SLEEP 1

PRINT "We Are Going To Do A Quiz"
SLEEP 1
PRINT "Lets See How Many Questions You Can Get Right Out Of 5."
SLEEP 2

PRINT "Here We Go."
SLEEP 1
CLS


Question1:
PRINT ""
INPUT "What Is The Color Of A White Sword"; color1
IF color1 = "white" THEN
PRINT "Very Good Question 1 of 5 Correct."
SLEEP 2
ELSE
PRINT "Sorry Try Again"
SLEEP 2
GOTO Question1:
END IF
PRINT ""
Question2:
PRINT "Question 2"
INPUT "What Color Is The Background On This Screen"; background
IF background = "black" THEN
SLEEP 2
PRINT "Very Good Question 2 of 5 Correct."
ELSE
SLEEP 2
PRINT "Sorry Go Back To Question 1"
GOTO Question1:
END IF
PRINT ""

Question3:
PRINT "Question 3"
SLEEP 1
INPUT "Who Was President When World War 2 Started"; dakota
SELECT CASE dakota$
CASE "franklin d roosevelt"
PRINT "Right Again Question 3 of 5 Correct."
SLEEP 2
CASE "fdr"
PRINT "Right Again Question 3 of 5 Correct."
SLEEP 2
CASE "franklindroosevelt"
PRINT "Right Again Question 3 of 5 Correct."
SLEEP 2
CASE ELSE
PRINT "Wrong Answer Back To Question 1"
GOTO Question1:
END SELECT

PRINT ""


Question4:
PRINT "Question 4"
SLEEP 1
INPUT "What Is The Fastest Animal In The World"; animal
IF animal = "cheetah" THEN
SLEEP 1
PRINT "Good Job Question 4 of 5 Correct."
ELSE
SLEEP 1
PRINT "Sorry Try Again"
GOTO Question1
END IF

PRINT ""

Question5:
PRINT "Question 5"
SLEEP 1

INPUT "If You Have 1000 Dollars And You Add 40 To it. Now Add Another 1000. Now add 30 Plus Another 1000. Now Add 20. Now add Another 1000. Now Add 10 How Much Do You Have."; math
IF math = "4100" THEN
PRINT ""
PRINT "Congradulations You Completed The Test."
ELSE PRINT "Sorry Go Back To Question 1"
GOTO Question1:
END IF
SLEEP
__________________

Chamblin is offline   Reply With Quote
Old 01-30-2011, 11:00 PM   #2
Baseband Member
 
Shazer2's Avatar
 
Join Date: May 2009
Posts: 89
Default Re: New To ComputerForums Saying Hello With A Script.

Please use [code] tags.
__________________

__________________
Need some PHP questions answered? Give me a PM and I will see what I can do.
Shazer2 is offline   Reply With Quote
Old 01-30-2011, 11:05 PM   #3
Baseband Member
 
Chamblin's Avatar
 
Join Date: Jul 2009
Posts: 34
Send a message via MSN to Chamblin Send a message via Yahoo to Chamblin
Default Re: New To ComputerForums Saying Hello With A Script.

What?
Chamblin is offline   Reply With Quote
Old 01-31-2011, 07:25 AM   #4
In Runtime
 
Join Date: Jan 2010
Posts: 320
Default Re: New To ComputerForums Saying Hello With A Script.

I suppose you have the thinkings / ideas around what you want to do.. Its ok to start with! Just a few little general pointers, to help it read better, try spacing your code out on each line, this also helps when you go back and check for errors in your code. E.G:


Question3:
PRINT "Question 3"
...SLEEP 1
.....INPUT "Who Was President When World War 2 Started"; dakota
.......SELECT CASE dakota$
......CASE "franklin d roosevelt"
....PRINT "Right Again Question 3 of 5 Correct."
...SLEEP 2
.....CASE "fdr"
.......PRINT "Right Again Question 3 of 5 Correct."
...SLEEP 2
.....CASE "franklindroosevelt"
.......PRINT "Right Again Question 3 of 5 Correct."
...SLEEP 2
CASE ELSE
...PRINT "Wrong Answer Back To Question 1"
GOTO Question1:
END SELECT

PRINT ""


This isnt a great example (take out the dots with spaces) - but now you can clearly see the 'bits inbetween' the 'sleep' sections. It makes it so you can find parts of your code easier and edit them easier. Two other points, I would have a read up about Wildcards symbols, if you are asking people to enter text / answers, and also consider reading up about adding comments to your code, especially if it starts to get much longer.

Quote:
Please use [code] tags.
The above poster means when you are putting code, wrap it in a
Code:
 Code
tag so its a little easier for us to see - you can see proper spacing - and also complies with the forum posting rules
Luke_Uk_Baggy is offline   Reply With Quote
Old 01-31-2011, 11:35 PM   #5
Baseband Member
 
Chamblin's Avatar
 
Join Date: Jul 2009
Posts: 34
Send a message via MSN to Chamblin Send a message via Yahoo to Chamblin
Default Re: New To ComputerForums Saying Hello With A Script.

I see thanks for the tips, every bit helps.
Chamblin is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 04:23 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0