Ok, I'll do this step by step, just so it's more instructional than just doing it for you.. I'll have it all together at the end of the post..
First, for your trigger, we would need to create an event binding for outbound partyline chat, which we would do as such:
Code:
addbind pmsgout erp:start
# erp:start will be our procedure bound to outbound partyline chat
Now, we will need to make the actual code to check the out-going text for the trigger:
Code:
proc erp:start {text} {
# grab the first 'word' of the outgoing text, and make it lowercase
set cmd [string tolower [lindex [split $text] 0]]
# compare the cmd to what we are looking for
if {$cmd == "/script1"} {
# we'll need access to a global variable to check if script is running
global erp
# check that global variable now
if {![info exists erp(timer)]} {
# variable doesn't exist, or is currently turned off
# create a timer event
set erp(timer) [after 20000 erp:timer]
# send a message saying we've started
plinelog "Erp Timer started..."
} else {
# it was already on, let's turn it off
catch {after cancel $erp(timer)}
catch {unset erp(timer)}
# display a message we've turned it off
plinelog "Erp Timer disabled"
}
}
}
Next, we'll need the actual timer code for the proc we are calling in the above code:
Code:
proc erp:timer {} {
# define the lines of text
set lines [list "line1 goes here" "line2 goes here"]
# next loop through our lines
foreach line $lines {
# display the line
plinemsg $line
}
# re-fire the timer
global erp
set erp(timer) [after 20000 erp:timer]
}
And done...
So putting it all together we get a small script like such:
Code:
addbind pmsgout erp:start
proc erp:start {text} {
set cmd [string tolower [lindex [split $text] 0]]
if {$cmd == "/script1"} {
global erp
if {![info exists erp(timer)]} {
set erp(timer) [after 20000 erp:timer]
plinelog "Erp Timer started..."
} else {
catch {after cancel $erp(timer)}
catch {unset erp(timer)}
plinelog "Erp Timer disabled"
}
}
}
proc erp:timer {} {
set lines [list "line1 goes here" "line2 goes here"]
foreach line $lines {
plinemsg $line
}
global erp
set erp(timer) [after 20000 erp:timer]
}
plinelog "erp-timer.tcl loaded"
Hope this helps...