Omnimaga
Calculator Community => TI Calculators => TI-BASIC => Topic started by: rcfun92 on April 29, 2013, 10:45:18 pm
-
Hello,
So I wanted to ask my friend to prom using my calculator because we are in the same math class and I thought it would be cute. I was trying to create a program but for some reason its not working. If you can debug it that would be great:
Input,"Prom ? (Yes/No)",A
If A = "Yes"
Then
Disp "Yay!"
Else
Disp " :("
End
Thank You,
Roger
-
I'm not an expert at Basic, but I'm not sure if you can compare words/strings that easily :/
The Menu() command might be of use here.
:Menu("Prom?","Yes",1,"No",2)
:Lbl 1
:Pause "Yay!"
:Stop
:Lbl 2
:Pause "D:"
:Stop
Maybe something like that?
Good luck ;)
Edit: simplified a bit
-
Actually, if you just use the variable Str1 (under the vars menu) instead of A, it should work. :) Regular variables can't store strings.
Also, the first line should be
Input "Prom ? YES/NO",Str1. The fist comma isn't needed.
Welcome to Omni by the way, and best of luck! :D
-
or you store bytes into the variables
1-->N
2-->o
3-->Y
4-->E
5-->S
input"prom (Yes/No),A
ifA=YES
then
...
-
Last Thing:
How can I make it sou instead of the user typing in Second Alpha it is automatically text. Thank You so much!
-
For that, you need an assembly program. For example, name the program prgmALOCK and use Asm(prgmALOCK before the Input command:
AsmPrgm3E51FD7712C9
Also, I noticed that elsewhere you said this was for a school project ?
-
For that, you need an assembly program. For example, name the program prgmALOCK and use Asm(prgmALOCK before the Input command:
AsmPrgm3E51FD7712C9
Also, I noticed that elsewhere you said this was for a school project ?
well i think you must compile it with asmcompile( first, or???
if yes you can call the prgm alock1
and make this
asmcompile(prgmalock1,prgmalock)
now you hav the asm prog
-
there is no need of the asmcomp() cmd. It's just if you want to save weight
-
there is no need of the asmcomp() cmd. It's just if you want to save weight
yes but some calcs crashes or disp invalid whithout asmcompile(...
-
there is no need of the asmcomp() cmd. It's just if you want to save weight
yes but some calcs crashes or disp invalid whithout asmcompile(...
It shouldn't and I've never had a problem running it uncompressed. Here is a screenshot of how it is done:
(http://tibasicdev.wdfiles.com/local--files/hexcodes/asmprgm-example.gif)
-
I would use inString(, so that if she says, "Yes, I would like to," it would still recognize it:
ClrHome
ASM(prgmALPHAON //or whatever else the name of that ASM program you will use is...
Input "PROM?",Str1
If inString(Str1,"YES") or inString(Str1,"SURE") or inString(Str1,"YA") or inString(Str1,"ALRIGHT") or inString(Str1,"OK
Then
Pause "YAY! :D
Else
Pause "D:
End
This will work, even if more words are in the phrase. And, for "YA," the words "YEAH," "YEA," "YAY," ect. will work for it.
I hope it works out for you! :D
-
hmm interesting
i would use this
ClrHome
ASM(prgmA
Input "PROM?",Str1
length(str1)-->C
"yes yep "-->str5
if instring(str5,sub(str1,1,C
Then
Pause "YAY! :D
Else
Pause "D:
End
ps:never tried this
-
What's funny about codebender's code is that "I WOULD SAY YES, BUT I DONT LIKE YOU" would get a "YAY! :D" in response.
As an optimization, and though it wouldn't work in the same way or catch a "YES" inside a larger string:
:ClrHome
:Asm(prgmALPHA
:Input "PROM?",Str1
:not(inString("YESUREYALRIGHTOK",Str1
:Pause sub("YAY! :D:",6Ans+1,7-5Ans
But prom was yesterday, so I'm too late anyways. :P
-
What's funny about codebender's code is that "I WOULD SAY YES, BUT I DONT LIKE YOU" would get a "YAY! :D" in response.
As an optimization, and though it wouldn't work in the same way or catch a "YES" inside a larger string:
:ClrHome
:Asm(prgmALPHA
:Input "PROM?",Str1
:not(inString("YESUREYALRIGHTOK",Str1
:Pause sub("YAY! :D:",6Ans+1,7-5Ans
But prom was yesterday, so I'm too late anyways. :P
cool its better than anyones