Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: rcfun92 on April 29, 2013, 10:45:18 pm

Title: Need help with program
Post 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
Title: Re: Need help with program
Post by: Darl181 on April 30, 2013, 12:28:42 am
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
Title: Re: Need help with program
Post by: TIfanx1999 on April 30, 2013, 03:47:05 am
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
Title: Re: Need help with program
Post by: alex99 on April 30, 2013, 04:33:46 am
or you store bytes into the variables
Code: [Select]
1-->N
2-->o
3-->Y
4-->E
5-->S

input"prom (Yes/No),A
ifA=YES
then
...
Title: Re: Need help with program
Post by: rcfun92 on May 01, 2013, 12:26:50 am
Last Thing:
How can I make it sou instead of the user typing in Second Alpha it is automatically text. Thank You so much!
Title: Re: Need help with program
Post by: Xeda112358 on May 01, 2013, 06:19:03 am
For that, you need an assembly program. For example, name the program prgmALOCK and use Asm(prgmALOCK before the Input command:
Code: [Select]
AsmPrgm3E51FD7712C9


Also, I noticed that elsewhere you said this was for a school project ?
Title: Re: Need help with program
Post by: alex99 on May 01, 2013, 09:44:36 am
For that, you need an assembly program. For example, name the program prgmALOCK and use Asm(prgmALOCK before the Input command:
Code: [Select]
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
Title: Re: Need help with program
Post by: TheMachine02 on May 01, 2013, 09:56:07 am
there is no need of the asmcomp() cmd. It's just if you want to save weight
Title: Re: Need help with program
Post by: alex99 on May 01, 2013, 11:38:53 am
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(...
Title: Re: Need help with program
Post by: Xeda112358 on May 01, 2013, 12:57:49 pm
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)
Title: Re: Need help with program
Post by: Joshuasm32 on May 01, 2013, 06:35:30 pm
I would use inString(, so that if she says, "Yes, I would like to," it would still recognize it:

Code: [Select]
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
Title: Re: Need help with program
Post by: alex99 on May 05, 2013, 07:35:20 am
hmm interesting
i would use this
Code: [Select]
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
Title: Re: Need help with program
Post by: dinosteven on May 05, 2013, 09:17:04 am
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:
Code: [Select]
: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
Title: Re: Need help with program
Post by: alex99 on May 06, 2013, 11:35:35 am
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:
Code: [Select]
: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