- The name of the function is not the same as the function you call in the <<set>> macro.
- You shouldn't really create functions like this. Putting them in a passage instead of your Story JavaScript can cause problems.
- You're creating a global function; I generally recommend using the setup object.
Here's an example that should work. First, in story JavaScript, place this:
setup.testFunction = function () {
return 10;
};
Then, in passage:
<<set $var to setup.testFunction()>>
<<print $var>> /% 10 %/
Note. I wrote this code from memory, it may contain errors.