| View previous topic :: View next topic |
| Author |
Message |
Dizzle Op
Joined: 28 Apr 2005 Posts: 109
|
Posted: Tue Jan 03, 2006 12:24 pm Post subject: Reading from files. |
|
|
Im working on a private channel script where you can add a hostmark who may join a channel. Im using it for my private channel.
Well if finished the script adding and deleting ppl, and who dont have the right hostmark will be kickbanned. Butt the list is getting long. And i like too get the list in private notice when i msg the bot "privlist".
Well i tried a few things my self butt i doesnt seem too work atm.
| Code: | proc show_host { nick uhost hand chan } {
global privchan file
set f [open $file]
putserv "NOTICE $nick : Nr Hostmark"
foreach host [???????] {
}
}
}
|
i know this is not right way, and i have read too a lot off scripts too see how they do it, butt no script i like mine.
What the idea is when i msg the bot i will get some thing like this.
<Botnick> : Nr Hostmark
<Botnick> : #1 Bla@bla.com
<Botnick> : #2 Bla@blabla.com
<Botnick> : #2 Bla@blablabla.com
etc.
Well would you guys give me some hints how its possible too display every hostmark saved in the file and add a number too it ?
You dont have too give me the hole script butt some help will be apreciated.
Hope you can help me _________________ What's this real life ppl keep talking about ??? And where can I download it ??? |
|
| Back to top |
|
 |
Dizzle Op
Joined: 28 Apr 2005 Posts: 109
|
Posted: Tue Jan 03, 2006 12:59 pm Post subject: |
|
|
this is one off my tries, i doesnt work, buut maybe it can be made better.
| Code: |
proc show_host { nick uhost hand chan } {
global privchan file
set number 0
set f [open $file]
putserv "NOTICE $nick : Nr Hostmark"
foreach host [string tolower [split [read $f] \n]] {
incr number +1
putserv "NOTICE $nick : #$number $host"
}
}
} |
_________________ What's this real life ppl keep talking about ??? And where can I download it ??? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Jan 03, 2006 4:54 pm Post subject: |
|
|
| Code: | proc show_host {nick uhost hand chan} {
global privchan file
set number 0
set f [open $file]
putserv "NOTICE $nick :Nr Hostmark"
foreach host [split [read $f] \n] {
if {$host == ""} {break}
incr number
putserv "NOTICE $nick :#$number $host"
}
close $f
} |
Edit: fixed. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts
Last edited by Sir_Fz on Wed Jan 04, 2006 2:11 am; edited 1 time in total |
|
| Back to top |
|
 |
Dizzle Op
Joined: 28 Apr 2005 Posts: 109
|
Posted: Wed Jan 04, 2006 12:54 am Post subject: |
|
|
thanks sir_Fz, its working only problem now he counts the number too much like this,
(05:47:13) (CSS) Nr Hostmark
(05:47:14) (CSS) #1 Dizzle@Dizzle.users.quakenet.org
(05:47:15) (CSS) #2
and there is only one hostmark in my database _________________ What's this real life ppl keep talking about ??? And where can I download it ??? |
|
| Back to top |
|
 |
|