'Params: Server, Channel, Sender, Msg
dim Name
dim Number
dim Holder
Dim List()
Set sl = StringList.NewObject()
sl.Sorted = true
sl.Delimiter = " "
if StrUtils.Contains(Msg, "plus initiative roll:") = True Then
rem parse the name and number from Msg
'Name
Name = StrUtils.NParam(2,Msg)
Name = StrUtils.DeleteRight(Name, StrUtils.ParamCount(Name), 2)
'Number
Number = strutils.padleft(StrUtils.NParam(StrUtils.ParamCount(Msg),Msg),"0",7)
if number = "0" or number = "1" or number = "2" or number = "3" or number = "4" or number = "5" or number = "6" or number = "7" or number = "8" or number = "9" then number = "0" & number
'Format the info
Holder = Number & Name
'Check for identicals
if strUtils.Contains(Variables.GetVariant(List), Holder) = True then
Holder = ""
end if
'Arrange the order
if Holder <> "" then
' for x = 1 to strutils.ParamCount(variables.GetVariant(List)) step 1
' Channel.command "echo 8List:" & variables.getvariant(List) & " Holder:" & Holder & " Number:" & strUtils.LeftStr(Holder,2) & " MAX:" & strutils.ParamCount(variables.GetVariant(List))
' if Variables.GetVariant(List) = "" Then
' Variables.SetVariant List, Holder & " "
' if strutils.LeftStr(Variables.GetVariant(List),1) = " " Then strutils.LeftTrimChars Variables.GetVariant(List), 1
' exit for
' end if
' if strUtils.LeftStr(Holder, 2) > strutils.LeftStr(strutils.NParam(x,Variables.GetVariant(List)), 2) Then
' Variables.SetVariant List, strutils.Insert(Variables.GetVariant(List),Holder & " ", x-1)
' if strutils.LeftStr(Variables.GetVariant(List),1) = " " Then strutils.LeftTrimChars Variables.GetVariant(List), 1
' exit for
' end if
' Next
' if strUtils.Contains(Variables.GetVariant(List), Holder) = False then
' Variables.SetVariant List, Variables.GetVariant(List) & " " & Holder
' if strutils.LeftStr(Variables.GetVariant(List),1) = " " Then strutils.LeftTrimChars Variables.GetVariant(List), 1
' end if
'***************************************
' put them in the StringList
for i = LBound(Variables.GetVariant(List)) to UBound(Variables.GetVariant(List))
sl.Add( List(i) )
next
sl.Sort
' put them back in the VBScript array
for i = sl.Count() - 1 to 0 step -1
Variables.GetVariant(List(i+1)) = sl.Item(i)
next
'*******************************************
End if
Holder = ""
Name = ""
Number = ""
'Display the info
For x = UBound(variables.GetVariant(List())) to LBound(variables.GetVariant(List())) Step -1
Variables.SetVariant initorder, variables.GetVariant(InitOrder) & Variables.GetVariant(List(x))
Next
Channel.Command "echo 4[5The Initiative order is:7 (" & Variables.GetVariant(InitOrder) & ")4]"
end if