0 favourites
  • question about this plugin: when i use the "on event recieved" event, which ever action I have used it for gets spammed. For example, if my servers sends event "newPlayer", and in my game code I tell it to create a new sprite, it creates a new sprite every tick even though the event is only fired on the server once. I'm using the latest beta C2.

  • Hi!

    I've uploaded this version of the plugin here as a kind of a dev version, but i will maintain the stable version here and add stuff as we make decisions!




    The "on any event" is a pretty hackish stuff, and i would recommend that you don't use it. The support on the wildcard event is something that is discussed, but there is no news on implementing it. Solution for "on any event" used in this version of the plugin is taken from stackoverflow, and it misbehaved!

  • I'm not using "on any event" - I'm using "on event recieved" with a named event, i.e. "playerUpdate". When the playerUpdate event is fired from the server, C2 reacts with its event over and over again vs. firing once per event.

    I seem to be able to get around this if I set up my C2 events as:

    • -> Socket| on "playerUpdate" recieved || Socket|Split Data Received
      • -> Socket| Is Data Available? || (do my actions here)

    ...but this seems to be quite a few extra steps. Why can't I just call my events directly after "on "whatever" recieved?

  • Correction: the above does not fix the issue, it just causes the event to only fire once. If i can get an example together with a public server I'll toss it up here

  • Sorry, misread.

    But, nevertheless, the "on event recieved" is possible thanks to the same function as on "any enevt".

    It seems that you need custom event triggers; i.e. 'on myEvent'. My current solution is tho manually add triggers for everycustom event directly in runtime.js. I use this version of the plugin

    I add a newcondition to the edittime.js, somewherearound line 22:

    addcondition('on my trigger', ,mytrigger','blahblah', 'onMyTrigger')

    In theruntime.js i add a new eventlistener:






    //trigger the ondatacondition here if needed               runtime.trigger(pluginProto.cnds.OnMyTrigger,instance);



    And finally i add the condition


    Cnds.onMyTrigger= function(){return true;}

    It needs more planning ahead, and is time connsuming, but in my experience it provides muchmore stable code.

    Sorry for the formatting, writing on mobile;


  • Thanks for the tip, I'll try that. Honestly I may like that more anyway, as I want to play with the event data a bit and if I can do that outside of C2 then even better. Don't get me wrong, I like C2 - but sometimes I just wish you could break out into code!


    I was looking for it without success in other boards.

    Then decided to look into JohnnySheffield's post history and here I am.

    I was able to do everything but two things with the stable version of the plugin.

    1)Send Events

    2)Send Texts(like "Johnny"); It always broadcast a error or "0"; I don't know but looks like the clientside would not allow letters in the data.

    Any update/help in these areas?

  • make sure you are escaping characters. When sending events, I had to format my event data as a JSON string, so it would end up looking like:


    or something like that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads

    Subscribe to Construct videos now

    Notice I've changed the plugin to do away with csv's and instead implement a loop through events, checking their names and accessing data with a CurDataAtVar("var") expression.


    Hey aceofpack,

    I really liked what you did on this video. Do you think it's possible to share this .capx file with the multiplayer or make a tutorial? I'm developing an game fruit-ninja style and I really wanna make a multiplayer mode. But I'm a little new at this area, that's why would be good to take a look on some .capx file or tutorial.

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