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 

request msg script!

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


Joined: 16 May 2005
Posts: 10

PostPosted: Tue Apr 18, 2006 6:06 pm    Post subject: request msg script! Reply with quote

hello,

i want my bot to read the latest 1 or 5 lines from bot.log file en msg them to #channel ...


thx!
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 6:26 pm    Post subject: Reply with quote

A forum search will return exactly what you've asked for.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
TeRRaNoVA
Voice


Joined: 16 May 2005
Posts: 10

PostPosted: Tue Apr 18, 2006 7:06 pm    Post subject: Reply with quote

thx

founded this and it works bud....

Code:
set f [open "|tail -f /home/user/eggdrop/logs/bot.log"]
fconfigure $f -blocking 0 -buffering line
fileevent $f readable [list foo $f]
proc foo {f} {puthelp "privmsg #mychannel :[gets $f]"}


bud now i want a !cmd for latest 5 lines from that bot.log
can you help me with is have seach bud no good result..:/
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 8:04 pm    Post subject: Reply with quote

Code:
bind pub - !cmd cmd

proc cmd {nick uhost hand chan arg} {
 # !cmd triggers this procedure.
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Tue Apr 18, 2006 8:13 pm    Post subject: Reply with quote

TeRRaNoVA wrote:
thx

founded this and it works bud....

Code:
set f [open "|tail -f /home/user/eggdrop/logs/bot.log"]
fconfigure $f -blocking 0 -buffering line
fileevent $f readable [list foo $f]
proc foo {f} {puthelp "privmsg #mychannel :[gets $f]"}


bud now i want a !cmd for latest 5 lines from that bot.log
can you help me with is have seach bud no good result..:/


How in the world can that procedure code work???
Far easier:
Code:

proc foo {n u h c t} {
   set file [exec tail -n5 /path/to/log]
   foreach line in $file {
      putserv "PRIVMSG $c : $line"
   }
}

might not work for windrop, but you used tail in your example so it should work for you
Back to top
View user's profile Send private message
TeRRaNoVA
Voice


Joined: 16 May 2005
Posts: 10

PostPosted: Wed Apr 19, 2006 6:51 am    Post subject: Reply with quote

Sir_Fz wrote:
Code:
bind pub - !cmd cmd

proc cmd {nick uhost hand chan arg} {
 # !cmd triggers this procedure.
}



does that trigger directly from /home/user/eggdrop/logs/bot.log
or were to put into a new .tcl ... ?


sorry for my bad english
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:12 pm    Post subject: Reply with quote

You load it the same way you load any another Tcl script.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
TeRRaNoVA
Voice


Joined: 16 May 2005
Posts: 10

PostPosted: Thu Apr 20, 2006 3:10 pm    Post subject: Reply with quote

Sir_Fz wrote:
You load it the same way you load any another Tcl script.


load this as cmd.tcl bud when i type !cmd nothing happens Sad or `m wrong..

Code:
bind pub - !cmd cmd

proc cmd {nick uhost hand chan arg} {
 # !cmd triggers this procedure.
}
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Apr 21, 2006 12:03 am    Post subject: Reply with quote

DragnLord wrote:

How in the world can that procedure code work???


bizarre quantum forces make it do so Wink
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Fri Apr 21, 2006 12:20 am    Post subject: Reply with quote

ah, I missed the fileevent calling procedure foo Shocked
must have been a long day
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 7:47 am    Post subject: Reply with quote

TeRRaNoVA wrote:
Sir_Fz wrote:
You load it the same way you load any another Tcl script.


load this as cmd.tcl bud when i type !cmd nothing happens Sad or `m wrong..

Code:
bind pub - !cmd cmd

proc cmd {nick uhost hand chan arg} {
 # !cmd triggers this procedure.
}

I gave you an example on how you can make the bot trigger a procedure on pub command.

Code:
bind pub - !cmd cmd

proc cmd {nick uhost hand chan arg} {
 set f [open "|tail -f /home/user/eggdrop/logs/bot.log"]
 fconfigure $f -blocking 0 -buffering line
 fileevent $f readable [list foo $f $chan]
}

proc foo {f c} {puthelp "privmsg $c :[gets $f]"}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
TeRRaNoVA
Voice


Joined: 16 May 2005
Posts: 10

PostPosted: Sat Apr 22, 2006 5:07 pm    Post subject: Reply with quote

thx Working 110% now Smile

thx for your help!
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