This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Need script: messages

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
[
[Lt]im
Voice
Posts: 17
Joined: Thu Mar 09, 2006 4:20 pm
Location: Kaunas - Lithuania

Need script: messages

Post by [Lt]im »

I have a script:

Code: Select all

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
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

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
}
[
[Lt]im
Voice
Posts: 17
Joined: Thu Mar 09, 2006 4:20 pm
Location: Kaunas - Lithuania

Post by [Lt]im »

When i tested your tcl i got error:

Code: Select all

[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
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Code: Select all

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.
[
[Lt]im
Voice
Posts: 17
Joined: Thu Mar 09, 2006 4:20 pm
Location: Kaunas - Lithuania

Post by [Lt]im »

Thank You. It's working.
[Lt]im
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Changing utimer to timer wouldn't be a solution. If you want it in minutes, then instead of

Code: Select all

set msgtime 5
use

Code: Select all

set msgtime !5
But the code should be fixed:

Code: Select all

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.
[
[Lt]im
Voice
Posts: 17
Joined: Thu Mar 09, 2006 4:20 pm
Location: Kaunas - Lithuania

Post by [Lt]im »

Thank You :)

I need some more help. I have the code:

Code: Select all

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? :wink:
[Lt]im
[
[Lt]im
Voice
Posts: 17
Joined: Thu Mar 09, 2006 4:20 pm
Location: Kaunas - Lithuania

Post by [Lt]im »

Anyone? :roll:
[Lt]im
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

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"
 }
}
[
[Lt]im
Voice
Posts: 17
Joined: Thu Mar 09, 2006 4:20 pm
Location: Kaunas - Lithuania

Post by [Lt]im »

Thank You.
[Lt]im
[
[Lt]im
Voice
Posts: 17
Joined: Thu Mar 09, 2006 4:20 pm
Location: Kaunas - Lithuania

Post by [Lt]im »

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
Post Reply