[Plugin] Call Javascript

  • You could use the "execute javascript" action available through browser object instead of this plugin. As a bonus, it works in preview!

  • You could open an external audio file and play it using this plugin?

    if possible .... how?

    Thank you.

  • I want give my feedback to this plugin.

    First I created a Javascript file which contain a functional Javascript code.

    It works and load like a charm when the JS file is located to the SAME folder of index.html file

    ..

    Meaning that the Scriptfile parameter of the CallJS plugin is set to:

    myScripts.js
    [/code:1lkb2zzb]
    
    But give a reference error when I want use sub-folders like: (created a 'g' subfolder and put myScript.js file into it).
    
    Then
    I set the Scriptfile parameter of the CallJS plugin to: 
    [code:1lkb2zzb]
    /g/myScripts.js
    [/code:1lkb2zzb]
    [b]OR[/b]
    [code:1lkb2zzb]
    g/myScripts.js
    [/code:1lkb2zzb]
    
    It won't load the file and give instead a ReferenceError error.
    
    Want precise I use
    Scirra Construct 2 BETA 192 (since I want have the Cordova Export option later!)
    
    And Free Version.
    
    Is it functionnal through a Personal paid Version or not too ?
    Why ?
    How fix it or workarounding it ?
  • I want give my feedback to this plugin.

    First I created a Javascript file which contain a functional Javascript code.

    It works and load like a charm when the JS file is located to the SAME folder of index.html file

    ..

    Meaning that the Scriptfile parameter of the CallJS plugin is set to:

    > myScripts.js
    [/code:eniy3ksa]
    
    But give a reference error when I want use sub-folders like: (created a 'g' subfolder and put myScript.js file into it).
    
    Then
    I set the Scriptfile parameter of the CallJS plugin to: 
    [code:eniy3ksa]
    /g/myScripts.js
    [/code:eniy3ksa]
    [b]OR[/b]
    [code:eniy3ksa]
    g/myScripts.js
    [/code:eniy3ksa]
    
    It won't load the file and give instead a ReferenceError error.
    
    Want precise I use
    Scirra Construct 2 BETA 192 (since I want have the Cordova Export option later!)
    
    And Free Version.
    
    Is it functionnal through a Personal paid Version or not too ?
    Why ?
    How fix it or workarounding it ?
    

    Oh... I found that it is only not functionnal in Node-Webkit preview or HTML 5 preview...

    Well, same problem like the Load file action from Request URL within AJAX plugin.

    Don't think you can do anything for that, but, look at this useful post for make a workaround for making it working:

    (

    I asked this question : Why we can't locally load files in Preview Mode in Node-Webkit ??

    Then I got a working answer from R0j0hound:

    [quote:eniy3ksa]

    We can though. In node-webkit preview if you use "document.xml" as the file it will look here:

    "http://localhost:50000/document.xml"

    If you want to get the file from the same folder as the capx you need to type it in explicitly:

    "C:\Users\rojo\Documents\c2projects\document.xml"

    And to make it work in preview or in export you could use a global like this:

    global text AppPath = "C:\Users\rojo\Documents\c2projects\"

    Start of layout

    System: [NEGATE] is in preview

    --- set AppPath to NodeWebkit.AppFolder

    And then request any files with:

    AppPath & "document.xml"

    )

    So If you can give us the ability to SET the Scriptfile url dynamically within a Construct 2 Action like:

    -- Set Scriptfile url to

    We can then be able to do this :

    global text ScriptFileAppPath = "C:\my\external\path\with\subFolders\"

    Start of layout

    System: [NEGATE] is in preview

    --- set ScriptFileAppPath to NodeWebkit.AppFolder

    And then requesting our files with the new Action I talking about:

    -- Set Scriptfile url to ScriptFileAppPath & "myScripts.js"

  • You could just add the script file to Construct 2 by right clicking on files then left click import files then locate the script file you want to add to c2 on click open BOOM ; that is it should work in preview mode now.

    This is to show that it works on my computer.

    P.S. Should work in any version of C2 you are using and also sometime you may get an error, it not perfect but it works.

  • Hello.

    I use the plugin but nothing happens. The plugin is loaded by construct but the function is not read.

    Any ideas?

    Is it possible to have an example to download?

    Thank you.

    It's ok... need () after name of function.

  • I am curious, will this work if for example I have a speed variable and I want that variable to be set prior to the game starting by for example a teacher? My need is for the user to be able to set the speed of 1 or more variables prior to the game. or would this be better to do within construct setting the variable values at start of game?

  • I am curious, will this work if for example I have a speed variable and I want that variable to be set prior to the game starting by for example a teacher? My need is for the user to be able to set the speed of 1 or more variables prior to the game. or would this be better to do within construct setting the variable values at start of game?

    .just use the browser execute javascript function... plus this topic is from 2011 and OP is never seen online since then

  • > I am curious, will this work if for example I have a speed variable and I want that variable to be set prior to the game starting by for example a teacher? My need is for the user to be able to set the speed of 1 or more variables prior to the game. or would this be better to do within construct setting the variable values at start of game?

    >

    .just use the browser execute javascript function... plus this topic is from 2011 and OP is never seen online since then

    Thanks, I thought I saw recent activity but I was searching two topics and it was the other.

  • Can anybody reupload this plugin? Dropbox throws 404 now

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Please, reupload the plugin

  • Here to ask for plugin upload!

  • Here : ( or another plugin same name )

    https://drive.google.com/file/d/0B3cXdL ... sp=sharing

  • I figured ReadExecutionReturn expression of this plugin works wrong. It only returns strings. If you try to return a number, for example, it crashes.

    Here's the link to a corrected plugin: https://drive.google.com/open?id=0B72lM ... 2daZnBJN3c

  • I figured ReadExecutionReturn expression of this plugin works wrong. It only returns strings. If you try to return a number, for example, it crashes.

    Here's the link to a corrected plugin: drive.google.com/open ... 2daZnBJN3c

    Thanks.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)