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 

Need some help with this script

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
mrdr
Halfop


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

PostPosted: Thu Jul 07, 2005 7:47 am    Post subject: Need some help with this script Reply with quote

I have this script. Here's the example what it does.
me: !duxas nick
bot: {nick uzhduxintas}
And now I need, when I write "!unduxas nick" bot will delete that nick from the list. Smile
Any ideas?

Code:
# what would you like the commands (addquote and quote) prefixs to be?
set quoteitpubprefix "!"

# where would you like the quoteit data to be stored?
set quoteitfile "quoteit.data"

# would you like quotes to be displayed via private notice?
#
# 0 = no, display quotes in channel instead
# 1 = yes, display quotes via private notice.
set quoteitvianotice "1"

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

bind pub - [string trim $quoteitpubprefix]duxai quoteit:pub:quote
bind pub G|G [string trim $quoteitpubprefix]duxas quoteit:pub:addquote

proc quoteit:pub:quote {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!addquote <a quote>\002" }
  if { $quoteitvianotice == 1 } { putnotc $nick "$quoteitfile does not exist. You'll need to add quotes to the database first by typing \002!addquote <a quote>\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 "$quote"
  }
  if { $quoteitvianotice == 1 } {
   putnotc $nick "$quote"
  }
  return 1
 }
}

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

putlog "*** Duxu 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
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive 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