In sugarcube 2 (twine 2), how can I evaluate a condition stored as a string in a variable.
Example:
<<set $condition = "$var1 gt 1 or $var2 gt 1">>
<<if $condition>> /* it should be evaluated as <<if $var1 gt 1 or $var2 gt 1>> and NOT as if $condition is blank or not*/
<<print "condition is true, i.e. $var1 is greater than 1 or $var2 is greater than 1"
<</if>>
Essentially, the condition to be used is dynamic, and hence I want to store & set it in a variable instead of hard coding it.
How can this be done?
Thanks in advance for your time and inputs.
Example:
<<set $condition = "$var1 gt 1 or $var2 gt 1">>
<<if $condition>> /* it should be evaluated as <<if $var1 gt 1 or $var2 gt 1>> and NOT as if $condition is blank or not*/
<<print "condition is true, i.e. $var1 is greater than 1 or $var2 is greater than 1"
<</if>>
Essentially, the condition to be used is dynamic, and hence I want to store & set it in a variable instead of hard coding it.
How can this be done?
Thanks in advance for your time and inputs.