Would it be possible to make a Siri type program where you type in a question and if it matchs one of the preset questions in the program then it gives you an answer? So far I have something set up that doesn't work yet. I want to try and set each letter it's own variable so when a key is pressed with a letter set in the alpha spot, that letter will appear up top with the output function. Once your finished you press enter and if it matchs one of the preset questions, it will give you an answer and if it doesn't it ends the program. I'm not that experienced with programming but I think it would be cool if I could make something like that. I came to this forum to see if someone could help me figure out why this program doesn't work (it is just a test to try this out.)
:ClrHome
:Repeat A=31
:Pause
:getKey->A
:Output(1,1,"A
:End

Whenever I press the MATH button, nothing happens.

(sorry for this being so long.)
Well, getKey doesn't really work in that fashion, you have to 'catch' key presses, so to speak. You have to use conditionals (If A=##:Then:Do this:Do that:End)

You can use as a guide to what keys have what values. Smile
Welcome to Cemetech, Thundersheep! Be sure to Introduce Yourself when you get a chance; we're always happy to help new programmers learn. We're also happy to point you to any resources that might help.
Hey welcome to cemetech!
As a matter of fact, I'm sure you could.
For text input I would probably stick with the basic input command instead of making your own, it'll most likely be faster that way.
So for an example:

Code:

input "how may I help you?",str1
if str1="What is your name?
"Siri->str1
Disp str1

Is that what you want to do?
getKey gets the value of each button, a numerical value. It's up to you to work with that. In this case translating the number into a letter, on the fly.
zeldaking wrote:


Code:

input "how may I help you?",str1
if str1="What is your name?
"Siri->str1
Disp str1

Is that what you want to do?


Whenever I type that exact code, it gives me "ERR:DATA TYPE". Is it a problem with just my calculator?
By the way, sorry for such a late post and thanks for everyone that has helped.
You have to use the commands found in menus for Input, Str1, If, -> (STO> button) and Disp.
tifreak8x wrote:
You have to use the commands found in menus for Input, Str1, If, -> (STO> button) and Disp.

I did, but I'll start from scratch. Is alright if I have ClrHome though?
ClrHome should be fine. Where does the ERR:DATATYPE occur?
The ERR:DATATYPE occurs right in between What and Is.

Ok, I must have done something different last time because I did exactly what he said and I got it to work this time for some reason.

Thanks for the help and sorry for double posting.

Edit by Merth: Combined double post.
My guess is you left out the quote last time if that's where you got the error.

Additionally, please do not double post. Instead, use the button to edit your previous post.
Sorry, one more thing. How could I make more than one question? I can't get it to work. This is what I have so far.


Code:

input "siri v.5",
if str1="is this the krusty krab
"no its patrick->str1
disp str1
pause
prgmS
if str1="what is your name
"siri->str1
disp str1
pause
prgmS


When I type in "Is this the Krusty Krab" I get "No this is Patrick". But when I type in "What is your name?" it displays "What is Your Name". Is there a way to make so it goes so it shows both correct answers?
If conditionals can only do one command after.

This is optimized here, since you are only needing to perform one thing after the conditional, the rest of the code will be run afterwards.


Code:
input "siri v.5",
if str1="is this the krusty krab
"no its patrick->str1
if str1="what is your name
"siri->str1
disp str1
pause
prgmS


If you need to do more things after a conditional, you need a Then and End.

If A=1:Then
A+2->A:2->B:End

Kind of thing.
tifreak8x wrote:
If conditionals can only do one command after.

This is optimized here, since you are only needing to perform one thing after the conditional, the rest of the code will be run afterwards.


Code:
input "siri v.5",
if str1="is this the krusty krab
"no its patrick->str1
if str1="what is your name
"siri->str1
disp str1
pause
prgmS

If you need to do more things after a conditional, you need a Then and End.

If A=1:Then
A+2->A:2->B:End

Kind of thing.

Sorry for the super late response, but thank you so much.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement