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.
Old posts that have not been replied to for several years.
-
eiSi
- Halfop
- Posts: 70
- Joined: Thu Mar 07, 2002 8:00 pm
Post
by eiSi »
hi there!
I have written this little proc:
Code: Select all
### update proc
proc call_update { nick misc1 misc1end } {
if {$misc1 == "set"} {
set f [open "./tmp/update" "w"]
puts $f "$misc1end ($nick)"
close $f
notice $nick "Update set to: $misc1end"
msg $home "\002Update:\002 $misc1end"
} else {
set f [open "./tmp/update" "r"]
set update [gets $f]
close $f
notice $nick "\002Update:\002 $update"
}
}
how to make, that it adds a line under the last?
and that if I make show 4 it shows the last 4 changes?
thanks for any help!

-
ppslim
- Revered One
- Posts: 3914
- Joined: Sun Sep 23, 2001 8:00 pm
- Location: Liverpool, England
Post
by ppslim »
OK,
1: You use the append flag, rather than write to the open command
2: You read the whole file, and output the last 4 lines from your input.
Code: Select all
### update proc
proc call_update { nick misc1 misc1end } {
if {$misc1 == "set"} {
set f [open "./tmp/update" "a"]
puts $f "$misc1end ($nick)"
close $f
notice $nick "Update set to: $misc1end"
msg $home "\002Update:\002 $misc1end"
} else {
set f [open "./tmp/update" "r"]
set update [split [read $f] \n]
close $f
foreach a [lrange $update end-3 end]
notice $nick "\002Update:\002 $a"
}
}
}
-
eiSi
- Halfop
- Posts: 70
- Joined: Thu Mar 07, 2002 8:00 pm
Post
by eiSi »
thanks!