Creating Plugin for JS Library Help

For developers using the Construct 2 Javascript SDK

Post » Sun Oct 18, 2015 5:48 pm

Hey you Javascript people out there!

I'm very beginner when it comes to Javascript but I can sort of get it when reading through code. Anyways..

I wanted to practice by incorporating a generally simple JS library called PathFindingJS (https://github.com/qiao/PathFinding.js), into a plugin for C2. But I'm having some issues with the runtime.js I think. I copied over one of @RexRainbow s plugins he made that referenced a JS library but I might have missed something. The plugin installs fine but I get an error when I run a basic template project that I added the plugin to.
Here is a screenshot of the error when the game startsImage

So basically for the plugin I made one expression that is supposed to call a function in the JS library to create a grid with a width and height that is specified.

Could anyone take a look at my couple js files and see if anything stands out as broken or set up incorrectly?

Also, if I am incorporating a JS library in the plugin, do you put ALL of that library's related files in the base folder with the runtime.js and such or do you keep them in a separate folder inside that folder?

Any help or suggestions would be greatly appreciated!

Thanks!

FILES:
https://dl.dropboxusercontent.com/u/96803504/JSPathFindingPluginFiles.zip
Twitter: https://twitter.com/pudgyplatypus

Learn to make a clicker game for cheap!
https://www.scirra.com/store/games-with ... e-game-666

Try out Pixel Golf on the Scirra Arcade!
https://www.scirra.com/arcade/sports-ga ... el-golf-67

Pudgy Platypus Games website!
www.pudgyplatypus.com
B
59
S
20
G
5
Posts: 212
Reputation: 7,390

Post » Sat Oct 24, 2015 11:54 pm

In the edittime you declared the js library as a dependany. That will load the js file into the application. So remove the items within the runtime that create the script tag. I think all that is what is messing you up. The expression you created returns a bunch of text. Not sure what pf.grid does but unless it returns a bunch of text, you might generate another error.
www.h1k3.tech

We are here for you!
B
87
S
23
G
16
Posts: 715
Reputation: 16,835


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests