| 08-14-2003, 01:08 AM | #1 |
For my map, I'm trying to make a password system. I want to make the password shorter by converting the password to base 62, but my function doesn't work and I need help on it. function I2B62 takes integer WhichInteger returns string local string ConvertedNumber = null local integer NumToConvert = WhichInteger local integer Place = 1 local integer IntTemp = 0 loop exitwhen (NumToConvert == 0) loop exitwhen NumToConvert < Place set Place = Place * 62 endloop set IntTemp = NumToConvert / Place set ConvertedNumber = ConvertedNumber + ByteToB62(IntTemp) set Place = Place * IntTemp set NumToConvert = NumToConvert - Place endloop return ConvertedNumber endfunction and this is ByteToB62 function ByteToB62 takes integer b returns string local string charmap = " 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN OPQRSTUVWXYZ" local integer c1 = ModuloInteger( b, 62 ) local integer c2 = b / 62 return SubString( charmap, c2, c2 + 1 ) + SubString( charmap, c1, c1 + 1 ) endfunction Thanks in advance |
