egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need script: messages

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
[Lt]im
Voice


Joined: 09 Mar 2006
Posts: 17
Location: Kaunas - Lithuania

PostPosted: Tue Apr 18, 2006 11:32 am    Post subject: Need script: messages Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Apr 18, 2006 12:38 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
[Lt]im
Voice


Joined: 09 Mar 2006
Posts: 17
Location: Kaunas - Lithuania

PostPosted: Tue Apr 18, 2006 12:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Wed Apr 19, 2006 3:25 am    Post subject: Reply with quote

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
View user's profile Send private message
[Lt]im
Voice


Joined: 09 Mar 2006
Posts: 17
Location: Kaunas - Lithuania

PostPosted: Wed Apr 19, 2006 9:46 am    Post subject: Reply with quote

Thank You. It's working.
_________________
[Lt]im
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Apr 19, 2006 6:08 pm    Post subject: Reply with quote

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

use
Code:
set msgtime !5

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
View user's profile Send private message Visit poster's website
[Lt]im
Voice


Joined: 09 Mar 2006
Posts: 17
Location: Kaunas - Lithuania

PostPosted: Thu Apr 20, 2006 7:45 am    Post subject: Reply with quote

Thank You Smile

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? Wink
_________________
[Lt]im
Back to top
View user's profile Send private message
[Lt]im
Voice


Joined: 09 Mar 2006
Posts: 17
Location: Kaunas - Lithuania

PostPosted: Fri Apr 21, 2006 6:34 pm    Post subject: Reply with quote

Anyone? Rolling Eyes
_________________
[Lt]im
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Apr 21, 2006 6:51 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
[Lt]im
Voice


Joined: 09 Mar 2006
Posts: 17
Location: Kaunas - Lithuania

PostPosted: Fri Apr 21, 2006 7:34 pm    Post subject: Reply with quote

Thank You.
_________________
[Lt]im
Back to top
View user's profile Send private message
[Lt]im
Voice


Joined: 09 Mar 2006
Posts: 17
Location: Kaunas - Lithuania

PostPosted: Tue Apr 25, 2006 10:41 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber