ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: xenoglyph on August 23, 2009, 01:50:40 AM
-
say for instance I have an EUO id of XG or YG, how do i convert that to an integer? it's not base 26.
-
lemme look around, I have a couple routines written that does the conversion.
-
Here's something I came up with; Boydon gave me the original code:
private string hex2euo(int hexid)
{
string rval = "";
for (int i = (hexid ^ 0x45) + 7; i > 0; i /= 26)
rval += (char)((i % 26) + 'A');
return rval;
}
private int euotohex(string euoid)
{
int hexid = 0;
for (int j=0, i = 1; j<euoid.Length; j++ , i *= 26)
hexid += (int)(euoid[j] - 'A') * i;
hexid = (hexid - 7) ^ 0x45;
return hexid;
}
-
hell yah, thanks! that was fast.
-
Heh, I already plugged them into your code when I was playing. ;)