Calling html5 functions with function action?

Discussion and feedback on Construct 2

Post » Tue Dec 18, 2012 7:44 pm

This is kind of important for me.

For one of my publishers I need to add a few empty function calls, so they can later add their own code to those functions via javascript I imagine. So my question is, if I just use the default C2 call function action with an event, is this going to work?

For instance, if I use an event with Function call "levelcomplete", and then I tell them the functions names, are they gonna be able to add their code in the html5 files? Or the C2 functions are different than the normal html5 functions?

If this isn't gonna work, can I use a plugin to achieve this?

I'm gonna add another example just in case: one of their rules is that every game needs to have a "More Games" button in the main menu that will link to a website when touched, so they ask that you use a click/touch event and a function call, and then communicate that function to them so they can add their own functionality.
B
63
S
23
G
17
Posts: 254
Reputation: 14,342

Post » Wed Dec 19, 2012 11:41 am

Well, I did some testing and it seems they are indeed different. If anyone is interested, I managed to ejecute javascript functions using the C2 plugin "CallJS" with just a simple event. Hopefully it's gonna work for them too.

Now I wonder if there is another plugin which can listen to external code, the purpose is for creating conditions. Example: if an external javascript function is called, do something?
B
63
S
23
G
17
Posts: 254
Reputation: 14,342

Post » Wed Dec 19, 2012 3:08 pm

You might want to write a custom one-off plugin for this: https://www.scirra.com/manual/15/sdk
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed Dec 19, 2012 6:16 pm

[QUOTE=Xavier]... So my question is, if I just use the default C2 call function action with an event, is this going to work?[/QUOTE]
Short answer, no. The inbuilt function call mechanism is for executing C2 actions, not JavaScript code - as I think you've discovered.

As you've also discovered, the third-party CallJS plugin should meet the first of your requirements. And for the second, as Ashley indicates, you should write your own plugin.
B
105
S
20
G
12
Posts: 549
Reputation: 20,320


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 13 guests