Public Group

QB scoring problem

This topic is 4834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Here is my source: ( If any HTML shows, ignore it.) <htmL> <body> <title> QB Help</title> "CLS DIM score$PRINT" Welcome to TS2Trivia/TS2U Trivia .47!" INPUT " Whate website can you get TheSims2 Enhancer from "; TS2E$ ' Select the variable SELECT CASE TS2$CASE "sims2programs.com" LOCATE 12, 16 PRINT "SCORE:"; PRINT score$ + "1" END SELECT Then I add another question but when I answer correct it is still 1. Do I need to make an array? What can I do? Please help." </html> </body>

Share on other sites
Quote:
 Original post by fuchuINPUT " Whate website can you get TheSims2 Enhancer from "; TS2E$SELECT CASE TS2$

Shouldn't TS2$be TS2E$?

This is one of the(many) problems with QB. You can just create variables anywhere so typos then go unnoticed.

Share on other sites
Well that isn't exactly the main one. But no, I know that wasn't my problem. Thanks.

Share on other sites
You know, you can specify OPTION EXPLICIT in QB so that you have to declare variables before you use them. Here's an example:
'beginning of programprint "this is a variable", x

That is perfectly valid QB(and FB) code, but x will always be 0 unless you initialize it. However, if you want to use OPTION EXPLICIT, you cannot use a variable without declaring it first. So, this:
option explicit'beginning of programprint "this is a variable", x

would be invalid and you would get an error. You would have to make it this:
option explicitdim x as integer x = 0'beginning of programprint "this is a variable", x

for that to work. So that's one remedy for a QB problem.

Share on other sites
I remember the option explicit command from php, which I stilll need to learn better. I hope that helped me. Thanks.

Share on other sites
PRINT "SCORE:"; PRINT score$+ "1" The above line doesn't actually increment the score$ variable. To actually increment the variable, you should type:

PRINT "SCORE:"
score$= score$ + 1

• 9
• 10
• 9
• 48
• 12
• Forum Statistics

• Total Topics
631387
• Total Posts
2999712
×