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 

Reading from files.

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Dizzle
Op


Joined: 28 Apr 2005
Posts: 109

PostPosted: Tue Jan 03, 2006 12:24 pm    Post subject: Reading from files. Reply with quote

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 Smile 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
View user's profile Send private message Visit poster's website MSN Messenger
Dizzle
Op


Joined: 28 Apr 2005
Posts: 109

PostPosted: Tue Jan 03, 2006 12:59 pm    Post subject: Reply with quote

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
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: Tue Jan 03, 2006 4:54 pm    Post subject: Reply with quote

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


Joined: 28 Apr 2005
Posts: 109

PostPosted: Wed Jan 04, 2006 12:54 am    Post subject: Reply with quote

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
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 -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
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