[Plugin] JavaScript (C2 and C3)

2 favourites
From the Asset Store
Firebase Analytics
$3 USD
50% off
[C2] [C3] Support C3 build service and Android 14
  • Thanks for your reply.

    How can I insert an html element like this <wickey-appstore></wickey-appstore> using your plugin?

    If this is a js-library and it works if you add it to the regular web page, then yes. You can do this with js plugin too.

    > Hey there.

    >

    > I am trying to integrate a library. I don't know anything about Construct unfortunately.

    >

    > The lib is here:

    > wickeyware.github.io/wickeyappstore

    >

    > In the index.html I need something like this

    >

    > <head>

    > <!-- WickeyAppStore css -->

    > <link rel="stylesheet" href="elements/styles.css">

    > </head>

    > <body>

    > <wickey-appstore></wickey-appstore>

    > <script type="text/javascript" src="elements/wickeyappstore.js"></script>

    > </body>

    >

    > This is the simplest case integration. Can I do that with your plugin?

  • Adding html elements to the web page of your Construct game doesn't make any sense. The game is entirely shown in <canvas> element.

    You use js-libraries by invoking javascript. By calling javascript functions for example.

    Thanks for your reply.

    How can I insert an html element like this <wickey-appstore></wickey-appstore> using your plugin?

    > If this is a js-library and it works if you add it to the regular web page, then yes. You can do this with js plugin too.

    >

    > > Hey there.

    > >

    > > I am trying to integrate a library. I don't know anything about Construct unfortunately.

    > >

    > > The lib is here:

    > > wickeyware.github.io/wickeyappstore

    > >

    > > In the index.html I need something like this

    > >

    > > <head>

    > > <!-- WickeyAppStore css -->

    > > <link rel="stylesheet" href="elements/styles.css">

    > > </head>

    > > <body>

    > > <wickey-appstore></wickey-appstore>

    > > <script type="text/javascript" src="elements/wickeyappstore.js"></script>

    > > </body>

    > >

    > > This is the simplest case integration. Can I do that with your plugin?

  • IS it ever going to support web workers ?

  • IS it ever going to support web workers ?

    I don't know. Not until it stops being an experimental feature in Construct. And why do you need web workers in the first place?

  • valerypopoff

    Forewarning that I'm a noob. But can you tell me if it is possible to get the below to work in construct2 with your plugin? And if yes, how to do it?

    html2canvas.hertzen.com

    github.com/niklasvh/html2canvas/releases

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't know what is it that's below the link.

    But I can tell you that. With my plugin you can dynamically add the script to a webpage and access functions, variables and objects in it. Call functions, set variables and this kinda stuff. If that's what you're supposed to do with whatever that's below the link, then yes, it's possible to get it to work.

    valerypopoff

    Forewarning that I'm a noob. But can you tell me if it is possible to get the below to work in construct2 with your plugin? And if yes, how to do it?

    http://html2canvas.hertzen.com/

    https://github.com/niklasvh/html2canvas/releases

    Thanks

  • valerypopoff

    html2canvas is a way of taking screenshots of form elements like buttons. Normally the paster plugin or the canvas snapshot feature can't paste or grab buttons, lists etc, but apparently this html2canvas does something to mimic these form elements in style and then takes a screenshot of it which we can use.

    I tried to use it, but honestly I haven't got the slightest clue how to get it to work or if it is even possible.

  • And you're trying to take a screenshot of what exactly?

    valerypopoff

    html2canvas is a way of taking screenshots of form elements like buttons. Normally the paster plugin or the canvas snapshot feature can't paste or grab buttons, lists etc, but apparently this html2canvas does something to mimic these form elements in style and then takes a screenshot of it which we can use.

    I tried to use it, but honestly I haven't got the slightest clue how to get it to work or if it is even possible.

  • valerypopoff

    In C2 you can have form control elements like buttons and lists etc

    static4.scirra.net/images/fresh/c2/gallery/large/png/plugin-list-02.png

    But these elements cannot be grabbed by the native 'canvas snapshot' feature or pasted by R0j0's paster plugin, for whatever technical reason. Something about them being rendered on top of the Construct2 canvas.

    Basically if you have a project with one sprite and one form element button. And did a 'canvas snapshot', and viewed the image, only the sprite will show up. The button would not.

    Looking around I found 'html2canvas', which does let you to take snapshot of these elements. Was just wondering if it can be used on C2 with your plugin. I don't know if it is possible or not tho. Or how to implement it if it is. I imported the linked js files and tried to see if it worked, but kept getting errors.

    Edit: To be more clear the 'html2canvas' approach is that they create a representation of the page inside a canvas. They don't make an actual screenshot, but builds it based on the content on the page and the loaded stylesheet. It could be used on the entire body or just a specific element.

  • Pandy

    I don’t have a reason to believe that this new instrument will work when the previous one didn’t. The fact that it takes a screenshot of the whole page doesn’t mean it works differently technology-wise.

    Anyways, what errors do you get?

  • I just get 'html2canvas' is undefined. But I think that's more of an error in my part in trying to make it work with your plugin. And it's actually not a screenshot but just builds the representation of the page or element on a canvas. Again, I'm a noob at js and don't know what I'm doing.

  • Can you show me the project file?

    I just get 'html2canvas' is undefined. But I think that's more of an error in my part in trying to make it work with your plugin. And it's actually not a screenshot but just builds the representation of the page or element on a canvas. Again, I'm a noob at js and don't know what I'm doing.

  • It was nothing. Just trying to call a function when 'All scripts were loaded' fired. Nothing else.

    cdn.discordapp.com/attachments/508660646704054275/511517237954347018/html2canvasTest.capx

    I just made this now since you asked. I was checking the console for errors. It comes up as html2canvas is undefined.

  • Ok I looked at the project file and I know why it doesn't work. You simply didn't tell the plugin what scripts to load. You have to put the name of the script to "Script files" property of a plugin in a Properties bar. You just added scripts to the project and the plugin has no way of knowing that.

    I believe you didn't read the documentation. Do this: readymag.com/valerypopoff/valerypopoff-js-plugin

    When you fix it, it works, but the canvas with the result is not visible and hidden under the game. If you go to the developer console and delete it, you finally get to see it. A small gray canvas the size of the button. It actually IS a button but without a caption on it:

    But if you take a screenshot of the whole <body>, you'll see this:

    Which is no surprise because this kinda tools are supposed to work with regular web-pages, not canvas-based games.

    It was nothing. Just trying to call a function when 'All scripts were loaded' fired. Nothing else.

    https://cdn.discordapp.com/attachments/508660646704054275/511517237954347018/html2canvasTest.capx

    I just made this now since you asked. I was checking the console for errors. It comes up as html2canvas is undefined.

  • Hi valerypopoff,

    Interesting Add-on, could be useful.

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