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.

Reading from files.

Help for those learning Tcl or writing their own scripts.
Post Reply
D
Dizzle
Op
Posts: 109
Joined: Thu Apr 28, 2005 11:21 am
Contact:

Reading from files.

Post by Dizzle »

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: Select all

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 ???
D
Dizzle
Op
Posts: 109
Joined: Thu Apr 28, 2005 11:21 am
Contact:

Post by Dizzle »

this is one off my tries, i doesnt work, buut maybe it can be made better.

Code: Select all

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 ???
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

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.
Last edited by Sir_Fz on Wed Jan 04, 2006 2:11 am, edited 1 time in total.
D
Dizzle
Op
Posts: 109
Joined: Thu Apr 28, 2005 11:21 am
Contact:

Post by Dizzle »

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 ???
Post Reply