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 

Retrieve data from a file (other alternative)

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


Joined: 15 Mar 2015
Posts: 317

PostPosted: Wed May 13, 2015 4:56 pm    Post subject: Retrieve data from a file (other alternative) Reply with quote

I tried another way to retrieve data from a file.
I know the "traditional" way, but I tried for other alternative to be learning.
Code:

proc noti_nolist {nick uhost handle chan arg} {
global canal_admin
   if {[string tolower $chan] != [string tolower $canal_admin]} {
      return
   }
      if {[file exist prohibidos.txt]} {
         set file [open prohibidos.txt "r"]
         set x 0
         while {![eof $file]} {
            set nickpr [gets $file]
            if {([llength $nickpr] == 0) && ($x == 0)} { putmsg $chan  "The list is empty."; return }
               if {$nickpr == ""} { continue }
                  putmsg $chan "$nickpr"
                  set x [expr {$x + 1}]
         }
         close $file
         putmsg $chan "The list contains  $x prohibited nicks."
      } else {
         putmsg $canal_admin "Has not yet entered any nick,database is missing.!"
      }
}


Works well! Very Happy
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
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