| View previous topic :: View next topic |
| Author |
Message |
[Lt]im Voice
Joined: 09 Mar 2006 Posts: 17 Location: Kaunas - Lithuania
|
Posted: Tue Apr 18, 2006 11:32 am Post subject: Need script: messages |
|
|
I have a script:
| Code: |
set channel "#chan"
set time 5
set text {
"YOUR TXT"
"YOUR TXT2"
"YOUR TXT3"
}
if {[string compare [string index $time 0] "!"] == 0} { set timer [string range $time 1 end] } { set timer [expr $time * 60] }
if {[lsearch -glob [utimers] "* go *"] == -1} { utimer $timer go }
proc go {} {
global channel time text timer
foreach chan $channel {
foreach line $text { putserv "PRIVMSG $chan :$line" }
}
if {[lsearch -glob [utimers] "* go *"] == -1} { utimer $timer go }
}
|
Bot writes all 3 messages every 5 mins.
But i want taht bot would write only 1 message.
For example: first text1, then after 5 mins text2, then text3,... and again text1... Can anyone help me? _________________ [Lt]im |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Apr 18, 2006 12:38 pm Post subject: |
|
|
| Code: | set msgchans #channel
set msgtime 5
set msgtext {
"text 1"
"text 2"
"text 3"
}
if {[string index $msgtime 0] == "!"} { set msgtime [expr {60*$msgtime}] }
if {[lsearch [utimers] "* go *"] == -1} { utimer $msgtime go }
proc go {} {
global msgchans msgtime msgtext msgindex
set length [llength $msgtext]
if {![info exists msgindex] || $msgindex == $length} { set msgindex 0 }
foreach chan $msgchans {
putserv "privmsg $chan :[lindex $msgtext $msgindex]"
}
incr msgindex
utimer $msgtime go
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
[Lt]im Voice
Joined: 09 Mar 2006 Posts: 17 Location: Kaunas - Lithuania
|
Posted: Tue Apr 18, 2006 12:54 pm Post subject: |
|
|
When i tested your tcl i got error:
| Code: |
[19:52:38] * Joins: CssGeras (improx@plieninis.tiltas.lt)
[19:52:49] <CssGeras> text 1
[19:52:51] * ChanServ sets mode: +o CssGeras
[19:52:56] <CssGeras> text 2
[19:52:58] <CssGeras> text 3
[19:53:11] <CssGeras> text 1
[19:53:13] <CssGeras> text 2
[19:53:15] <CssGeras> text 3
...
|
Where is the problem? He is allways writing these 3 lines _________________ [Lt]im |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Wed Apr 19, 2006 3:25 am Post subject: |
|
|
| Code: | set msgchans #channel
set msgtime 5
set msgtext {
"text 1"
"text 2"
"text 3"
}
if {[string index $msgtime 0] == "!"} { set msgtime [expr {60*$msgtime}] }
if {[lsearch [utimers] "* go *"] == -1} { utimer $msgtime go }
proc go {} {
global msgchans msgtime msgtext msgindex
set length [llength $msgtext]
if {![info exists msgindex] || $msgindex == $length} { set msgindex 0 }
foreach chan $msgchans {
putserv "privmsg $chan :[lindex $msgtext $msgindex]"
}
incr msgindex
timer $msgtime go
} |
Would probably work as you want it too.
Don't forget to replace the text1, text2, text3 with whatever you want. |
|
| Back to top |
|
 |
[Lt]im Voice
Joined: 09 Mar 2006 Posts: 17 Location: Kaunas - Lithuania
|
Posted: Wed Apr 19, 2006 9:46 am Post subject: |
|
|
Thank You. It's working. _________________ [Lt]im |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Apr 19, 2006 6:08 pm Post subject: |
|
|
Changing utimer to timer wouldn't be a solution. If you want it in minutes, then instead of
use
But the code should be fixed:
| Code: | set msgchans #channel
set msgtime 5
set msgtext {
"text 1"
"text 2"
"text 3"
}
if {[string index $msgtime 0] == "!"} { set msgtime [expr {60*[string trim $msgtime !]}] }
if {[lsearch [utimers] "* go *"] == -1} { utimer $msgtime go }
proc go {} {
global msgchans msgtime msgtext msgindex
set length [llength $msgtext]
if {![info exists msgindex] || $msgindex == $length} { set msgindex 0 }
foreach chan $msgchans {
putserv "privmsg $chan :[lindex $msgtext $msgindex]"
}
incr msgindex
timer $msgtime go
} |
the ! should be trimmed. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
[Lt]im Voice
Joined: 09 Mar 2006 Posts: 17 Location: Kaunas - Lithuania
|
Posted: Thu Apr 20, 2006 7:45 am Post subject: |
|
|
Thank You
I need some more help. I have the code:
| Code: |
set admin_chan "#chans"
set public_chan "#chan"
bind pub - !zinute pub:adm
proc pub:adm {nick uhost hand chan arg} {
global admin_chan
global public_chan
if {[string equal -nocase $public_chan $chan]} {
putquick "privmsg $admin_chan :\002!!\002 Zinute adminams \002!!\002 \002$nick\002: $arg"
putquick "notice $nick :\002Jusu zinute sekmingai nusiusta CS:S Geras administratoriams.\002"
}
}
|
I want that user could only use this comand once in 20 seconds. Can You help me?  _________________ [Lt]im |
|
| Back to top |
|
 |
[Lt]im Voice
Joined: 09 Mar 2006 Posts: 17 Location: Kaunas - Lithuania
|
Posted: Fri Apr 21, 2006 6:34 pm Post subject: |
|
|
Anyone?  _________________ [Lt]im |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri Apr 21, 2006 6:51 pm Post subject: |
|
|
| Code: | set admin_chan "#chans"
set public_chan "#chan"
bind pub - !zinute pub:adm
proc pub:adm {nick uhost hand chan arg} {
global admin_chan public_chan didcmd
if {![info exists didcmd([set nick [string tolower $nick]])] || [unixtime]-$didcmd($nick) > 20} {
set didcmd($nick) [unixtime]
} {return 0}
if {[string equal -nocase $public_chan $chan]} {
putquick "privmsg $admin_chan :\002!!\002 Zinute adminams \002!!\002 \002$nick\002: $arg"
putquick "notice $nick :\002Jusu zinute sekmingai nusiusta CS:S Geras administratoriams.\002"
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
[Lt]im Voice
Joined: 09 Mar 2006 Posts: 17 Location: Kaunas - Lithuania
|
Posted: Fri Apr 21, 2006 7:34 pm Post subject: |
|
|
Thank You. _________________ [Lt]im |
|
| Back to top |
|
 |
[Lt]im Voice
Joined: 09 Mar 2006 Posts: 17 Location: Kaunas - Lithuania
|
Posted: Tue Apr 25, 2006 10:41 am Post subject: |
|
|
Can You make that user couldn't write only !zinute without text (bot would notice - Please use !zinute <Your text>), and if user tries to write second message in < 20s bot would notice - You can write only 1 message in 20s. Thanks. It would be great... _________________ [Lt]im |
|
| Back to top |
|
 |
|