User Tag List

Results 1 to 5 of 5

Thread: Number to Byte / Char -> MooSock

  1. #1
    Clicker Fusion 2.5SWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SuperDisk's Avatar
    Join Date
    Jul 2012
    Location
    USA #1
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Number to Byte / Char -> MooSock

    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!

  2. #2
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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

  3. #3
    Clicker Fusion 2.5SWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SuperDisk's Avatar
    Join Date
    Jul 2012
    Location
    USA #1
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dangies. So do I have to create a file for 255 bytes? Bit hacky. You mention the Ascii Character extension? What does that do?

  4. #4
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    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

  5. #5
    Clicker Fusion 2.5SWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SuperDisk's Avatar
    Join Date
    Jul 2012
    Location
    USA #1
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just installed it, and it works like a charm! Thanks LB and Jaffob!

Similar Threads

  1. Sending empty byte with MooSock
    By Blizna in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 25th July 2008, 11:39 PM
  2. About the Byte Array
    By dragonguy in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 13th May 2008, 10:09 PM
  3. [BUG]TextThreshold: 0-byte-exe
    By Quinto in forum Extension Development
    Replies: 2
    Last Post: 7th May 2008, 04:19 PM
  4. Binary Object: Byte returning negative number
    By aidmm in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 19th April 2008, 10:46 AM
  5. Byte Change Example for Blizna
    By neat_Kliker2 in forum File Archive
    Replies: 0
    Last Post: 12th August 2006, 08:45 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •