What i have is this :kenh83 wrote:show us what you got so far.
Code: Select all
#timer 1 pingserver
proc tssync {} {
putquick "PRIVMSG ###1 :cool boobs111"
timer 1 tssync
}
Congrats!Gemster wrote:Hi, im new to tcl, well been trying to learn it for like 3 days only.
Anyways, i need a simple script that when i do .starttss trigger in a channel it will start a timer and every hour it will do this command "privmsg operserv tssync"
then on trigger .stoptss it stops it. I tryed useing the timer and utimer but it failed big time :/
Code: Select all
bind pub - "!starttss" tss_start
bind pub - "!stoptss" tss_stop
proc tss_start {nick uhost handle chan text} {
bind cron - "* * * * *" say_it
}
proc say_it {min hour day month weekday} {
putserv "privmsg ###1 : whatever you want to say goes here "
}
proc tss_stop {nick uhost handle chan text} {
unbind cron - "* * * * *" say_it
}
Code: Select all
bind cron - "0 * * * *" say_it
You might like to check out:Gemster wrote:Hi, im new to tcl, well been trying to learn it for like 3 days only.
....
Code: Select all
bind cron - {* */1 * * *} cron:sync
proc cron:sync {minute hour day month weekday} {
putserv "PRIVMSG OperServ :tssync"
}
Code: Select all
bind time - "00 * * * *" time:sync
proc time:sync {min hour day month year} {
putserv "PRIVMSG OperServ :tssync"
}
Code: Select all
bind pub n .tssync switch:sync
proc switch:sync {nick uhost handle chan text} {
switch -nocase -- [lindex [split $text] 0] {
"on" {
putserv "NOTICE $nick :TSSync turned on."
bind cron - {* */1 * * *} cron:sync
}
"off" {
putserv "NOTICE $nick :TSSync turned off."
unbind cron - {* */1 * * *} cron:sync
}
default {
putserv "NOTICE $nick :Use .tssync on/off."
}
}
}
proc cron:sync {minute hour day month weekday} {
putserv "PRIVMSG OperServ :tssync"
}
Code: Select all
bind cron - "* * * * *" say_it
unbind cron - "* * * * *" say_it
Code: Select all
bind cron - {* */1 * * *} say_it
unbind cron - {* */1 * * *} say_it
Code: Select all
bind cron - "0 * * * *" say_it
Code: Select all
bind cron - "0 * * * *" say_it
Code: Select all
if {user input after the .tssync is on} {
#do this
}
if {user input after the .tssync is off} {
#do this
}
if {user input after the .tssync is not on nor off} {
#do this
}
Keep reading, keep experimenting, and keep coming here when you get stuck.Gemster wrote:Thanks willyw, i will defo take a look at them links and bookmark as ive wanted to learn tcl for months but everytime i start i get cut off by something i cant get past.
...
Seeing the above, makes me highly recommend that you visit the Suninet TCL guide that I mentioned previously.but there are a few things i dont understand ...
bind pub n
switch:
lindex
split