This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

need help changing team manager script

Support & discussion of released scripts, and announcements of new releases.
Post Reply
R
R-WaT
Halfop
Posts: 79
Joined: Fri Jan 06, 2006 7:45 pm

need help changing team manager script

Post by R-WaT »

<rwat^ms> .commands
-MouseSkills- You can use these commands :
-MouseSkills- commands: .test .penis .lawler .website
-MouseSkills- .steamid to retrieve steamid.
-MouseSkills- .searchsteam to search server, map, player.
-MouseSkills- .last Shows you last match(es).
-MouseSkills- .next Shows you the next match.
-MouseSkills- .record Shows you the records.


I dont want mouseskills replying with all that info. I just want it to say "Commands - .command .command .commands" and thats it.

Code: Select all

# needs: tfile(dir/ver)

# include files needed

set tfile(cmm) "$tfile(dir)/team-common.dat"
set tfile(cms) "0"

# team-#channel.dat

proc learn:rcf {channel} {
   global tfile
   if {$tfile(cms) == 1} {
     return $tfile(cmm)
   } else {
     return $tfile(dir)/team-$channel.dat
   }
 }

# team-#channel.dat.aux

proc learn:rcx {channel} {
   global tfile
   if {$tfile(cms) == 1} {
     return $tfile(cmm).aux
   } else {
     return $tfile(dir)/team-$channel.dat.aux
   }
 }

proc pub:learn:cmd {nick host hand channel text} {
   global tfile ttrig
   if {[channel get $channel noteam]} {
     return 0
   }  
   if {[lindex $text 0] == ""} {
     putserv "notice $nick :$ttrig(cmd) <option> ... (rev. $tfile(ver))"
     putserv "notice $nick :$ttrig(get) <command> (notice)"
     putserv "notice $nick :$ttrig(teg) <command> (channel)"
     if {[matchattr [nick2hand $nick] f]} {
       putserv "notice $nick :$ttrig(cmd) <command> <definition>"
     }
     putserv "notice $nick :bug reports or innovations to http://sourceforge.net/projects/teambot/"
     return 0
    }

   if {[lindex $text 0] == "-a"} {
     pub:learn:add $nick $channel [lrange $text 1 end]
     return 0
   }

   if {[lindex $text 0] == "-d"} {
     pub:learn:del $nick $channel [lrange $text 1 end]
     return 0
   }
  
   if {[lindex $text 0] == "commands" || [lindex $text 0] == "roster" || [lindex $text 0] == "servers" || [lindex $text 0] == "sponsors" || [lindex $text 0] == "rules" || [lindex $text 0] == "news" || [lindex $text 0] == "leagues" || [lindex $text 0] == "practices" || [lindex $text 0] == "web" || [lindex $text 0] == "motd"} { 
     pub:learn:del $nick $channel [lrange $text 0 0]
     pub:learn:add $nick $channel [lrange $text 0 end]
     return 0
   }

   putserv "notice $nick :invalid option.  option: commands, roster, servers, sponsors, rules, news, leagues, practices, web, motd "
  }


proc team:commands {nick host hand channel text} {
   global ttrig tfile tmatch
   if {[channel get $channel noteam]} {
     return 0
   }  
   if {$tmatch(queue)!=""} {
     if {[expr [unixtime] - $tmatch(queue)] <$tmatch(sec)} {
       putserv "notice $nick : Someone is already requesting help, try again in $tmatch(sec) seconds please"
       return 0
     }
   }
   set tmatch(queue) [unixtime]
   putserv "notice $nick :You can use these commands :"
   pub:learn:get $nick $host $hand $channel commands
   putserv "notice $nick :\002$ttrig(get)steamid\002 to retrieve steamid."
   putserv "notice $nick :\002$ttrig(get)searchsteam\002 to search server, map, player."
   putserv "notice $nick :\002$ttrig(get)last\002 Shows you last match(es)."
   putserv "notice $nick :\002$ttrig(get)next\002 Shows you the next match."
   putserv "notice $nick :\002$ttrig(get)record\002 Shows you the records."
   }

proc team:roster {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   }  
   pub:learn:get $nick $host $hand $channel roster
   }

proc team:servers {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   }  
   pub:learn:get $nick $host $hand $channel servers
   }

proc team:sponsors {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   }  
   pub:learn:get $nick $host $hand $channel sponsors
   }

proc team:rules {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   }  
   pub:learn:get $nick $host $hand $channel rules
   }

proc team:news {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   }  
   pub:learn:get $nick $host $hand $channel news
   }
   
proc team:leagues {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   }  
   pub:learn:get $nick $host $hand $channel leagues
   }

proc team:practices {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   }  
   pub:learn:get $nick $host $hand $channel practices
   }

proc team:web {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   }  
   pub:learn:get $nick $host $hand $channel web
   }

proc team:help {nick uhost handle channel arg} {
   global ttrig tfile tmatch
   if {[channel get $channel noteam]} {
     return 0
   } 
   if {[matchattr $handle T|T $channel]} {
     putserv "notice $nick :You can use these commands :"
     putserv "notice $nick :\002$ttrig(get)addmatch\002 team(xxx) date(hh:mm-mm/dd/yy) map(x) ( + infos(x) ) Add a match un the calendar, info(x) are not required."
     putserv "notice $nick :\002$ttrig(get)addresult\002 <id> <your-score> <opponent-socre> Add a result on a pending match."
     putserv "notice $nick :\002$ttrig(get)chinfo\002 <id> <new entries>. Change stored informations about <id>." 
     putserv "notice $nick :\002$ttrig(get)delete\002 <id> Delete a match from database."
     putserv "notice $nick :\002$ttrig(get)id\002 Shows you last entries in database and the ID (set by default to $tmatch(shownumber))."
     putserv "notice $nick :\002$ttrig(get)pending\002 <x> Shows you the more recent match(es) waiting for a result."
     putserv "notice $nick :\002$ttrig(get)upcoming\002 <x> Shows you the next <x> matches in the calendar."
     putserv "notice $nick :team manager v$tfile(ver) by LorT"
   }  
  }

# needs: learn:rcf

proc learn:get {channel unikey uniidx} {
   set rslt [list]

   set fp [open [learn:rcf $channel] r]

   while {![eof $fp]} {
     set line [gets $fp]
     if {[lindex $line 0] == $unikey} {
	  set rslt [linsert $rslt 0 $line]
     }
   }

   close $fp

  # reverse stack list (shouldn't happen :-()

   set tlsr [list]

   foreach unikey $rslt {
     set tlsr [linsert $tlsr 0 $unikey]
   }

   return $tlsr
 }

proc learn:dln {nick list idx udx} {
   foreach unikey $list {
     if {[lrange $unikey 0 0] == "motd"} {
       putserv "notice $nick : [join [lrange $unikey 1 end]]" 
     } else { 
       putserv "notice $nick :\002[join [lrange $unikey 0 0]]:\002 [join [lrange $unikey 1 end]]"
    }
  } 
}

proc learn:dlc {channel list idx udx} {
   foreach unikey $list {
     putserv "privmsg $channel :\002[join [lrange $unikey 0 0]]:\002 [join [lrange $unikey 1 end]]"
     }
  }

proc learn:cdf {channel unikey} {

   set bdc 0
   set fp [open [learn:rcf $channel] r]

   while {![eof $fp]} {
     set line [gets $fp]
     if {[lindex $line 0] == $unikey} {
       incr bdc
     }
   }

   close $fp

   return $bdc
  }

proc pub:learn:get {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   }  

  if {[lindex $text 0] == ""} {
    puthelp "notice $nick :invalid syntax"
    return 0
  }

  if {![file exists [learn:rcf $channel]]} {
    return 0
  }

  set unikey [string tolower [lindex $text 0]]
  set uniidx 0

  if {[string is integer -strict [lindex $text 1]]} {
    set uniidx [lindex $text 1]
  }

  set rslt [learn:get $channel $unikey $uniidx]

  if {$rslt == ""} {
  } else {
    learn:dln $nick $rslt $uniidx [learn:cdf $channel $unikey]
  }
}

proc pub:learn:teg {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   }  

  if {[lindex $text 0] == ""} {
    puthelp "notice $nick :invalid syntax"
    return 0
  }

  if {![file exists [learn:rcf $channel]]} {
    return 0
  }

  set unikey [string tolower [lindex $text 0]]
  set uniidx 0

  if {[string is integer -strict [lindex $text 1]]} {
    set uniidx [lindex $text 1]
  }

  set rslt [learn:get $channel $unikey $uniidx]

  if {$rslt == ""} {
  } else {
    learn:dlc $channel $rslt $uniidx [learn:cdf $channel $unikey]
  }
}

# needs: tfile(max/def) learn:rcf

proc learn:cdef {unikey channel} {

  set bdc 0
  set fp [open [learn:rcf $channel] r]

  while {![eof $fp]} {
    set line [gets $fp]
    if {[lindex $line 0] == $unikey} {
      incr bdc
    }
  }
  close $fp
  return $bdc
}

proc pub:learn:add {nick channel text} {
  global tfile

  if {[lindex $text 1] == ""} {
    putserv "notice $nick :invalid syntax"
    return 0
  }

  if {![file exists [learn:rcf $channel]]} {
    set fp [open [learn:rcf $channel] a]
    close $fp
  }

  set unikey [string tolower [lindex $text 0]]
  set phrase [lrange $text 1 end]
  set time [strftime %FT%TZ]

  if {[learn:cdef $unikey $channel] == $tfile(def)} {
    putserv "notice $nick :table full ($tfile(def)).  not added"
    return 0
  }

  if {[string length $phrase] < $tfile(max)} {
    set fp [open [learn:rcf $channel] a]
    puts $fp "$unikey [join [lrange [split $phrase] 0 end]]"
    close $fp
    putserv "notice $nick :command recorded"
  } else {
    putserv "notice $nick :command too long (+ $tfile(max) chars)"
  }
}

# needs: learn:rcf learn:rcx
# team-dell.tcl

proc learn:del {channel unikey uniidx} {

  set idct 0
  set fp1 [open [learn:rcf $channel] r]
  set fp2 [open [learn:rcx $channel] a]

  while {![eof $fp1]} {

    set line [gets $fp1]

    if {$line != ""} {
      if {[lindex $line 0] != $unikey} {
        puts $fp2 $line
      } else {
        incr idct
	if {$uniidx != $idct && $uniidx != 0} {
	  puts $fp2 $line
	}
      }
    }
  }
  close $fp1
  close $fp2
  exec rm -f [learn:rcf $channel]
  exec mv [learn:rcx $channel] [learn:rcf $channel]
}

proc pub:learn:del {nick channel text} {
   if {[channel get $channel noteam]} {
     return 0
   }  

  if {[lindex $text 0] == ""} {
    putserv "notice $nick :invalid syntax"
    return 0
  }

  if {![file exists [learn:rcf $channel]]} {
    return 0
  }

  set unikey [string tolower [lindex $text 0]]
  set uniidx 0

  if {[string is integer -strict [lindex $text 1]]} {
    set uniidx [lindex $text 1]
  }

  set rslt [learn:get $channel $unikey $uniidx]

  if {$rslt == ""} {
#    putserv "notice $nick :key not found"
  } else {
    learn:del $channel $unikey $uniidx
#    putserv "notice $nick :key forgotten"
  }
}

putlog "team-cmd.tcl, original by mferra"
W
Winters
Voice
Posts: 29
Joined: Sat Jul 09, 2005 12:24 pm

Post by Winters »

Code: Select all

# needs: tfile(dir/ver)

# include files needed

set tfile(cmm) "$tfile(dir)/team-common.dat"
set tfile(cms) "0"

# team-#channel.dat

proc learn:rcf {channel} {
   global tfile
   if {$tfile(cms) == 1} {
     return $tfile(cmm)
   } else {
     return $tfile(dir)/team-$channel.dat
   }
 }

# team-#channel.dat.aux

proc learn:rcx {channel} {
   global tfile
   if {$tfile(cms) == 1} {
     return $tfile(cmm).aux
   } else {
     return $tfile(dir)/team-$channel.dat.aux
   }
 }

proc pub:learn:cmd {nick host hand channel text} {
   global tfile ttrig
   if {[channel get $channel noteam]} {
     return 0
   } 
   if {[lindex $text 0] == ""} {
     putserv "notice $nick :$ttrig(cmd) <option> ... (rev. $tfile(ver))"
     putserv "notice $nick :$ttrig(get) <command> (notice)"
     putserv "notice $nick :$ttrig(teg) <command> (channel)"
     if {[matchattr [nick2hand $nick] f]} {
       putserv "notice $nick :$ttrig(cmd) <command> <definition>"
     }
     putserv "notice $nick :bug reports or innovations to http://sourceforge.net/projects/teambot/"
     return 0
    }

   if {[lindex $text 0] == "-a"} {
     pub:learn:add $nick $channel [lrange $text 1 end]
     return 0
   }

   if {[lindex $text 0] == "-d"} {
     pub:learn:del $nick $channel [lrange $text 1 end]
     return 0
   }
 
   if {[lindex $text 0] == "commands" || [lindex $text 0] == "roster" || [lindex $text 0] == "servers" || [lindex $text 0] == "sponsors" || [lindex $text 0] == "rules" || [lindex $text 0] == "news" || [lindex $text 0] == "leagues" || [lindex $text 0] == "practices" || [lindex $text 0] == "web" || [lindex $text 0] == "motd"} {
     pub:learn:del $nick $channel [lrange $text 0 0]
     pub:learn:add $nick $channel [lrange $text 0 end]
     return 0
   }

   putserv "notice $nick :invalid option.  option: commands, roster, servers, sponsors, rules, news, leagues, practices, web, motd "
  }


proc team:commands {nick host hand channel text} {
   global ttrig tfile tmatch
   if {[channel get $channel noteam]} {
     return 0
   } 
   if {$tmatch(queue)!=""} {
     if {[expr [unixtime] - $tmatch(queue)] <$tmatch(sec)} {
       putserv "notice $nick : Someone is already requesting help, try again in $tmatch(sec) seconds please"
       return 0
     }
   }
   set tmatch(queue) [unixtime]
   putserv "notice $nick :You can use these commands :"
   pub:learn:get $nick $host $hand $channel commands
   putserv "notice $nick :\002$ttrig(get)steamid\002, \002$ttrig(get)searchsteam\002, \002$ttrig(get)last\002, \002$ttrig(get)next\002, \002$ttrig(get)record\002."
   }

proc team:roster {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   } 
   pub:learn:get $nick $host $hand $channel roster
   }

proc team:servers {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   } 
   pub:learn:get $nick $host $hand $channel servers
   }

proc team:sponsors {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   } 
   pub:learn:get $nick $host $hand $channel sponsors
   }

proc team:rules {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   } 
   pub:learn:get $nick $host $hand $channel rules
   }

proc team:news {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   } 
   pub:learn:get $nick $host $hand $channel news
   }
   
proc team:leagues {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   } 
   pub:learn:get $nick $host $hand $channel leagues
   }

proc team:practices {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   } 
   pub:learn:get $nick $host $hand $channel practices
   }

proc team:web {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   } 
   pub:learn:get $nick $host $hand $channel web
   }

proc team:help {nick uhost handle channel arg} {
   global ttrig tfile tmatch
   if {[channel get $channel noteam]} {
     return 0
   }
   if {[matchattr $handle T|T $channel]} {
     putserv "notice $nick :You can use these commands :"
     putserv "notice $nick :\002$ttrig(get)addmatch\002 team(xxx) date(hh:mm-mm/dd/yy) map(x) ( + infos(x) ) Add a match un the calendar, info(x) are not required."
     putserv "notice $nick :\002$ttrig(get)addresult\002 <id> <your-score> <opponent-socre> Add a result on a pending match."
     putserv "notice $nick :\002$ttrig(get)chinfo\002 <id> <new entries>. Change stored informations about <id>."
     putserv "notice $nick :\002$ttrig(get)delete\002 <id> Delete a match from database."
     putserv "notice $nick :\002$ttrig(get)id\002 Shows you last entries in database and the ID (set by default to $tmatch(shownumber))."
     putserv "notice $nick :\002$ttrig(get)pending\002 <x> Shows you the more recent match(es) waiting for a result."
     putserv "notice $nick :\002$ttrig(get)upcoming\002 <x> Shows you the next <x> matches in the calendar."
     putserv "notice $nick :team manager v$tfile(ver) by LorT"
   } 
  }

# needs: learn:rcf

proc learn:get {channel unikey uniidx} {
   set rslt [list]

   set fp [open [learn:rcf $channel] r]

   while {![eof $fp]} {
     set line [gets $fp]
     if {[lindex $line 0] == $unikey} {
     set rslt [linsert $rslt 0 $line]
     }
   }

   close $fp

  # reverse stack list (shouldn't happen :-()

   set tlsr [list]

   foreach unikey $rslt {
     set tlsr [linsert $tlsr 0 $unikey]
   }

   return $tlsr
 }

proc learn:dln {nick list idx udx} {
   foreach unikey $list {
     if {[lrange $unikey 0 0] == "motd"} {
       putserv "notice $nick : [join [lrange $unikey 1 end]]"
     } else {
       putserv "notice $nick :\002[join [lrange $unikey 0 0]]:\002 [join [lrange $unikey 1 end]]"
    }
  }
}

proc learn:dlc {channel list idx udx} {
   foreach unikey $list {
     putserv "privmsg $channel :\002[join [lrange $unikey 0 0]]:\002 [join [lrange $unikey 1 end]]"
     }
  }

proc learn:cdf {channel unikey} {

   set bdc 0
   set fp [open [learn:rcf $channel] r]

   while {![eof $fp]} {
     set line [gets $fp]
     if {[lindex $line 0] == $unikey} {
       incr bdc
     }
   }

   close $fp

   return $bdc
  }

proc pub:learn:get {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   } 

  if {[lindex $text 0] == ""} {
    puthelp "notice $nick :invalid syntax"
    return 0
  }

  if {![file exists [learn:rcf $channel]]} {
    return 0
  }

  set unikey [string tolower [lindex $text 0]]
  set uniidx 0

  if {[string is integer -strict [lindex $text 1]]} {
    set uniidx [lindex $text 1]
  }

  set rslt [learn:get $channel $unikey $uniidx]

  if {$rslt == ""} {
  } else {
    learn:dln $nick $rslt $uniidx [learn:cdf $channel $unikey]
  }
}

proc pub:learn:teg {nick host hand channel text} {
   if {[channel get $channel noteam]} {
     return 0
   } 

  if {[lindex $text 0] == ""} {
    puthelp "notice $nick :invalid syntax"
    return 0
  }

  if {![file exists [learn:rcf $channel]]} {
    return 0
  }

  set unikey [string tolower [lindex $text 0]]
  set uniidx 0

  if {[string is integer -strict [lindex $text 1]]} {
    set uniidx [lindex $text 1]
  }

  set rslt [learn:get $channel $unikey $uniidx]

  if {$rslt == ""} {
  } else {
    learn:dlc $channel $rslt $uniidx [learn:cdf $channel $unikey]
  }
}

# needs: tfile(max/def) learn:rcf

proc learn:cdef {unikey channel} {

  set bdc 0
  set fp [open [learn:rcf $channel] r]

  while {![eof $fp]} {
    set line [gets $fp]
    if {[lindex $line 0] == $unikey} {
      incr bdc
    }
  }
  close $fp
  return $bdc
}

proc pub:learn:add {nick channel text} {
  global tfile

  if {[lindex $text 1] == ""} {
    putserv "notice $nick :invalid syntax"
    return 0
  }

  if {![file exists [learn:rcf $channel]]} {
    set fp [open [learn:rcf $channel] a]
    close $fp
  }

  set unikey [string tolower [lindex $text 0]]
  set phrase [lrange $text 1 end]
  set time [strftime %FT%TZ]

  if {[learn:cdef $unikey $channel] == $tfile(def)} {
    putserv "notice $nick :table full ($tfile(def)).  not added"
    return 0
  }

  if {[string length $phrase] < $tfile(max)} {
    set fp [open [learn:rcf $channel] a]
    puts $fp "$unikey [join [lrange [split $phrase] 0 end]]"
    close $fp
    putserv "notice $nick :command recorded"
  } else {
    putserv "notice $nick :command too long (+ $tfile(max) chars)"
  }
}

# needs: learn:rcf learn:rcx
# team-dell.tcl

proc learn:del {channel unikey uniidx} {

  set idct 0
  set fp1 [open [learn:rcf $channel] r]
  set fp2 [open [learn:rcx $channel] a]

  while {![eof $fp1]} {

    set line [gets $fp1]

    if {$line != ""} {
      if {[lindex $line 0] != $unikey} {
        puts $fp2 $line
      } else {
        incr idct
   if {$uniidx != $idct && $uniidx != 0} {
     puts $fp2 $line
   }
      }
    }
  }
  close $fp1
  close $fp2
  exec rm -f [learn:rcf $channel]
  exec mv [learn:rcx $channel] [learn:rcf $channel]
}

proc pub:learn:del {nick channel text} {
   if {[channel get $channel noteam]} {
     return 0
   } 

  if {[lindex $text 0] == ""} {
    putserv "notice $nick :invalid syntax"
    return 0
  }

  if {![file exists [learn:rcf $channel]]} {
    return 0
  }

  set unikey [string tolower [lindex $text 0]]
  set uniidx 0

  if {[string is integer -strict [lindex $text 1]]} {
    set uniidx [lindex $text 1]
  }

  set rslt [learn:get $channel $unikey $uniidx]

  if {$rslt == ""} {
#    putserv "notice $nick :key not found"
  } else {
    learn:del $channel $unikey $uniidx
#    putserv "notice $nick :key forgotten"
  }
}

putlog "team-cmd.tcl, original by mferra"
This should work :)
Post Reply