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 

Writing to a TXT
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Sun May 07, 2006 1:37 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Nivko
Voice


Joined: 15 Nov 2005
Posts: 22
Location: The Netherlands, Helmond

PostPosted: Sun May 07, 2006 1:56 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun May 07, 2006 2:01 pm    Post subject: Reply with quote

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


Joined: 15 Nov 2005
Posts: 22
Location: The Netherlands, Helmond

PostPosted: Sun May 07, 2006 2:03 pm    Post subject: Reply with quote

Ok i gonna test Smile
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Nivko
Voice


Joined: 15 Nov 2005
Posts: 22
Location: The Netherlands, Helmond

PostPosted: Sun May 07, 2006 2:08 pm    Post subject: Reply with quote

Thanks all, working perfect!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Nivko
Voice


Joined: 15 Nov 2005
Posts: 22
Location: The Netherlands, Helmond

PostPosted: Mon May 08, 2006 1:42 am    Post subject: Reply with quote

Nope, he works a couple of minutes and after that he isnt working anymore..
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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