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 

Add lines, and check them on a txt file

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
garfwen
Halfop


Joined: 12 Mar 2008
Posts: 61

PostPosted: Thu Dec 18, 2008 5:24 pm    Post subject: Add lines, and check them on a txt file Reply with quote

Hello

Im looking for a script that can make this:

Code:

<nick> hello

          check if "$nick is on the file" if not

<botnick> hello

    add line "hello $nick"


<nick> hello

          check if "$nick is on the file" if it is

<botnick> Hello again $nick !


Ty,
GaRfWeN Razz
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sat Dec 20, 2008 6:34 pm    Post subject: Reply with quote

Code:
# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.htm

# file with names
set hello_file "hello.txt"

##################################################
if {![file exist $hello_file]} {
   set create_new [open $hello_file w]
   close $create_new
}

bind pub - hello hello_proc

proc check_nick { name } {
   global hello_file

   set return_msg "not_exist"

   set db_handler [open $hello_file r]
   set all_names [read $db_handler]
   close $db_handler

   if {$all_names != ""} {
      if {[lsearch [split $all_names "\n"] $name] != -1} {
         set return_msg "exist"
      }
   }

   return $return_msg
}

proc add_name { name } {
   global hello_file

   set append_hand [open $hello_file a]
   puts $append_hand $name
   close $append_hand
}

proc hello_proc { nick uhost hand chan arg } {
   set name_status [check_nick $nick]

   if {$name_status == "exist"} {
      putquick "PRIVMSG $chan :hello again $nick"
   } {
      putquick "PRIVMSG $chan :hello"
      add_name $nick
   }
}

putlog "simple-hello.tcl ver 0.1 by tomekk loaded"



try :>
Back to top
View user's profile Send private message Visit poster's website
garfwen
Halfop


Joined: 12 Mar 2008
Posts: 61

PostPosted: Sun Dec 21, 2008 8:55 am    Post subject: Reply with quote

Ty

5*

Razz
Back to top
View user's profile Send private message
garfwen
Halfop


Joined: 12 Mar 2008
Posts: 61

PostPosted: Tue Dec 23, 2008 7:48 am    Post subject: Reply with quote

Hello

Can you please add one thing to the script ?

It's to remove a line


When

Code:

<user> goobye

remove user from list

<botnick> goodbye $nick


Ty Very Happy
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 -> Script Requests 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