Modifying a list from another plugin

For developers using the Construct 2 Javascript SDK

Post » Tue Nov 05, 2013 11:29 pm

I am developing a JWebsocket plugin that I intend to use for a multiplayer game.

The plugin receives a list of users who are online.

My aim is to take this list of users and put these users into a "constructs 2 list".

Now i dont know how to set the elements of the list from within my plugin.

here's what I want to do:

Acts.prototype.PopulateUserList = function ()
     {
          this.userarray = [];
          if (!this.websocketClient)
               return;
          console.log("Got user list into constructs runtime")
          
          
          this.userList = this.websocketClient.fetchUserList();
          for (var i=0;i<this.userList.length;i++)
          {
               array.add(this.userList.uname);
          }
          
                 // Now I want to access the list which i have created
                 // and populate it with userarray
                 

                 // Basically something like this.runtime.list ?
     };



Any suggestions or help is highly appreciated.
B
3
Posts: 6
Reputation: 187

Post » Wed Nov 06, 2013 10:48 pm

Ok let me simplify.

From within one plugin, how can I get reference to another plugin object, and call one of its actions ?

Also how do I pass parameters for that action ?

Thanks
B
3
Posts: 6
Reputation: 187

Post » Thu Nov 07, 2013 2:19 pm

You should not do this, in principle. Simply expose the data from your plugin, and allow users to display it where they want via the event system.
Scirra Founder
B
402
S
238
G
89
Posts: 24,628
Reputation: 196,023


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests