I'm trying to figure out, I added a function in event sheet "callPrompt" and I added a function in script file:
function yourName() { var person = prompt("Please enter your name", "Chuck Norris"); }
I don't know how is supposed to call a function from event sheet to script file...
You can just add a script action in the event sheet that calls the function:
yourName();
Develop games in your browser. Powerful, performant & highly capable.
Thanks Ashley! I haven't seen this action before.
Also I have another question, is there an expression to get return value from function in script file?
Take a look at the 'Integrating events with script' example.
There is no "Integrating events with script" example in C3 editor
i.imgur.com/utvjEk7.png
Sorry, I should've said, it's in the latest beta.
No problem, I just figured it out I managed to create a new function with defined return value and call an expression like that:
runtime.setReturnValue(yourName());
after all, thanks!