According to this page: http://wiki.compilgames.net/doku.php/gdevelop/tutorials/usingjsevents
So I tried External sources… created that, added it to my game and it looks exactly as on the image in the tutorial, but.
What am I doing wrong ?
1.Write a function in your external source and give it a parameter.
In one picture :
Showing in the console of your navigator “oui”
Tested and approved
@Bouh So if I get you correctly
Edit: Ok I figured it out
Thanks for pointing me in the direction.
I glad of you, it’s easy
Can you edit the title of this topic with [Solved] for next user ?
Actually … there is still a problem.
Scenario: I copied the default code that is generated when you add a “JavasScript code” event and put it in a function in my external source.
It says “runtimeScene is not defined”
I can’t access any of the gdjs functions. Are they namespaced or how do I import them?
And I assume that you can do this with all the classes mentioned in the documentation ?
Your message makes no sense. runtimeScene is an instance of gdjs.RuntimeScene, that’s why you need to pass it around to use it.
I meant that when I want to use e.g. gdjs.RuntimeObject I have to use “runtimeObject” as a variable passed in my external file, and similarly to the rest of the gdjs.______.classes. I’ll give it a try and report back.
Edit: Ok I was being stupid … I had it set up properly, but I kept executing my code from Chrome’s JS console.
Now it is working.
Thanks @victor and @Bough