# Example Tcl script for BTrix..
# Simple script to send messages to server upon connecting

# CONFIGURATION #

describe "Example script, demonstrating how to send messages to a server upon connecting."

set onconnect(tetrinet.org) {
/join #idle
}

set onconnect(tetridome.com) {
/join #idle
idling ...
}

set onconnect(pegasus) {
Hi everybody!
}

# END OF CONFIGURATION - STOP EDITTING #

addbind connect btrix:connect

proc btrix:connect {} {
  global onconnect
  set server [string tolower [setserver]]
  if {![info exists onconnect($server)]} { return }

  foreach line [split $onconnect($server) \n] {
    set line [string trim $line]
    if {$line != ""} { plinemsg $line }
  }
}

plinelog "onconnect.tcl v1.1 by strikelight now loaded"
