|
# Example Tcl script for BTrix.. |
|
|
# Simple script to send messages to server upon connecting |
|
|
# Lines starting with the number sign are only comments and not actual code, and Tcl will disregard them |
|
# CONFIGURATION # |
|
|
# Give the script a description to be shown in the Misc. Settings/Scripts section of the program |
|
|
describe "Example script, demonstrating how to send messages to a server upon connecting." |
|
|
# Set the variable onconnect(server-name-here) to the partyline messages to perform upon connecting to the specified server |
|
|
set onconnect(tetrinet.org) { |
|
|
/join #idle |
|
|
} |
|
|
set onconnect(tetridome.com) { |
|
|
/join #idle |
|
|
idling ... |
|
|
} |
|
|
set onconnect(pegasus) { |
|
|
Hi everybody! |
|
|
} |
|
|
# END OF CONFIGURATION - STOP EDITTING # |
|
# Create a binding for the connect event with a procedure name for blocktrix to call upon the connect event triggering |
|
|
addbind connect btrix:connect |
|
# Define the procedure associated with the above binding |
|
|
proc btrix:connect {} { |
|
|
global onconnect |
|
|
set server [string tolower [setserver]] |
|
|
if {![info exists onconnect($server)]} { return } |
|
|
foreach line [split $onconnect($server) ] { |
|
|
set line [string trim $line] |
|
|
if {$line != ""} { plinemsg $line } |
|
|
} |
|
|
} |
|
|
# Simple log message to show script has loaded |
|
|
plinelog "onconnect.tcl v1.1 by strikelight now loaded" |
|
See Also: |
|
|
Tcl Commands Contents |
|