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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Nivko
Voice
Posts: 22 Joined: Tue Nov 15, 2005 8:49 am
Location: The Netherlands, Helmond
Contact:
Post
by Nivko » Sun May 07, 2006 7:24 am
Hi,
Can somone help me with this script:
If people join the channel #blaat the bot must write the nickname to a .txt , if the people leaves #blaat he must he delete the people's name from the .txt.
Thanks.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun May 07, 2006 8:12 am
Search the forum for 'write txt', you'll get a lot of usefull topics.
Nivko
Voice
Posts: 22 Joined: Tue Nov 15, 2005 8:49 am
Location: The Netherlands, Helmond
Contact:
Post
by Nivko » Sun May 07, 2006 8:28 am
Ok, i find the write section but not the remove (For removing the line's)
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun May 07, 2006 8:54 am
Paste what you've written so far and we will help you finish it.
Nivko
Voice
Posts: 22 Joined: Tue Nov 15, 2005 8:49 am
Location: The Netherlands, Helmond
Contact:
Post
by Nivko » Sun May 07, 2006 9:19 am
Code: Select all
bind join - * join_onjoin
proc join_onjoin {nick uhost hand chan} {
set txt [open "online.txt"]
puts $txt "$nick"
}
KrzychuG
Master
Posts: 306 Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:
Post
by KrzychuG » Sun May 07, 2006 9:47 am
Code: Select all
bind join - * join_onjoin
proc join_onjoin {nick uhost hand chan} {
set txt [open "online.txt"]
puts $txt "$nick"
close $txt ;# it's important to close the file!
}
;P
Que?
Nivko
Voice
Posts: 22 Joined: Tue Nov 15, 2005 8:49 am
Location: The Netherlands, Helmond
Contact:
Post
by Nivko » Sun May 07, 2006 9:49 am
Ok, thanks that is the first part of the script
Now how remove the line if somone parts
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Sun May 07, 2006 10:26 am
best you save the nicks as a list. and lsearch/lreplace the nick (or lappend in case to add one).
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
Nivko
Voice
Posts: 22 Joined: Tue Nov 15, 2005 8:49 am
Location: The Netherlands, Helmond
Contact:
Post
by Nivko » Sun May 07, 2006 10:29 am
Uhm, i cant script TCL... Could you make it for me..
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun May 07, 2006 11:22 am
Code: Select all
bind time - ?0* savelist
bind join - * addtolist
bind part - * remfromlist
bind sign - * remfromlist
if {![file exists online.txt]} { close [open online.txt w] }
set nicklist [split [read [set oltxt [open online.txt]]] \n][close $oltxt]
proc savelist args {
set file [open online.txt w]
foreach n $::nicklist {
if {$n != ""} { puts $file $n }
}
close $file
}
proc addtolist {nick uhost hand chan} {
global nicklist
set nick [string tolower $nick]
if {[lsearch -exact $nicklist $nick] == -1} {
lappend nicklist $nick
}
}
proc remfromlist {nick uhost hand chan rsn} {
global nicklist
set nick [string tolower $nick]
if {[set i [lsearch -exact $nicklist $nick]] != -1} {
set nicklist [lreplace $nicklist $i $i]
}
}
This will add the nicks on join to the list and will remove the nicks from the list on part/quit. The list will be saved every 10 minutes into the file.
Nivko
Voice
Posts: 22 Joined: Tue Nov 15, 2005 8:49 am
Location: The Netherlands, Helmond
Contact:
Post
by Nivko » Sun May 07, 2006 11:24 am
Sorry, but i need live if somone parts he must write and joins too:$
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun May 07, 2006 11:26 am
Well, what you're requesting is not recommended. If you want it to save immediately, you know what to fix.
Nivko
Voice
Posts: 22 Joined: Tue Nov 15, 2005 8:49 am
Location: The Netherlands, Helmond
Contact:
Post
by Nivko » Sun May 07, 2006 11:29 am
Why it isnt recommed? BTW is this good without timer?:
Code: Select all
bind join - * addtolist
bind part - * remfromlist
bind sign - * remfromlist
if {![file exists online.txt]} { close [open online.txt w] }
set nicklist [split [read [set oltxt [open online.txt]]] \n][close $oltxt]
proc savelist args {
set file [open online.txt w]
foreach n $::nicklist {
if {$n != ""} { puts $file $n }
}
close $file
}
proc addtolist {nick uhost hand chan} {
global nicklist
set nick [string tolower $nick]
if {[lsearch -exact $nicklist $nick] == -1} {
lappend nicklist $nick
}
}
proc remfromlist {nick uhost hand chan rsn} {
global nicklist
set nick [string tolower $nick]
if {[set i [lsearch -exact $nicklist $nick]] != -1} {
set nicklist [lreplace $nicklist $i $i]
}
}
[/code]
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sun May 07, 2006 11:38 am
It's not recommended because it becomes CPU intensive to open and close the file everytime someone joins/parts/quits especially on mass events. Your code is alright, you only need to change these procs:
Code: Select all
proc addtolist {nick uhost hand chan} {
global nicklist
set nick [string tolower $nick]
if {[lsearch -exact $nicklist $nick] == -1} {
lappend nicklist $nick
savelist
}
}
proc remfromlist {nick uhost hand chan rsn} {
global nicklist
set nick [string tolower $nick]
if {[set i [lsearch -exact $nicklist $nick]] != -1} {
set nicklist [lreplace $nicklist $i $i]
savelist
}
}
Nivko
Voice
Posts: 22 Joined: Tue Nov 15, 2005 8:49 am
Location: The Netherlands, Helmond
Contact:
Post
by Nivko » Sun May 07, 2006 11:47 am
So this:
Code: Select all
proc addtolist {nick uhost hand chan} {
global nicklist
set nick [string tolower $nick]
if {[lsearch -exact $nicklist $nick] == -1} {
lappend nicklist $nick
savelist
}
}
proc remfromlist {nick uhost hand chan rsn} {
global nicklist
set nick [string tolower $nick]
if {[set i [lsearch -exact $nicklist $nick]] != -1} {
set nicklist [lreplace $nicklist $i $i]
savelist
}
}
proc savelist args {
set file [open online.txt w]
foreach n $::nicklist {
if {$n != ""} { puts $file $n }
}
close $file
}
I gonna this it and else i use your way