|
arcanig Newbie
Joined: 21 Jun 2005 Posts: 2
|
Posted: Tue Jun 21, 2005 6:12 pm
Binary string to integer conversion? |
Is there any way to do binary to integer conversions in Zmud?
If I had a string list that was a bunch of binary info, like:
10001101 how could I convert that to an integer, in this case 177 ?
Is this possible and/or easy in Zmud?
Thanks in advance for your help. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Jun 21, 2005 8:56 pm |
Definitely possible. Built into ZMud as a handy-dandy #command or %function()? Nope, you'll have to build your own (via #ALIAS or #FUNCTION). I don't recall the rules of binary conversion, though, so not much help from me on that front.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
temper Newbie
Joined: 06 Jun 2005 Posts: 6 Location: Ruston, La
|
Posted: Tue Jun 21, 2005 9:33 pm |
**thinks openly**
oh now thats cool to know. decoding binary is definately a cool idea for muds.
well, the trigger to do that would be really easy, just a set of divisions by 2 with a log of the remainder. |
|
|
|
Full Throttle Wanderer
Joined: 07 Dec 2004 Posts: 65
|
Posted: Tue Jun 21, 2005 10:08 pm |
#echo %mss(parseInt(10001101,2),JScript)
btw, 10001101 binary is equal to 141 decimal |
|
|
|
arcanig Newbie
Joined: 21 Jun 2005 Posts: 2
|
Posted: Wed Jun 22, 2005 4:56 pm |
hehe, I was counting it up backwards....low to high stead of high to low.
so, %mss(parseInt(<bin string>,2),JScript)
cool Ill try that!
(im trying to make alot of COM communications simpler by converting many pieces of binary data into a single integer data transfer)
Thanks for all the help! |
|
|
|
|
|