View/Edit #9682:Bits

Switch to edit mode.

Name(s): Bits
1:  bits = "10110111 01111001 10011110 11000011"
2:  bits = strsub(bits, " ", "")
3:  n = 0.0
4:  for i in [1..32]
5:    if (bits[i] == "1")
6:      n = n + 2.0 ^ (32.0 - tofloat(i))
7:    endif
8:  endfor
9:  player:tell(n)
10: player:tell(n / 2.0 ^ 24.0)
11: n = n - tofloat(toint(n / 2.0 ^ 24.0)) * 2.0 ^ 24.0
12: player:tell(n / 2.0 ^ 16.0)
13: n = n - tofloat(toint(n / 2.0 ^ 16.0)) * 2.0 ^ 16.0
14: player:tell(n / 2.0 ^ 8.0)
15: n = n - 2.0 ^ 8.0
16: player:tell(toint(n) % 256)
17: "Last modified by Dax (#789) on Tue May  3 14:12:00 2005 MDT."

Verb arguments: none none none
Verb perms: Readable NOT-Debug
Verb owned by: Dizzy_Devil (#9682)

You are not logged in.

[home | help | who | search | setup | code]