Is there a plugin that lets you call custom functions?

For developers using the Construct 2 Javascript SDK

Post » Thu Apr 30, 2015 3:51 am

Hi,

Is there such a plugin that lets you call custom functions defined in an external JS file? I'm looking at doing something like text processing where the function can be called as an action in the events sheet, can take in a variable and can receive a return value. So maybe something like:

in C2 --> Use JS Function Plugin --> Enter in "myCustomFunctions.js" and maybe some other Js files like Underscore.js

In myCustomFunctions.js, I maybe have something like this:

Code: Select all

myCustomFunc(rawWord) {
//...process rawWord
var out = rawWord;
return out;
}



and in C2, I've got something like this in my event sheet:

Event 1 --> On Some Condition --> call external function named "myCustomFunc" with parameters aC2Variable;
B
7
S
1
Posts: 42
Reputation: 1,058

Post » Thu Apr 30, 2015 4:42 am

In official browser plugin, Execute Javascript.
You might load javascript code by AJAX.
B
109
S
27
G
277
Posts: 4,481
Reputation: 154,922

Post » Thu Apr 30, 2015 11:28 am

It really is a better idea to write a plugin for anything but the most trivial Javascript statements.
Scirra Founder
B
399
S
236
G
89
Posts: 24,525
Reputation: 195,382


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest