Socket.io Mod

Post your completed addons to share with the community

Post » Tue Apr 30, 2013 4:08 pm

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 https://github.com/JohnnySheffield/C2_Plugins/tree/master/Socket_io-mod_stable

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:

socket["on"]
          (
               'Mytrigerr',
               function(event)
               {
//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;

Cheers!
Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,652

Post » Tue Apr 30, 2013 5:32 pm

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!
B
8
Posts: 32
Reputation: 1,039

Post » Thu May 02, 2013 12:25 am

GLORIOUS

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?
B
7
S
3
G
1
Posts: 154
Reputation: 1,812

Post » Thu May 02, 2013 11:29 pm

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:

"{"""x""":""&xvar&"","""y""":""&yvar&""}"

or something like that.
B
8
Posts: 32
Reputation: 1,039

Post » Thu May 16, 2013 5:21 am

[QUOTE=aceofpack] UPDATE
Youtube video of progress here

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.
/UDPATE[/QUOTE]

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.almeidamarcell2013-05-16 05:21:48
B
16
S
4
G
4
Posts: 56
Reputation: 2,942

Previous

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests