mob/verb/test_symbol_index(index as num)
var/symbols_length = (index == 1 ? 1 : round(log(52,index-1)) + 1)
. = ""
for(var/i = symbols_length-1, i >= 0, i--)
var/base_symbol = round((index-1) / (52**i))
usr << base_symbol
if(base_symbol < 26)
if(base_symbol == -1) . += "Z" //bugfix hack
else . += ascii2text(base_symbol+97)
else . += ascii2text(base_symbol+39)
index %= 52**i
usr << .
Problem description:
DMM files store map symbols in base-52, "numbered" from [a-zA-Z].
If you'll note the comment above, I had to apply a hack to the system because for the even multiples of 52**n (except 52!), the system produces a -1 result for every symbol after the first.
Could anyone help me fix this so I don't need the hack? I'm not sure I understand why it's coming up in the first place.
The procedure is intended to take an integer greater than zero and convert it into the DMM-format base-52.