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 

dumbasses tcl add/list/del

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


Joined: 16 Jun 2005
Posts: 42
Location: Lithuania / Vilnius / Underground

PostPosted: Sun Nov 27, 2005 5:27 pm    Post subject: dumbasses tcl add/list/del Reply with quote

Hi,

I have dumbasses.tcl but it can only add ant list dumbasses.
Can anyone make that tcl could delete nick from the file. If nick isn't in the dumbasses file bot sents msg that he is not dumbass. Very Happy

Code:
set quoteitpubprefix "!"
set quoteitfile "quoteit.data"
# 0 = Channel
# 1 = Notice
set quoteitvianotice "1"

if { ![info exists toolbox_loaded] } { source scripts/alltools.tcl }

bind pub - [string trim $quoteitpubprefix]dumbasses quoteit:pub:dumbasses
bind pub G|G [string trim $quoteitpubprefix]dumbass quoteit:pub:dumbass

proc quoteit:pub:dumbass {nick uhost hand chan arg} {
 global quoteitfile quoteitvianotice
 set quotes ""
 if { [file exists $quoteitfile] } { set file [open $quoteitfile r]
 } else {
  if { $quoteitvianotice == 0 } { putmsg $chan "$quoteitfile does not exist. You'll need to add quotes to the database first by typing \002!dumbass <nick>\002" }
  if { $quoteitvianotice == 1 } { putnotc $nick "$quoteitfile does not exist. You'll need to add quotes to the database first by typing \002!dumbass <nick>\002" }
  return 0
 }
 while { ![eof $file] } {
  set quote [gets $file]
  if { $quote != "" } {
   set quotes [linsert $quotes end $quote]
  }
 }
 close $file
 set row [rand [llength $quotes]]
   set quote [list $quotes]
 
 if { $quote != "" } {
  if { $quoteitvianotice == 0 } {
   putmsg $chan "Dumbasses: $quote"
  }
  if { $quoteitvianotice == 1 } {
   putnotc $nick "Dumbasses: $quote"
  }
  return 1
 }
}

proc quoteit:pub:dumbasses {nick uhost hand chan arg} {
 global quoteitfile
 if { $arg == "" } {
  putnotc $nick "Usage: !dumbass <nick>"
  return 0
 }
 set file [open $quoteitfile a]
 puts $file "$arg"
 close $file
 putmsg $chan "{$arg dumbassed}"
 return 1
}

putlog "*** dumbasses.tcl loaded"

_________________
IRC: #egghelp @ Aitvaras.NET
IRC: #NASA @ Aitvaras.NET
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Wed Nov 30, 2005 12:34 am    Post subject: Reply with quote

talk about rightly named scripts Wink
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
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