Condition check throws error for not declared vars
Posted: Sat Oct 19, 2024 10:56 am
I had this question in my head for some time...
Please note my old version. I don't know if this changed, but in case it didn't, here's my little issue.
I've observed that if I check the value of a non-yet-declared variable, DS throws an error and stops executing that entry, preventing the conversation from going through that conditional node and its desired dialogue branch afterward.
I find this a bit inconvenient because I often just want to declare a variable in a conversation without the need to prefill that variable to the already huge list of pre-declared variables in the Variables tab.
In other words, it would be great if DS initialized on-the-fly variables that can't be found when a conditional asking for their value is run, instead of giving that error.
It might sound weird, but I commonly find myself desiring this behavior. For example, I may want to set a "Variable["LotteryWon"] = true" in the Script field of a given entry that may or may not be run before it gets checked on another entry.
I'm aware the solution to this is just to prefill that variable on the Variables tab or run "Variable["LotteryWon"] = false" in an initialization conversation at the start of the game. That's what I'm doing.
However, I'd very much prefer if DS would just assume a non-existent variable needs to be initialized to its default value (false bool, empty string, 0 number...) and keep parsing the Conditions field as normal.
If you think this would be a too big change in behavior for everyone using the asset, would it be possible to have a script to change it on demand?
Thank you.
Please note my old version. I don't know if this changed, but in case it didn't, here's my little issue.
I've observed that if I check the value of a non-yet-declared variable, DS throws an error and stops executing that entry, preventing the conversation from going through that conditional node and its desired dialogue branch afterward.
I find this a bit inconvenient because I often just want to declare a variable in a conversation without the need to prefill that variable to the already huge list of pre-declared variables in the Variables tab.
In other words, it would be great if DS initialized on-the-fly variables that can't be found when a conditional asking for their value is run, instead of giving that error.
It might sound weird, but I commonly find myself desiring this behavior. For example, I may want to set a "Variable["LotteryWon"] = true" in the Script field of a given entry that may or may not be run before it gets checked on another entry.
I'm aware the solution to this is just to prefill that variable on the Variables tab or run "Variable["LotteryWon"] = false" in an initialization conversation at the start of the game. That's what I'm doing.
However, I'd very much prefer if DS would just assume a non-existent variable needs to be initialized to its default value (false bool, empty string, 0 number...) and keep parsing the Conditions field as normal.
If you think this would be a too big change in behavior for everyone using the asset, would it be possible to have a script to change it on demand?
Thank you.