Sorry for my recent lack of activity/quick response. I'm getting slammed with work and assignments that need attending. I previously investigated this myself, though not to add abilities, and have found the following to work very well. if you need clarification as to anything just ask.
Code:
globals
integer array S2RAW
endglobals
function InitS2RAW takes nothing returns nothing
set S2RAW[s2i("0")]=48
set S2RAW[s2i("1")]=49
set S2RAW[s2i("2")]=50
set S2RAW[s2i("3")]=51
set S2RAW[s2i("4")]=52
set S2RAW[s2i("5")]=53
set S2RAW[s2i("6")]=54
set S2RAW[s2i("7")]=55
set S2RAW[s2i("8")]=56
set S2RAW[s2i("9")]=57
set S2RAW[s2i("a")]=97
set S2RAW[s2i("b")]=98
set S2RAW[s2i("c")]=99
set S2RAW[s2i("d")]=100
set S2RAW[s2i("e")]=101
set S2RAW[s2i("f")]=102
set S2RAW[s2i("g")]=103
set S2RAW[s2i("h")]=104
set S2RAW[s2i("i")]=105
set S2RAW[s2i("j")]=106
set S2RAW[s2i("k")]=107
set S2RAW[s2i("l")]=108
set S2RAW[s2i("m")]=109
set S2RAW[s2i("n")]=110
set S2RAW[s2i("o")]=111
set S2RAW[s2i("p")]=112
set S2RAW[s2i("q")]=113
set S2RAW[s2i("r")]=114
set S2RAW[s2i("s")]=115
set S2RAW[s2i("t")]=116
set S2RAW[s2i("u")]=117
set S2RAW[s2i("v")]=118
set S2RAW[s2i("w")]=119
set S2RAW[s2i("x")]=120
set S2RAW[s2i("y")]=121
set S2RAW[s2i("z")]=122
set S2RAW[s2i("A")]=65
set S2RAW[s2i("B")]=66
set S2RAW[s2i("C")]=67
set S2RAW[s2i("D")]=68
set S2RAW[s2i("E")]=69
set S2RAW[s2i("F")]=70
set S2RAW[s2i("G")]=71
set S2RAW[s2i("H")]=72
set S2RAW[s2i("I")]=73
set S2RAW[s2i("J")]=74
set S2RAW[s2i("K")]=75
set S2RAW[s2i("L")]=76
set S2RAW[s2i("M")]=77
set S2RAW[s2i("N")]=78
set S2RAW[s2i("O")]=79
set S2RAW[s2i("P")]=80
set S2RAW[s2i("Q")]=81
set S2RAW[s2i("R")]=82
set S2RAW[s2i("S")]=83
set S2RAW[s2i("T")]=84
set S2RAW[s2i("U")]=85
set S2RAW[s2i("V")]=86
set S2RAW[s2i("W")]=87
set S2RAW[s2i("X")]=88
set S2RAW[s2i("Y")]=89
set S2RAW[s2i("Z")]=90
endfunction
function s2i takes string s returns integer
return s
return 0
endfunction
function Str2RAW takes string s returns integer
return S2RAW[s2i(SubString(s,0,1))]*0x1000000+S2RAW[s2i(SubString(s,1,2))]*0x10000+S2RAW[s2i(SubString(s,2,3))]*0x100+S2RAW[s2i(SubString(s,3,4))]
endfunction
Simply use Str2RAW("xxxx") and it will return the corresponding integer. This method has many more flexible uses such as password encryption... (hint)
However, for your use, there is a significantly shorter way but first I need to explain how s2i(s) works.
s2i will take any string and convert it to a 2-3 (usually) digit number which gets 'reserved' for that specific string and will never get recycled. Once s2i is used on a string, using the same string again will return the 'reserved' integer.
For example, s2i("PurpleBlurp") might return 21, and 21 will be 'remembered' as "PurpleBlurp". No other string will henceforth return 21 except for "PurpleBlurp".
So, if you had prior knowledge as to the abilities you would like to be adding, instead of using 'set S2RAW[s2i("a")]=97' ...[s2i("b)]=... ect. You could simply use:
set S2RAW[s2i("abcd")]='abcd'
set S2RAW[s2i("A000")]='A000'
(Unless of course there is significantly more abilities than 0-9, a-z, A-Z ... )
If you did this, you could eliminate 'function Str2RAW' altogether and you could do an easy loop to check for invalid ability input.
Anyhow, these are my findings -- please correct me if I'm wrong anywhere.