
-----------------------------------
14fenix
Tue Dec 09, 2003 1:30 pm

&quot;Goof Proof&quot;
-----------------------------------
I have been trying to make my program not crash when you accidentally input a string instead of a number ie:


var num: int
put "enter a number"
get num


If the user types in a letter accidentally, you get the iunvalid integer input message. I want the program to loop back to the "enter a number part". Is there anyway I can do so?? I have been messing around with boolean and intstr and strintok and those types of things but I cant get it to work.

-----------------------------------
Dan
Tue Dec 09, 2003 2:57 pm


-----------------------------------
i do think there is an expection system like in java but this should work:


var tempNum : string
var num : int

get tempNum

if strintok (tempNum) then
    num := strint (tempNum)
else
    put "bad input"
end if


strintok test to see if it is posabe to cover a string to an int
strint coverts a sting to an int

so you input it as an int, test to see if is good and if it is covert.

you could trun this in to a while loop to keep on asking for input till vailed one is put in.

P.S. it is idiot proof not goof, lol. see my sig for a good qoute about that  :twisted:

-----------------------------------
DanShadow
Sat Dec 13, 2003 6:54 pm


-----------------------------------
Wow...I wish I had that answer a month ago, I was having a fair amount of problems, tx.

-----------------------------------
Dan
Tue Dec 16, 2003 12:32 pm


-----------------------------------
oh yes the power of strint and intstr is grate, it can even cover dec to bibonary, hex or any other bace. who needs whatdocolor when you have a good old intstr  :twisted:

-----------------------------------
Andy
Tue Dec 16, 2003 8:08 pm


-----------------------------------
wtf? i can do that problem with whatdotcolor anyday... i think...

-----------------------------------
Mazer
Tue Dec 16, 2003 8:55 pm


-----------------------------------
hmm... i'd like to see that one...

-----------------------------------
AsianSensation
Tue Dec 16, 2003 9:27 pm


-----------------------------------
Sure you could, but it's going to take some planning. Just color coordinate each bases to some color. Make sure the color coded are in some kind of mathematical sequence, and then voila, just use whatdotcolor to get the base, convert it, and then display it in the new color, now look at your color chart, and there you go, now you can figure out what number is what.

-----------------------------------
Mazer
Tue Dec 16, 2003 9:32 pm


-----------------------------------
Just color coordinate each bases to some color. Make sure the color coded are in some kind of mathematical sequence, and then voila, just use whatdotcolor to get the base, convert it, and then display it in the new color, now look at your color chart, and there you go, now you can figure out what number is what.
i was actually considering using a system like that to store the account information for Evasive Maneuvers. using pixels and certain colours to code information (even text). i don't know why i didn't, it woulda been really cool.

-----------------------------------
AsianSensation
Tue Dec 16, 2003 10:25 pm


-----------------------------------
cool, that seems like an innovative way of encoding things. And no one would be able to guess it, they all be trying to find out how you encrypted the thing as if you did some stuff with prime numbers or whatnot. Well, there's an idea now for EM 2, if you are ever making one that is.
