I use 2 IF's for 1 Prompt. and no matter what I answer whether it matches or not it still goes to the Else option of the first IF.
I've tried to change their order and also merge them by placing the first IF inside the empty Else of the second IF.
I would put money on the problem being in the if condition but for a non-coder like me, I can't really help find the issue.
That being said, I highly suggest instead of prompting the player to type something in to instead have choice boxes. It may be personal taste for me but I really don't like typing in teases when so many are case sensitive, or a minor misspelling messes you up. At best it makes you stop whatever you were doing and use both hands which ruins the pace for me and in my opinion doesn't "present" as well.
Yay for having a virginity variable, looks promising.
Epton wrote: Sat Mar 05, 2022 5:49 pm
I use 2 IF's for 1 Prompt. and no matter what I answer whether it matches or not it still goes to the Else option of the first IF.
I've tried to change their order and also merge them by placing the first IF inside the empty Else of the second IF.
Not an expert in JS, but isn't string comparison done with === ?
Also, I maybe wrong, but I think the condition is wrong. Use an eval action with a console log to verify the returned value
Epton wrote: Sat Mar 05, 2022 5:49 pm
I use 2 IF's for 1 Prompt. and no matter what I answer whether it matches or not it still goes to the Else option of the first IF.
I've tried to change their order and also merge them by placing the first IF inside the empty Else of the second IF.
I think the problem is the slashes. So instead of:
Thamrill wrote: Sun Mar 06, 2022 7:02 am
Not an expert in JS, but isn't string comparison done with === ?
Also, I maybe wrong, but I think the condition is wrong. Use an eval action with a console log to verify the returned value
The == is correct in this case because the return type of the match method is an array, while Answer is a string.
Assuming the user had typed in "no" in response to the prompt, the match method would return ["no"]. === only evaluates to true if the types on both sides are same, while == converts the expressions so they are the same type. So: