User Tag List

Results 1 to 2 of 2

Thread: Converting an array of elements containing 1's & 0's to binary string

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleUniversal Windows Platform Export ModuleSWF Export Module

    Join Date
    Jun 2014
    Posts
    26
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Converting an array of elements containing 1's & 0's to binary string

    Hi all.

    I'm trying to convert a 1D array of 8 elements containing only numbers between 0 and 1 to an 8-bit binary string, but I just can't get it right. I'm hoping someone here knows how to do this..

    I've tried things like..

    - set alterable string to (bin$(2 pow(valueAtXY("array", 7,0)*7) ) + (2 pow(valueAtXY("array", 6,0)*6) )+ (2 pow(valueAtXY("array", 5,0)*5) ) +
    [...etc...]
    (2 pow(valueAtXY("array", 1,0)*1) )+(2 pow(valueAtXY("array", 0,0)*0) )

    But this obviously gives me incorrect values. Does anyone know the correct formula? Ideally I want to avoid looping through elements.

    Any kind of help or insight would be much appreciated.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleUniversal Windows Platform Export ModuleSWF Export Module

    Join Date
    Jun 2014
    Posts
    26
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Never mind, I'm an idiot.

    This was the solution...

    Bin$(( ( ( ValueAtXY( "BIT_ARRAY", 7, 0 ) * 128 ) ) + ( ( ValueAtXY( "BIT_ARRAY", 6, 0 ) * 64 ) ) + ( ( ValueAtXY( "BIT_ARRAY", 5, 0 ) * 32 ) ) + ( ( ValueAtXY( "BIT_ARRAY", 4, 0 ) * 16 ) ) + ( ( ValueAtXY( "BIT_ARRAY", 3, 0 ) * 8 ) ) + ( ( ValueAtXY( "BIT_ARRAY", 2, 0 ) * 4 ) ) + ( ( ValueAtXY( "BIT_ARRAY", 1, 0 ) * 2 ) ) + ( ( ValueAtXY( "BIT_ARRAY", 0, 0 ) * 1 ) ) ))

Similar Threads

  1. Replies: 1
    Last Post: 26th June 2015, 10:28 PM
  2. Retrieving Unicode string using binary array
    By danworth in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 22nd March 2012, 03:37 PM
  3. How do binary data elements work/which extensions
    By Pixelthief in forum Multimedia Fusion 2 - Technical Support
    Replies: 16
    Last Post: 2nd May 2011, 04:21 PM
  4. Dynamic Array to Binary Array problems
    By BREK in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 22nd March 2010, 10:48 PM
  5. Converting string to URL
    By MechatheSlag in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 4th October 2008, 11:28 PM

Posting Permissions

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