Hi,
I've created a variable containing some functions in my intro page eg.
with the plan to use them like this in other passages:
But, all the functions are returning true, or rather, all the if macros are treating $misc.<function> as true.
What am I doing wrong here? Or can I not create functions within objects like this?
Many thanks for your help.
I've created a variable containing some functions in my intro page eg.
<<set $time={ day=0, hour=7 }>> <<set $misc={ isMallOpen: function() { return ($time.hour lte 18); }, haveSchool: function() { return ($time.day % 7 gt 0) && ($time.day % 7 lt 6) && ($time.hour lt 12); }, canSleep: function() { return ($time.hour gt 15); }, test: function() { return false; } }>>\
with the plan to use them like this in other passages:
<<if $misc.canSleep>>[[Go to sleep]]<<endif>>
But, all the functions are returning true, or rather, all the if macros are treating $misc.<function> as true.
What am I doing wrong here? Or can I not create functions within objects like this?
Many thanks for your help.