oswald73's Forum Posts

  • 9 posts
  • I’m trying to port a Construct 2 plugin to Construct 3. Basically, I’ve taken the singleGlobalPlugin example and filled in my actions, conditions, expressions – and of course the language-files, addon, aces etc. too.

    However, I get “ReferenceError: $ is not defined“ in the following line which I've placed in the constructor in the c3runtime/instance.js file:

    this.connection = $.hubConnection('http://mydomain.com');
    

    I used to have this line in instanceProto.onCreate in Construct 2. It relies on a couple of scripts which I’ve added with AddFileDependency in plugin.js and also in DEPENDENCY_FILES.

    Am I missing a reference, or am I doing something else wrong here?

    Tagged:

  • Hi all,

    I would like to add additional combobox options (with the method AddComboParamOption) in the Edittime.js file in case one of the plugin settings is true. Can I do that?

  • Hi Delgado,

    The hack shown in the video seems to use the serial interface on the Arduino. For now, this plugin does not have support for the serial interface, but we’ll take a look at it and try to implement it.

  • Yes That is exactly what I would like to do.

    Unfortunately rexrainbow, I don’t think this can be achieved with the mandatory description on expressions, but if I’m wrong, please give me a cue.

    Else, I’ll wait for C3 like 7Soul

  • I would like to add tips to my expressions – like it is shown in the bottom of this page:

    https://www.scirra.com/manual/60/parameters

    Can I do that – and if so: how?

  • I have tried to add “var self = this” in top of onCreate. The result is “cannot read property ‘invoke’ of undefined" (the same result as without "var self = this"). I get the error in this line:

    this.myHubProxy.invoke('createPrivateGame');[/code:3no96rp5]
  • I am working on a plugin that should handle communication to and from a server. My code works in a regular html file but I am having problems getting it to work in a plugin. The errors I get are all related to some kind of ‘undefined’ objects. I have changed self to this and vice versa and moved things around but it will not work. I hope that some of you experienced plugin-developers or javascript developers can see the problem:

    	instanceProto.onCreate = function()
    	{
    	    
    	    this.groupNo = "";
    
    	    // Declare a proxy to reference the hub.
    	    this.connection = $.hubConnection('http://myserver.com/');
    	    this.myHubProxy = this.connection.createHubProxy('myGameHub');
    
    	    this.myHubProxy.on('PrivateGameCreated', function (groupNoString) {
    	        self.groupNo = groupNoString;
    	        this.runtime.trigger(cr.plugins_.MyGame.prototype.cnds.PrivateGameCreated, self);	        
    	    });
    		...
    	};
    	
    	Cnds.prototype.PrivateGameCreated = function () 
    	{
    	    return groupNo;
    	};
    	
    	Acts.prototype.StartPrivateGame = function ()
    	{
    	    this.connection.start().done(function ()
    	    {
                this.myHubProxy.invoke('createPrivateGame');
    	    });
    	};[/code:2hfbp2t5]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you. It works perfectly.

  • I have made an algorithm in javascript and used it in my own plugin to return the results. That works fine.

    Now I would like to return an Array from my javascript plugin and load it into a C2 array. I've tried to use JSON.stringify(myOneDimensionalArray) and return this string in the plugin, and then in C2 tried to load the string from JSON, but i guess C2 expects a 3D array and my array is one dimensional.

    Maybe I could make some string manipulation in my Javascript and make it look like a C2 array but is this the right way to go - or do some of you have a better approach?

  • 9 posts