I’m coding a text-based RPG and I have my controls working: I have a string checking what you write in against an array of if statements.
It can get it right with everything other than my pick up action.
My if statements are set out as follows:
int game_main() {
string PlayerOption;
//I have a few lines of cout statements just for my gui/hud
cin >> PlayerOption;
if (PlayerOption == “look”"look") {
//it’s then just calling a script from a separate header file
}
else if (PlayerOption == “pick"pick up”up") {
//another script from that header
}
My look command and all my others work but I don’t know how to set it up right.
I've tried putting it like “pick up”"pick up", I tried it like “pick”” “”up”"pick"" ""up" and a couple other ways but I don’t know how to properly write the expression.
Even then my problem might be with my string and not my if statement so any suggestions would be greatly appreciated.
And I think @DMGregory might be right about the word boundaries because even with that command if I make it accept "pick" it works it’s only when I ask it for two words it really breaks
Is there any way I could get around that?