Suggest you get rid of the aliases you have, and make it a function (my second one, the regexp). Then your aliases become this simple:
<aliases>
<alias
match="^(say|ic|yell) (.*)$"
enabled="y"
echo_alias="y"
regexp="y"
send_to="12"
ignore_case="y"
keep_evaluating="y"
sequence="100"
>
<send>send "%1 " & colorizeRand("%2","\\s*\\S+\\s*") & "^^"</send>
</alias>
<alias
match="^sayto (\w+) (.*)$"
enabled="y"
echo_alias="y"
regexp="y"
send_to="12"
ignore_case="y"
keep_evaluating="y"
sequence="100"
>
<send>send "sayto %1 " & colorizeRand("%2","\\s*\\S+\\s*") & "^^"</send>
</alias>
</aliases>
And the code (since I renamed it colorizeRand to reflect the random color, you can change it back of course):
Randomize
function colorizeRand (sLine, reSplit)
dim codes, colored
dim uCodes, i 'length (UBound)
dim regEx, Matches, Match
'codes = array("^^","^o","^W")
'Start Randomization
i = Int(6*Rnd)
select case (i)
case 0
codes = Array("^o","^W","^^")
case 1
codes = Array("^o","^^","^W")
case 2
codes = Array("^W","^o","^^")
case 3
codes = Array("^W","^^","^o")
case 4
codes = Array("^^","^W","^o")
case else 'we could do 5, but just incase
'someone edits something they shouldn't
codes = Array("^^","^o","^W")
end select
'End Randomization
uCodes = UBound(codes)
Set regEx = New RegExp
regEx.pattern = reSplit
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(sLine)
i = 0
colored = ""
for each Match in Matches
colored = colored & codes(i mod (uCodes+1)) & Match
i = i + 1
next
colorizeRand = colored
end function
|