Number to Byte / Char -> MooSock

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Ho! I have another question. So, I am testing out MooSock, and it seems to be pretty well put together. There is only one thing bugging me though...

    I have a server written in Game Maker / Faucnet (which is just a socket plugin). The protocol for it is this:

    <MESSAGE TYPE BYTE>
    <DATABYTE>

    or

    <MESSAGE TYPE BYTE>
    <STRING LENGTH>
    <STRING>

    My problem is that I can send strings just fine, but I cannot send a byte. However, it works if I just send this: which is a byte representing 14.

    Is there a function to convert a number to a byte? How about a short, or an int?

    Thanks! ;D

  • Before anyone recommends the use of Lacewing, note that SuperDisk already has a server written in a different protocol and therefore cannot use Lacewing.

    SuperDisk: Lacewing is the socket protocol that is recommended with MMF2. It doesn't support raw socket stuff yet, so it's not an option for you.

    The Moo extensions are pretty poorly written. Your only option here is to use the Send binary action, which requires a file to send. I would not recommend the Ascii or Ascii Character extensions as that wouldn't work for certain special character values.

    Basically you will have to use the Binary object to save a single byte to a file and then send that file with MooSock. Quite ugly, but not much choice :\

    Working as fast as I can on Fusion 3

  • Ascii Object and Ascii Character Object both convert between single characters and integral values, sou it could be used to convert a number to its character. However it wouldn't work with values like 0 because that's the null character, and MooSock would assume you're sending an empty string.

    As for the file it only needs to be the bytes of the message you want to send.

    Working as fast as I can on Fusion 3

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!