Problem with BinaryEncode and variable params

Mark Smith mark at maseurope.net
Sat Dec 16 20:20:27 EST 2006


Bryan, for the purposes of encoding image data (1-byte unsigned  
integers), the numToChar function works just as well:

repeat for each item i in tList
   put numToChar(i) after tBinaryString
end repeat

Otherwise, "C4" (rather than "CCCC") has always worked for me...

Best,

Mark

On 16 Dec 2006, at 16:06, Bryan McCormick wrote:

> Folks,
>
> I am a bit baffled here. I have seen many sample scripts where  
> variables are passed as parameter to binaryEncode (in my case, for  
> imageData) but no matter how I try to pass the known numeric  
> values, the compiler throws an error.
>
> For example:
>
> take a string of the form 0,206,0 as returned from the color  
> picker, let's call this tColors
>
> Then I put each value into a separate param
>
> put item 1 of tColors+0 into c1
>
> put item 2 of tColors+0 into c2
>
> put item 3 of tColors+0 into c3
>
> (I added the +0 to make sure the var was seen as a number, I tried  
> it without as well with the same error)
>
>
> Then I call:
>
> put binaryEncode("CCCC",0,c1,c2,c3) into varNewImageData
>
>
> and it fails.
>
> I tried to pass all the params as a quoted string, concatenated,  
> you name it I have tried it.
>
> It's likely dead simple. But for the life of me I cannot get it.
>
> This is in 2.7.4
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list