Key Detection

How would I make it so the letters I press on the keyboard are traced and can help trigger variables and such? Like after you type in “Hello” the “greeting” variable is true? (random example)