is that the only way to use typed input to execute actions? I’d really like to use an if control structure if possible.
You’ll need to elaborate on what this means.
well yea, I can show my code, but really my issue is more of how can I make my arduino do something from typing in a full word like “on”
How will you distinguish “on” from “only once”? You can collect all the serial data in an array, until the array contains something that you recognize (“on”) but that leads to the problem that every command must be unique (i.e. no common letters at the start of a command). How would you deal with serial data that got corrupt/lost?
Now, if you were willing to add a start of packet and end of packet marker ("", “”, etc.), then it is a lot easier. Read (and discard) serial data until a start of packet marker arrives. When a start of packet marker arrives. set a flag, initialize the array, and set the index to 0.
Keep reading serial data, adding to the array or discarding, depending on whether or not the start of packet marker has arrived, checking each character for the end of packet marker. If it is not the end of packet marker, add it to the array (if there is room). If it is the end of packet marker, set a flag.
Once all pending serial data has been read, on each pass through loop, see if the started and ended flags are set. If so, parse the array, and do whatever. If not, the data in the array is not ready to be parsed.
I could post an example, if you need.