######################TAB SCRIPT######################
# This has been revised. Now, instead of rotating the list on tab,
# it seeks through the list. If an entry is used, it is removed from
# its old position and placed at the head of the list. Thus if you
# are currently talking to just two people, it cycles between them
# without having to go back through the entire list.
#############
# The old one:
bind ^I PARSE_COMMAND Tab.DoNext

@ Tab.Number = 0
@ Tab.Nick = 0
alias Tab.AddList {
        @ Tab.Number = 0
        @ Tab.Nick = MATCH($0 $Tab.Table)
        ^if ( Tab.Nick )
		{ Tab.ShiftUp $Tab.Nick $Tab.Table }
		{ @ Tab.Table = [$0 ] ## Tab.Table }
}
alias Tab.ShiftUp {
        if ( [$0] > 0 )
		{ @ Tab.Table = [$($0) $(1-${[$0]-1}) $(${[$0]+1}-)] }
        @ Tab.Nick = 0
}
alias Tab.Show Type ^U/msg $($Tab.Nick) 
alias Tab.Rotate {
        @ Tab.Nick = Tab.Nick+1
        Tab.CTBounds $()
}
alias Tab.CTBounds {
	if ( Tab.Nick > #Tab.Table-1 )
		{ @ Tab.Nick = 0 } $()
}
alias Tab.DoNext {
        ^if ( Tab.Number > 0 )
		{ ^Tab.Rotate $Tab.Table }
		{ @ Tab.Number = 1 }
        ^Tab.Show_Next $()
}
alias Tab.Show_Next Tab.Show $Tab.Table $()
on #^SEND_MSG 104 * {
        Tab.AddList $0
}
alias HClear ^Assign -Tab.Table $()
alias HList echo $Tab.Table $()

######################## END OF TAB SCRIPT

