I am editing a script to do the following things on a TEXT TRIGGER.  The part I cannot figure out
is how to get the script to do the things as listed in order, instead of randomly.


-- Here is what I want the script to do ...



set {mc_resp(*test*)}		{"/me warns %nick :: Warning #1"
                                 "/me warns %nick :: Warning #2 - Kicked"
                                 "/me warns %nick :: Warning #3 - Banned"}

-- Im pretty sure this is the line that needs to be changed ...

set alltext [lindex $text [rand [llength $text]]]

-- Here's the code in it's original form ...

 # loop through all above responses with the received line:
 # "search" is the received line.
 foreach search [string tolower [array names mc_resp]] {

  # if we have a match:  
  # (if "search" (*hello*bob*) matches "args" (why, hello bob!))
  if {[string match $search $args]} {

   # put the entire message (bot reply) in the text variable since we'll be using it:
   set text [mc:resp:rep $mc_resp($search) $nick $uhost $hand $chan]

   # pick a random reply if there are multiple defined:
   set alltext [lindex $text [rand [llength $text]]]

   # if the reply contains a \n, split it in multiple commands:
   set alltext [split $alltext "\n"]
   foreach text $alltext {

    # strip any spaces at end or front
    set text [string trim $text]

		# search : *hello*bob*
		# args   : hello bob, good to see you
		# text   : Thanks, it's good to see you too


    # lets see if we can assign text to variables:
    regsub -all "\\*" $search "(.\*)" regtext

    set TXT1 "."
    set TXT2 "."
    set TXT3 "."
    set TXT4 "."
    set TXT5 "."
    set TXT6 "."

    regexp $regtext $args match_var TXT1 TXT2 TXT3 TXT4 TXT5 TXT6

    regsub "%1" $text $TXT1 text
    regsub "%2" $text $TXT2 text
    regsub "%3" $text $TXT3 text
    regsub "%4" $text $TXT4 text
    regsub "%5" $text $TXT5 text
    regsub "%6" $text $TXT6 text