JohnnySheffield's Forum Posts

  • Just found out that Socket.io 1.0 is probably going to be pre-released some time this week. The newest feature is that it will include the engine.io 0.3 for the communication layer. As it seems it will introduce a better user experience and a lot of improvements.

    Sounds nice.

    I will really really try to release improved plugin for the pre-release of socket/io 1.0, and hopefully make socket communications with this nice plugin a little bit easier!

    <img src="smileys/smiley35.gif" border="0"> it, i really dig Guillermos work

    Cheers!

  • Plugin uses string.split(separator,limit) method. Separator and limit are optional attributes and you can ommit them. If you do, method will return an array with a single element;

    var URL="WWW.Google.com", var result=URL.split(); result will be an array with a single element (WWW.Google.com).

    If you use var Ucan="do it", Ucan.split("") will return an array with elements (d,o, ,i,t). (Mind the white space!).

    If you do something like var query="split.string method JavaScript" and then query.split("i",2),returned array will be: (spl, t.str). This is an example use of a limit attribute in a string.split method.

    If you need an datasplit action in the c2 plugin with a different character than ",", just edit the right line of code in the runtime.js; if you use this method on your server side, I hope this post will be of use!

    Cheers!

  • hmmm...

    where is that line of code? i'm looking at runtime.js of both mods of plugin (stable and unstable) and i can't find it!

    It sounds like it's on server side, if i remember correctly, but i'm not so sure about it...

  • Schoening

    I would recommend to use stable link, but there is no server included in the plugin, so you have to write your own.

    It will work with juantars multiplayer demo, so you don't have to change server code.

    If i didn't understand you well, please ask again, English is not my first language :)

    Aaand i will edit the first post to clarify it a little bit more!

  • Nice!!! Great work as always Pode, you're one big motherf... khm a really good plugin developer and I really like your plugins!

  • If you're using rexrainbows socket.io plugin, you should probably follow his instructions. I think he made a special plugin to communicate with his server, so i don't believe it will work with juantars demo. As i haven't read the source of rexrainbows socket.io plugin, i really cannot tell you how it works, so you could maybe ask him?

    To set up juantars demo, you can use this mod or this mod of the plugin.

    Both should do the work.

  • Hi!

    First you have to SplitDataReceived to get some consistent LastDataElement.This plugin splits data where is a comma sign, eg.

    If your message looks like 'message',"Some,data,here" it will be split like this:

    Socket.LastDataElement(0)="Some"

    Socket.LastDataElement(1)="data"

    Socket.LastDataElement(2)="here"

    As you can notice, Socket.LastDataElement requires an index number, starting from zero.

    As for the error i cannot really tell you something useful, if you could post .capx and server code, it would be possible to pin-point the error more accurate.

    Also, there is a few versions of that plugin on the forum (it's pretty unstable plugin, there is great community effort to make it more stable, hence a few versions of it exist), so if you could tell us where did you download Socket plugin, or share the plugin here!

  • yup, srware iron is just variation of chrome, after i updated iron, everything was ok.

    on other browsers everything worked ok for me too, sorry for posting an error on old browser!

  • Just a report, after updating browser to 21.0.1200.0 everything was ok!

    Added just a textbox to a project. Preview looked ok, but when i changed tabs, or minimized window error occured:

    <img src="https://dl.dropbox.com/u/62601881/error/error.jpg" border="0">

    Capx

    After browser update, everything worked fine.

    On Chrome 21.0.1180.89 m and IE9 9.0.8112 everything was ok.

    System spec: Win7, 64bit, AMD Radeon HD 6700.

  • Update on stable version:

    Separated emit and send actions, so it doesn't break old projects. Please download again.

  • You can check out modded version of this plugin here:

    Link with minify problem sorted out!

  • Thank you Rory!

    On the side note, playing with plugin, currently experiencing some weird behavior with LastDataElement expression, seems like it catches elements it shouldn't (one element from event before). Hmmm...

    I have to work now, will try to fix it later, another signal this is just for testing purposes!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • EDIT2: I became a father month ago, so I haven't got time to sort this plugin and post to some decent level of tidyness. I believe I'll manage to find some time in the next week, so i'll re-upload the plugin with some modifications and hopefully new possibilities!

    EDIT: You can download more stable version of this plugin(without new ACE's except send custom event(aka emit), but with minify problem sorted out): Link to stable plugin

    And you can check for yourself: Juantars multiplayer demo example minified!

    Socket away!

    -----------------------------

    Added:

    OnEventReceived

       - Triggered when Construct receives a custom socket event.

    OnAnyEvent

       - Triggered when the socket receives any event. (All of them!)

    one new action:

    Emit

       - Emit a custom event through socket. (You must specify which event, and what data to send with that event)

    and two expressions:

    LastSocketEvent

       -Get the last event that was triggered in Construct.

    LastSocketEmittedEvent

       -Get the last event that was emitted by Construct.

    Changes:

    1) Socket.send ---> socket.emit('message' , data)

    2) On data received

    -Triggered when socket receives a chunk of data, regardless of event

    3) Included recent modifications by & bhavanvaishnav

    4) Changed dependency from "socket.io.js" to "socket.io.min.js"

    5) Overridden socket.io's emit; hackish solution; not satisfied but works for now, waiting for more decent implementation: link

    Problematic code starts at line 110 in runtime.js

    5) You can minify the plugin!

    Tested on C2 r95, SRWare Iron, 15.0.900.1.

    Please test on more browsers and in more situations; haven't had time to test it properly.

    I don't recommend to use it in production code, big chance of unexpected behavior!

    Download here:

    link

    Greatest improvement is possibility of minify, if somebody wishes, i can edit older versions of plugin to be minifiable, but i believe this is a good progress!

    I'm learning plugin development and javascript with this plugin, so i would be grateful for any help in improving it!

    Have a nice day!

  • Schoening

    Have you tried this? When i do this changes to the example the problem you mentioned doesn't happen...

    it's even easier than that wall of text i wrote:

    To juantar's example server just add at the right place:

    socket.on('disconnect', function (data) {

           

           socket.broadcast.emit("message",'D,' + mySelf[0] );

           entities[myNumber] = null;

           

    });

    To capx just add (as sub-event of "is data available?" event):

    http://imgur.com/2YZR6

  • Schoening

    I'm not on my computer so i cannot see the capx, but i think there is an event that sends "C" message to server whenever someone connects. Look what happens with that message. Also,you could be right, maybe server remembers disconnected player,but i believe if that is the case, you should check out the solution ?for the problem that lonehangman had few posts ago. If i'm wrong you should find out where the server sends "C" message, and mess around with that piece of code.

    I'm on my computer in a few hours so i'll look into it and come back with more details!