All pastes #498011 Raw Edit

Shoat

public text v1 · immutable
·published 2007-05-20 04:54 UTC
rendered paste body
'Params: Server, Channel, Sender, Msg
dim Name
dim Number
dim Holder
Dim List

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.NParam(StrUtils.ParamCount(Msg),Msg)
    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 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
End if

	Holder = ""
	Name = ""
	Number = ""

 	'Display the info
    Variables.SetVariant initorder, Variables.GetVariant(List)
	Channel.Command "echo 4[5The Initiative order is:7 (" & Variables.GetVariant(InitOrder) & ")4]"

end if