| View previous topic :: View next topic |
| Author |
Message |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Sun May 07, 2006 1:37 pm Post subject: |
|
|
if you want max speed on casual events and make slow on more frequent events, you could use a var like "recentlysaved" and set it to 1 each time you save, use a utimer to wait for 10sec until next save. or you generally initialize a 1 sec delayed save on each event (which gives time for more events to be saved within that 1sec). _________________ 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... |
|
| Back to top |
|
 |
Nivko Voice
Joined: 15 Nov 2005 Posts: 22 Location: The Netherlands, Helmond
|
Posted: Sun May 07, 2006 1:56 pm Post subject: |
|
|
Ok i will save on every 10 seconds should i use this:?
| Code: | bind time - ?10* 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]
}
} |
|
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun May 07, 2006 2:01 pm Post subject: |
|
|
No, that's for every 10 minutes. For saving every 10 seconds:
| Code: | 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]
set recentnicks 0
if {[utimerexists savelist]==""} {
utimer 10 savelist
}
proc savelist {} {
global recentnicks
if {$recentnicks} {
set file [open online.txt w]
foreach n $::nicklist {
if {$n != ""} { puts $file $n }
}
close $file
set recentnicks 0
}
utimer 10 savelist
}
proc addtolist {nick uhost hand chan} {
global nicklist recentnicks
set nick [string tolower $nick]
if {[lsearch -exact $nicklist $nick] == -1} {
lappend nicklist $nick
set recentnicks 1
}
}
proc remfromlist {nick uhost hand chan rsn} {
global nicklist recentnicks
set nick [string tolower $nick]
if {[set i [lsearch -exact $nicklist $nick]] != -1} {
set nicklist [lreplace $nicklist $i $i]
set recentnicks 1
}
} |
Note: alltools.tcl should be loaded for the utimerexists command to work. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
Nivko Voice
Joined: 15 Nov 2005 Posts: 22 Location: The Netherlands, Helmond
|
Posted: Sun May 07, 2006 2:03 pm Post subject: |
|
|
Ok i gonna test  |
|
| Back to top |
|
 |
Nivko Voice
Joined: 15 Nov 2005 Posts: 22 Location: The Netherlands, Helmond
|
Posted: Sun May 07, 2006 2:08 pm Post subject: |
|
|
| Thanks all, working perfect! |
|
| Back to top |
|
 |
Nivko Voice
Joined: 15 Nov 2005 Posts: 22 Location: The Netherlands, Helmond
|
Posted: Mon May 08, 2006 1:42 am Post subject: |
|
|
| Nope, he works a couple of minutes and after that he isnt working anymore.. |
|
| Back to top |
|
 |
|