If/Else Conditional Not Working with a Defined v. Undefined Variable

I tested this with just the code you provided and it works - it displays “Welcome they who have not been named”.

Are you defining $name somewhere else in your story? For example, if you set it to an empty string (<<set $name to "">>) in your StoryInit, it will not be undefined, and the game will display just “Welcome .”

You can also change <<if $name is not undefined>> to just <<if $name>>, which I believe is shorthand for “if the variable is defined and not empty” (can’t find the reference to that now, but when I test this version, it displays “Welcome they who have not been named” when $name has been set to an empty string).

1 Like