Computer Science Canada

Error Correction Help

Author:  Krocker [ Tue Jan 18, 2011 12:21 pm ]
Post subject:  Error Correction Help

Hiya, im creating a game that involve the users to input numbers. the problem is that when an incorrect character is inputed like a letter or a dash by accident. the game frezes and we have to restart. is there a way to make the game correct the mistake or simply ask the user for the right input if the input was an illegal character? i dont whan them to restart the whole game, but just that section or soemthing. PLEASE HELP and be detail. also can u give me an example too.

Author:  Insectoid [ Tue Jan 18, 2011 12:56 pm ]
Post subject:  RE:Error Correction Help

As the user for a string, then use strintok and strint to either convert it to an int or prompt the user to enter a new value.

Author:  Krocker [ Tue Jan 18, 2011 5:07 pm ]
Post subject:  RE:Error Correction Help

im new at this, so i did not understand wat u said. can u show me an example?

Author:  2goto1 [ Tue Jan 18, 2011 5:11 pm ]
Post subject:  RE:Error Correction Help

Try posting your code that you've created so far. It will be easier for people to help you out.

Author:  Krocker [ Tue Jan 18, 2011 5:15 pm ]
Post subject:  RE:Error Correction Help

the problem is that i dont want ppl to copy the codes so ya

Author:  Tony [ Tue Jan 18, 2011 5:17 pm ]
Post subject:  RE:Error Correction Help

here -- strintok

Author:  Krocker [ Tue Jan 18, 2011 5:45 pm ]
Post subject:  RE:Error Correction Help

ok.. but how would i put that into my game?

Author:  Tony [ Tue Jan 18, 2011 6:00 pm ]
Post subject:  Re: RE:Error Correction Help

Krocker @ Tue Jan 18, 2011 5:45 pm wrote:
ok.. but how would i put that into my game?

Insectoid @ Tue Jan 18, 2011 12:56 pm wrote:
As the user for a string, then use strintok and strint to either convert it to an int or prompt the user to enter a new value.

Author:  Krocker [ Tue Jan 18, 2011 6:20 pm ]
Post subject:  RE:Error Correction Help

u guys ar bot understanding, im not sure how to use the code. how am i suposed to input the code into my game? what am i supposed to write?

Author:  Tony [ Tue Jan 18, 2011 6:32 pm ]
Post subject:  RE:Error Correction Help

I'm not sure what else to tell you. The link to documentation has been posted; and it's been said how it could be applied.

Perhaps you can experiment with different values, to see how the function behaves.

Author:  TokenHerbz [ Tue Jan 18, 2011 6:41 pm ]
Post subject:  RE:Error Correction Help

if strintok (string var) = true then
%%THIS IS AN INT VALUE
else %%ITS FALSE
%%THIS MEANS ITS GOT STRINGS IN IT!
end if

str int ok --string TO INT OK(GOOD?) YES/NO (booleans)

now you know how to use it.

Author:  Krocker [ Tue Jan 18, 2011 6:47 pm ]
Post subject:  RE:Error Correction Help

thats what i needed thx alot!!!!!!1


: