| View previous topic :: View next topic |
| Author |
Message |
PoHuIsT Voice
Joined: 22 Oct 2007 Posts: 23
|
Posted: Tue Oct 23, 2007 4:39 am Post subject: egg-fu 2.0.2 problem |
|
|
hi i have install egg-fu 2.02
but i have a problem
| Code: |
[09:34] missing close-bracket
while compiling
"set bdate [split [concat [clock format [clock seconds] -format "%m/%d/%Y@%H:%M"
] @]
putlog "I was born on \002$bdate\002"
set bc [open birth_certifi..."
invoked from within
"if {![file exists birth_certificate.egg]} {
set coin [rand 10]
if {$coin>=5} {set sex boy} {set sex girl}
putlog "\002IT'S A [string toupper $sex]!..."
(file "scripts/egg-fu_2.0.2.tcl" line 911)
invoked from within
"source scripts/egg-fu_2.0.2.tcl" |
here iz my tcl
| Code: |
#eggdrop1.6 +/-
# ___
# .-----..-----..-----. __ .' _|.--.--.
# | -__|| _ || _ ||__|| ._|| | |
# |_____||___ ||___ | |__| |_____|
# |_____||_____|
# version 2.0.2
#
#
# Copyright (C) 2002, ch3mical
# CitizenK@mad.scientist.com
# irc.secsup.org (EFnet)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Version Information (Major Additions and Bug Fixes!) can be found in the
# Version.txt included in the package.
#
# Feature explanations, instructions, and HELP can be found in
# How-to.txt included in the package.
#
##########################################################################
# If you use the following code in any form partial or modifed, at least #
# give the programmer who did this much hard work his deserved credit! #
##########################################################################
#
# Greetz:
# Tigrrr, psynapse, dilvie, yo momma, mickrip, poke, #trax
# one_, sunrpc, ^PLAID^, Tenebrous, Byte, KottoN, raz0rchiq, Law
# tekneeks, vortek, peeps on the west side, ziricon, and everyone else
#
# Thanks to:
# brainiac for being the beta-test monkey
#
# email your suggestions/questions/comments/bitches to:
# CitizenK@mad.scientist.com
#
##########################################################################
#@##### SETUP THE SCRIPT #######
# Please change the details below
# To work in all channels leave this blank
set workingchans ""
# List any other bots you want to be ignored
set otherbots "dark-bot infobot soundbot"
# Location of your word file
set wordfile "brain.txt"
# [0/1] Set this to 0 to turn off misdirection-learning (not recommended)
set mdirect 1
# This is the character that will PRECEED all !trigger commands (if
# enabled), set this to "-no-" to make triggers work without it
set it "!"
# [0/1] Require a !trigger command for learning?
set lrntrig 0
set ltrigger "set"
# [0/1] Require a !trigger command for questions?
# It's ok to set both triggers the same
set asktrig 0
set atrigger "ask"
# [hjmnoptx] Require which modes to use learn?
# Set to "-" to allow anyone to teach egg-fu
set req(ln) "-|-"
# [hjmnoptx] Require which modes to use ask?
# Set to "-" to allow anyone to ask
set req(ak) "-"
# [hjmnoptx] Require which modes to use <ctcp> or <notice>
# Set to "-" to allow all (not recommended)
set req(cn) "o|o"
# Set the subject range here, this refers to how much of the sentence
# egg-fu will process, (default=4)
set range 4
### DONE ###
# These fields can be modifed if you wish!
# !Q=question !A=answer !U=who asked
# above items are replaced by the script with proper values
proc randy {} {
set apb {
{I heard that !Q is !A}
{Did you know that !Q is !A?}
{!Q is !A}
{I'm sure !Q is !A}
{!U: someone said that !Q is !A}
{!Q might be !A}
{Didn't you say !Q is !A?}
{Could it be !Q is !A?}
{I guess !Q is !A}
{Hmmm. I think !Q is !A}
{Well, !Q is !A}
{!U, !Q is probably !A}
{I bet !Q is !A}
{Isn't !Q !A?}
{!U: !Q is !A}
{Do you think !Q is !A?}
}
return [lindex $apb [rand [llength $apb]]]
}
# add/change these to personalize your bot!
proc randn {} {
set apb {
{I don't know, !U.}
{I'm not sure what !Q is.}
{No idea, !U.}
{Why don't you enlighten me, !U?}
{Can't sleep clowns will eat me!}
{I've got no idea, !U...}
{Yo momma knows about !Q!}
{!U: don't ask me, I don't know.}
{I don't know what !Q is, !U.}
{Well maybe you should tell me, !U?}
}
return [lindex $apb [rand [llength $apb]]]
}
# add/change these to personalize your bot!
proc anyanimal {} {
set randanimal {
{goat}
{llama}
{lemming}
{gerbil}
{penguin}
{dung beetle}
{billy goat}
{grizzly bear}
{ostrich}
{drunken transient}
{donkey}
{sea monkey}
{buffalo}
{dog}
{monkey}
{freaky little hamster}
{monkey faced eel}
{iguana}
{hippo}
{bull}
{cow}
{duck}
{zebra}
{giraffe}
}
return [lindex $randanimal [rand [llength $randanimal]]]
}
# add/change these to personalize your bot!
proc anycolor {} {
set apb {
{red}
{yellow}
{orange}
{green}
{blue}
{brown}
{pink}
{purple}
{magenta}
{black}
{white}
}
return [lindex $apb [rand [llength $apb]]]
}
# add/change these to personalize your bot!
# these are NOUNS
proc anyitem {} {
set apb {
{screw driver}
{fire hose}
{corndog}
{wrench}
{excrement}
{pig cheese}
{barbie doll}
{bleeding pimple}
{trout}
{headless corpse}
{cattle prod}
{blowup sheep}
{dirty diaper}
{dried cum stain}
{portable cheese grater}
{bottle of prozac}
{flying detachable penis}
{condom}
{severed head}
{UNIX manual}
}
return [lindex $apb [rand [llength $apb]]]
}
# add/change these to personalize your bot!
# these are ADJECTIVES
proc anyadj {} {
set apb {
{stupid}
{silly}
{ugly}
{smelly}
{hairy}
{sticky}
{used}
{green}
{pink}
{purple}
{abused}
{torn}
{broken}
{squashed}
{crusty}
{thin}
{fat}
{old}
{slick}
{slippery}
{spicy}
{spiked}
{blown up}
}
return [lindex [concat [concat $apb]] [rand [llength $apb]]]
}
# add/change these to personalize your bot!
proc anyday {} {
set randday {
{Monday}
{Tuesday}
{Wednesday}
{Thursday}
{Friday}
{Saturday}
{Sunday}
{some day}
{any day}
{tomorrow}
{yesterday}
}
return [lindex $randday [rand [llength $randday]]]
}
# add/change these to personalize your bot!
proc anymonth {} {
set randmonth {
{January}
{February}
{March}
{April}
{May}
{June}
{July}
{August}
{September}
{October}
{November}
{December}
}
return [lindex $randmonth [rand [llength $randmonth]]]
}
#####################################################
### Don't need to touch the stuff below this line ###
#$###################################################
bind pubm $req(ak) * askquestion
bind pubm $req(ln) "* is *" learnit
bind pubm $req(ln) "* isn't *" learnit
#bind pubm $req(ln) "* it's *" learnit
#bind pubm $req(ln) "* are *" learnit
bind pubm - "* =~ *" alterit
bind pubm - "*--" karma_action
bind pubm - "*++" karma_action
bind pub o|o thaw thawit
bind pub m|m lock lockit
bind pub o|o freeze freezeit
bind pub m|m unlock unlockit
bind pub o|o forget forgetit
bind pub -|- karma karma_info
#bind dcc o|o "freeze" dcc_freezeit
#bind dcc o|o "forget" dcc_forgetit
set eggfu "2.0.2"
set floodcount 0
proc low {i} {return [string tolower $i]}
proc bit {} {global it;if {$it=="-no-"} {return ""} {return $it}}
proc botsnick {} {global botnick;return $botnick}
proc isfrozen {arg} {
set i 0
set text [getword $arg]
set apos [lsearch -exact $text "=>"]
set text [lrange $text [expr $apos + 1] e]
if {[lindex $text 0] == "!"} {set i 1}
if {[lindex $text 0] == "~"} {set i 1}
return $i
}
proc isinop {arg} {
set i 0
if {$arg=="<reply>"} {set i 1}
if {$arg=="<action>"} {set i 1}
if {$arg=="<ctcp>"} {set i 1}
if {$arg=="<notice>"} {set i 1}
return $i
}
proc alterit {nick host hand chan text} {
global botsnick
regsub -all "[botsnick], " $text "" text
regsub -all " s/" $text " " text
regsub -all "/" $text " / " text
set fseperator [lsearch -exact $text "=~"]
set seperator [lsearch -exact $text "/"]
set alterstring [lrange $text 0 [expr $fseperator -1]]
set alterwhat [lrange $text 2 [expr $seperator -1]]
set alterwith [lrange $text [expr $seperator +1] e]
regsub -all " /" $alterwith "" alterwith
set question [lrange [getword $alterstring] 1 e]
set searchforwhat [lsearch -exact $question $alterwhat]
if {[isfrozen $alterstring]} {
putnotc $nick "'$alterstring' has been frozen."
} elseif {$question == ""} {
putnotc $nick "No variable set!"
} elseif {$searchforwhat == "-1"} {
putnotc $nick "'$alterwhat' not in '$alterstring'!"
} {
regsub -all $alterwhat $question $alterwith result
delword $alterstring
addword $alterstring $result
putlog "!egg-fu! Alter: '$question' is now: $result"
putnotc $nick "'$alterstring' is altered."
}
}
proc freezeit {nick host hand chan text} {
global botsnick
regsub -all "[botsnick], " $text "" text
set wpos [lsearch -exact $text "freeze"]
set what [lrange $text [expr $wpos + 1] e]
set text [getword $what]
set apos [lsearch -exact $text "=>"]
set text [lrange $text [expr $apos + 1] e]
if {[isfrozen $what]} {
putnotc $nick "'$what' has already been frozen."
} elseif {$what != ""} {
putlog "!egg-fu! Freezing '$what'"
delword $what
addword $what "! $text"
putnotc $nick "'$what' is now frozen."
} {putnotc $nick "Freeze what?"}
}
proc thawit {nick host hand chan text} {
set wpos [lsearch -exact $text "thaw"]
set what [lrange $text [expr $wpos + 1] e]
set text [getword $what]
set apos [lsearch -exact $text "=>"]
set text [lrange $text [expr $apos + 1] e]
if {![isfrozen $what]} {
putnotc $nick "'$what' isn't frozen."
} elseif {$what != ""} {
putlog "!egg-fu! Thawing '$what'"
delword $what
addword $what [lrange $text 1 e]
putnotc $nick "'$what' is now unfrozen."
} {putnotc $nick "Thaw what?"}
}
proc lockit {nick host hand chan text} {
global botsnick
regsub -all "[botsnick], " $text "" text
set wpos [lsearch -exact $text "lock"]
set what [lrange $text [expr $wpos + 1] e]
if {[isfrozen $what]} {
putnotc $nick "'$what' has been frozen."
} elseif {$what != ""} {
putlog "!egg-fu! Locking '$what'"
delword $what
addword $what "~"
putnotc $nick "'$what' is now locked."
} {putnotc $nick "Lock what?"}
}
proc unlockit {nick host hand chan text} {
global botsnick
regsub -all "[botsnick], " $text "" text
set wpos [lsearch -exact $text "unlock"]
set what [lrange $text [expr $wpos + 1] e]
set text [lindex [getword $what] e]
if {$text == "~" && $what != ""} {
delword $what
putlog "!egg-fu! Unlocked '$what'"
putnotc $nick "'$what' is now unlocked."
} {putnotc $nick "Unlock what?"}
}
proc forgetit {nick host hand chan text} {
global botsnick
set wpos [lsearch -exact $text "forget"]
set what [lrange $text [expr $wpos + 1] e]
set text [lrange [getword $what] 1 e]
if {[isfrozen $what]} {
putnotc $nick "'$what' has been frozen."
} elseif {$text == ""} {
putnotc $nick "'$what' not found."
} elseif {$what != "" && [llength $what] < 3} {
delword $what
putnotc $nick "'$what' forgotten."
} {putnotc $nick "Forget what?"}
}
proc karma_info {nick host hand chan text} {
global botsnick
set karma_action [lindex $text 0]
regsub -all "\\\?" $text "" text
set karma [lindex $text 1]
if {$karma == "me"} { set karma $nick }
if {$karma == ""} {
putnotc $nick "You have not entered a karma option (karma for/set/reset)"
} elseif {$karma_action == "for"} {
set answer [lrange [getword "<karma> $karma"] 1 e]
if {$answer == "" || $answer == "0"} {
putchan $chan "$karma has neutral karma"
} {
putchan $chan "$karma has karma of $answer"
}
} elseif {$karma_action == "set"} {
set karma_setas [lindex $text 2]
if {$karma == $nick} {
putnotc $nick "Please don't karma yourself."
} elseif {$karma_setas != ""} {
putlog "!egg-fu! Karma: $karma been changed to $karma_setas"
delword "<karma> $karma"
addword "<karma> $karma" $karma_setas
putchan $chan "$karma has now been set to $karma_setas"
} {
putnotc $nick "You have not entered a set value! (karma set <karma> <new value>)"
}
} elseif {$karma_action == "reset"} {
if {$karma == $nick} {
putnotc $nick "Please don't karma yourself."
} else {
delword "<karma> $karma"
addword "<karma> $karma" ""
putchan $chan "$karma has been reset"
}
}
}
proc karma_action {nick host hand chan text} {
global botsnick
regsub -all "\\\+\\\+" $text " \+\+" text
regsub -all "\\\-\\\-" $text " \-\-" text
set karma [lindex $text 0]
set question [lrange [getword "<karma> $karma"] 1 e]
if {$karma == "me"} {set karma $nick}
if {$question == ""} {
addword "<karma> $karma" 1
putlog "!egg-fu! Karma: $karma set to 1"
} elseif {[low $karma] == [low $nick]} {
putnotc $nick "You cannot give yourself karma."
} else {
if {[lsearch -exact $text "\+\+"] == -1} {
incr question -1
} {
incr question 1
}
delword "<karma> $karma"
addword "<karma> $karma" $question
putlog "!egg-fu! Karma: $karma set to $question"
}
}
proc addword {keyword answer} {
global botsnick wordfile mdirect
# let's learn from others
if {$mdirect} {
set fword [lindex $keyword 0]
# putlog "!egg-fu! mDirect check: $fword"
if {[string match *:* $fword]} {
if {[llength $keyword]>1} {set keyword [lrange $keyword 1 e]
} {regsub -all ":" $keyword "" keyword}
# putlog "!egg-fu! Cauterized: $fword"
}
}
# fix the 'mysterious disappearances' bug
set feeler [lrange [getword $keyword] 1 e]
if {$keyword != $feeler && ![isfrozen $keyword]} {
set puts "$keyword => $answer"
regsub -all "\\{" $puts "" puts
regsub -all "\\}" $puts "" puts
set fh [open $wordfile a]
puts $fh $puts
close $fh
putlog "!egg-fu! Learn: $keyword => $answer"
}
}
proc getword {keyword} {
global botsnick wordfile
set foundone 0
set returnit {}
set fh [open $wordfile r]
while {![eof $fh]} {
set stdin [string trim [gets $fh]]
if {[eof $fh]} {break}
set breaker [lsearch -exact $stdin "=>"]
set getkey [low [lrange $stdin 0 [expr $breaker - 1]]]
set getresult [low [lrange $stdin [expr $breaker + 1] e]]
if {[string match -nocase "* $getkey *" "@ $keyword @"] || [string match -nocase "* $keyword *" "@ $getkey @"]} {
set returnit $stdin;set foundone 1
if {[rand 4]==1} {break}
}
}
close $fh
if {$foundone!=0} {return [string trim $returnit]}
}
proc delword {keyword} {
global botsnick wordfile
set fh [open $wordfile r]
set return {}
set del 0
while {![eof $fh]} {
set stdin [string trim [gets $fh]]
set breaker [lsearch -exact $stdin "=>"]
set getkey [low [lrange $stdin 0 [expr $breaker - 1]]]
if {[eof $fh]} {break}
if {![string match -nocase "* $keyword *" " $getkey "]} {
lappend return $stdin
} {incr del 1}
}
close $fh;
set fh [open $wordfile w]
foreach a $return {puts $fh $a}
close $fh
return $del
}
proc anynick {chan} {
global botsnick
set apb [botsnick]
while {$apb == [botsnick]} {
if {$apb != [botsnick]} {break}
set apb [lindex [split [chanlist "$chan"]] [rand [llength [split [chanlist "$chan"]]]]]
}
return $apb
}
proc anyrandq {text} {
regsub -all "\\| " $text "\t" text
set randq [lindex [split $text \t] [rand [llength [split $text \t]]]]
return $randq
}
proc randomize {q n c} {
set israndom [lsearch -exact $q "|"]
if {$israndom!=-1} {set q [anyrandq $q]}
# i plan on adding other $options in the future
regsub -all \\\$date $q [ctime [unixtime]] q
regsub -all \\\$month $q [anymonth] q
regsub -all \\\$day $q [anyday] q
regsub -all \\\$animal $q [anyanimal] q
regsub -all \\\$nick $q [anynick $c] q
# new as of 1.9
regsub -all \\\$item $q [anyitem] q
regsub -all \\\$adj $q [anyadj] q
# new as of 2.0
regsub -all \\\$birthday $q [happybday] q
regsub -all \\\$age $q [myage] q
regsub -all \\\$sex $q [mysex] q
# regsub -all \\\{ $q "" q
# regsub -all \\\} $q "" q
return [string trim $q]
}
proc mysex {} {
set bc [open birth_certificate.egg r]
set sex [gets $bc]
set sex [gets $bc]
close $bc;return $sex
}
proc myage {} {
set bc [open birth_certificate.egg r]
set bdate [gets $bc]
close $bc
set ztime [unoctal [mconv [getdate time]]]
set btime [unoctal [mconv [lindex $bdate 1]]]
set bdate [lindex $bdate 0]
set today [getdate date]
set month [unoctal [lindex [split $today /] 0]]
set bmonth [unoctal [lindex [split $bdate /] 0]]
set zyear [getdate year]
set byear [lindex [split $bdate /] 2]
#putlog "$ztime $btime $bdate $today $month $bmonth $zyear $byear"
if {$today==$bdate} {
return [lconv [expr $ztime - $btime]]
} elseif {$month==$bmonth} {
return "[expr [unoctal [lindex [split $today /] 1]] - [unoctal [lindex [split $bdate /] 1]]] days"
} elseif {$zyear==$byear} {
return "[expr $month - $bmonth] months"
} else {
return "[expr $zyear - $byear] years"
}
}
proc lconv {mins} {
set i 0;set n $mins;set hour 0
while {$i<$n} {
incr i
if {$i>$n} {break}
if {$mins>59} {incr mins -60;incr hour}
}
set mins [unoctal $mins]
set hour [unoctal $hour]
#1440=24
if {$mins!=0} {return "$hour hrs, $mins min"
} {return "$hour hrs"}
}
proc mconv {args} {return [expr [lindex [split $args :] 1] + ([unoctal [lindex [split $args :] 0]] * 60)]}
proc getdate {arg} {
set system [split [concat [exec date +%m/%d/%Y@%H:%M]] @]
set date [split [lindex $system 0] /]
set time [lindex $system 1]
set month [lindex $date 0]
set day [lindex $date 1]
set year [lindex $date 2]
set date [join $date /]
if {$arg=="date"} {return $date}
if {$arg=="time"} {return $time}
if {$arg=="month"} {return $month}
if {$arg=="day"} {return $day}
if {$arg=="year"} {return $year}
}
proc unoctal {args} {
set args [split $args {}]
set n [llength $args]
set i 0
while {$i<$n} {
if {[string match 0 [lindex $args 0]]} {regsub -all "0 " $args "" args}
incr i;set n [llength $args]
if {$i>$n} {break}
}
return [join $args {}]
}
proc happybday {} {
set bc [open birth_certificate.egg r]
set bdate [lindex [gets $bc] 0];close $bc
set bdiff [myage]
# !B is for born (birthdate), !D is for difference (age)
set bday {
{I was born on !B. I'm only !D old}
{My birthday is !B}
{My birthday is !B}
{I'm only !D old!}
{}
}
regsub -all "!B" $bday $bdate bday
regsub -all "!D" $bday $bdiff bday
return [lindex $bday [rand [llength $bday]]]
}
proc learnit {nick host hand chan text} {
global botsnick lrntrig ltrigger otherbots req
regsub -all "\\\"" $text "'" text
# death to leet hax0rz!
# regsub -all "\\\\n|\\\\a|\\\\b|\\\\f|\\\\r|\\\\t|\\\\v" $text "" text
regsub -all "\007|\015|\022|\026|\028|\030" $text "" text
regsub -all "\\\\" $text "\\\\\\\\" text
# regsub -all "\\\[" $text "\\\\\\\[" text
# regsub -all "\\\]" $text "\\\\\\\]" text
# regsub -nocase "'s " $text " is " text
regsub -nocase " let is " $text " lets " text
regsub -nocase " isn't " $text " is not " text
set text [fixgrammar $text]
set start [low [lindex $text 0]]
set ignorewords {[botsnick] who what ok}
if {($lrntrig) && [lindex $text 0]!="[bit]$ltrigger"} {
set do_nothing 1
} elseif {![string match *$nick* $otherbots]} {
# lets not forget about stripping! wooohoooo
if {$lrntrig} {
regsub -all -nocase "[bit]$ltrigger " $text "" text
}
set original {}
set type [lsearch -exact [low $text] "is"]
if {$type!="-1"} {set type "is"} {set type "are"}
set whom [lsearch -exact $text "$type"]
set getword [getword [lrange $text 0 [expr $whom -1]]]
if {$getword!=""} {
set breaker [lsearch -exact $getword "=>"]
set keyword [lrange $getword 0 [expr $breaker - 1]]
set original [lrange $getword [expr $breaker + 1] e]
} else {
set keyword [lrange $text 0 [expr $whom -1]]
}
set response [lrange $text [expr $whom + 1] e]
if {![isinop [lindex $response 0]]} {
set ll [lindex [split [lindex $response e] {}] e]
while {$ll=="."} {
set response "[lrange $response 0 end-1] [join [lrange [split [lindex $response e] {}] 0 end-1] {}]"
set response [string trim $response]
set ll [lindex [split [lindex $response e] {}] e]
}
} {
if {![matchattr $hand $req(cn)]} {
putnotc $nick "Sorry, you don't have access to do that."
return 0
}
}
set also [lindex $text [expr $whom + 1]]
# replace a few things
regsub -all -nocase " my " $response " $nick's " response
regsub -all -nocase " i am " $response " $nick is " response
regsub -all -nocase "[botsnick] is " $response "I am " response
regsub -all -nocase " [botsnick]'s " $response " my " response
regsub -all -nocase "[botsnick], " $text "" text
if {[string match *$start* $ignorewords]} {set text [lrange $text 1 e]}
if {[string match -nocase no, $start] && ![isfrozen $keyword]} {delword $keyword}
if {$original != "" && ![isfrozen $keyword]} {
delword $keyword
set response "$original | $response"
set original {}
}
if {($original == "" && ![isfrozen $keyword]) && ([string length $keyword] >= 3 && [string length $keyword] <= 100)} {
# if {$start == "no,"} {putchan $chan "Ok $nick"}
addword $keyword $response
}
}
}
proc fixgrammar {text} {
# If you can think of any other common things that need to be converted
# PLEASE tell me!! :)
set text "@ $text @"
regsub -all -nocase " i " $text " I " text
regsub -all -nocase " i'm " $text " I'm " text
regsub -all -nocase " i'd " $text " I'd " text
regsub -all -nocase " i've " $text " I've " text
regsub -all -nocase " i'll " $text " I'll " text
regsub -all -nocase " u " $text " you " text
regsub -all -nocase " r " $text " are " text
regsub -all -nocase " ur " $text " your " text
regsub -all -nocase " yer" $text " your" text
regsub -all -nocase " fav " $text " favorite " text
regsub -all -nocase " fav. " $text " favorite " text
regsub -all -nocase " bish " $text " bitch " text
regsub -all -nocase " whut " $text " what " text
regsub -all -nocase " werd " $text " word " text
regsub -all -nocase " werk " $text " work " text
regsub -all -nocase " prolly " $text " probably " text
regsub -all -nocase " better then " $text " better than " text
return [string trim [lrange $text 1 [expr [llength $text] - 2]]]
}
proc askquestion {nick host hand chan text} {
global botnick botsnick wordfile floodcount workingchans eggfu
global asktrig atrigger randmy randmn otherbots range
set botsnick [low $botnick]
set lownick [low $nick]
if {($asktrig && [lindex $text 0]!="[bit]$atrigger") || [string match -nocase *$nick* $otherbots]} {
set do_nothing 1
} elseif {(([lsearch -exact [low $workingchans] [low $chan]] != -1) || ($workingchans == "")) && [string length $text] != 1} {
# dont forget to snip the !cmd
if {$asktrig == 1 && [lindex $text 0] == $atrigger} {regsub -all "$atrigger " $text "" text}
regsub -all "\\\"" $text "'" text
regsub -all "\\\!" $text "" text
regsub -all "\\\?" $text "" text
set ll [lindex [split [lindex $text e] {}] e]
while {$ll=="."} {
set text "[lrange $text 0 end-1] [join [lrange [split [lindex $text e] {}] 0 end-1] {}]"
set text [string trim $text]
set ll [lindex [split [lindex $text e] {}] e]
}
set text [string trim $text]
set q(start) [lindex $text 0]
set q(end) [lrange $text [expr [llength $text] - $range] e]
set q(long) $text
#if {$getquestion == "me?"} {set q(end) $nick}
#regsub -all "me?" $q(end) "$nick" q(end)
regsub -all "\007|\015|\022|\026|\028|\030" $q(start) "" q(start)
set getword [getword $q(end)]
set breaker [lsearch -exact $getword "=>"]
set keyword [lrange $getword 0 [expr $breaker - 1]]
if {[isfrozen $keyword]} {incr breaker}
set q(ans) [lrange $getword [expr $breaker + 1] e]
if {[isfrozen $q(ans)]} {set q(ans) [lrange $q(ans) 2 e]}
if {$q(long)=="egg-fu"} {set q(ans) "<action> is running \002egg-fu $eggfu\002, by ch3mical"}
#if {$q(ans)=="" && $q(end)!=$q(long)} {set q(ans) $q(end)}
set q(ans) [randomize $q(ans) $nick $chan]
regsub -all "\\\$question" $q(ans) "$text" q(ans)
regsub -all "\\\$keyword" $q(ans) "$q(long)" q(ans)
regsub -all "\\{" $keyword "" keyword
regsub -all "\\}" $keyword "" keyword
regsub -all "\\{" $q(ans) "" q(ans)
regsub -all "\\}" $q(ans) "" q(ans)
set sendto $chan
if {$q(start) == "tell"} {
set whom [lsearch -exact $text "tell"]
set target [lindex $text [expr $whom + 1]]
if {$target!=""} {
set sendto $target
regsub -all "\\\$who" $q(ans) $target q(ans)
}
} {regsub -all "\\\$who" $q(ans) $nick q(ans)}
if {$q(ans)!="" && $q(ans)!="~"} {
set getstart [lindex $q(ans) 0]
set getrest [lrange $q(ans) 1 e]
if {$getstart == "<reply>"} {
putserv "PRIVMSG $sendto :$getrest"
if {$sendto!=$nick && $sendto!=$chan} {putnotc $nick "Told $sendto \"$getrest\""}
} elseif {$getstart == "<ctcp>"} {putserv "PRIVMSG $nick :\001$getrest\001"
} elseif {$getstart == "<notice>"} {putnotc $sendto "$getrest"
} elseif {$getstart == "<action>"} {putserv "PRIVMSG $sendto :\001ACTION $getrest\001"
} {
regsub -all "!Q" [randy] $keyword randmy
regsub -all "!A" $randmy $q(ans) randmy
regsub -all "!U" $randmy $nick randmy
putserv "PRIVMSG $sendto :$randmy"
}
} elseif {[string match -nocase [botsnick]* $q(start)] && $q(end) != ""} {
if {[lindex $q(end) 0]==$q(start)} {set q(end) [lrange $q(end) 1 e]}
regsub -all "\\?" $q(end) "" q(end)
regsub -all "!Q" [randn] $q(end) randmn
regsub -all "!A" $randmn $q(ans) randmn
regsub -all "!U" $randmn $nick randmn
putserv "PRIVMSG $sendto :$randmn"
}
}
return 0
}
if {![file exists birth_certificate.egg]} {
set coin [rand 10]
if {$coin>=5} {set sex boy} {set sex girl}
putlog "\002IT'S A [string toupper $sex]!!\002"
putlog "\002Congratulations!\002 You are now the proud parent of an \002egg-fu\002 bot!"
set bdate [clock format [clock seconds] -format "%m/%d/%Y@%H:%M"
putlog "I was born on \002$bdate\002"
set bc [open birth_certificate.egg w]
puts $bc $bdate
puts $bc $sex;close $bc
if {![file exists $wordfile]} {
putlog "Creating Brain...";set wf [open $wordfile w]
} {set wf [open $wordfile a+]}
puts $wf "born => <reply> \$birthday"
puts $wf "birthday => <reply> \$birthday"
puts $wf "how old are you => <reply> I'm \$age old | <action> is \$age old"
puts $wf "boy or girl => <reply> I'm a \$sex! | <action> is a \$sex"
puts $wf "asl => <reply> \$age/\$sex/earth!"
puts $wf "how => ~"
puts $wf "who => ~"
puts $wf "why => ~"
puts $wf "what => ~"
puts $wf "when => ~"
puts $wf "where => ~"
puts $wf "wtf => ~"
close $wf
}
set bc [open birth_certificate.egg r]
set sex [gets $bc];set sex [gets $bc];close $bc
putlog "\002egg\002-\002fu\002 \002$eggfu\002 loaded! (age: [myage], sex: $sex)"
|
plz help  |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Tue Oct 23, 2007 8:02 pm Post subject: |
|
|
Change:
| Code: | | set bdate [clock format [clock seconds] -format "%m/%d/%Y@%H:%M" |
to
| Code: | | set bdate [clock format [clock seconds] -format "%m/%d/%Y@%H:%M"] |
_________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
PoHuIsT Voice
Joined: 22 Oct 2007 Posts: 23
|
Posted: Wed Oct 24, 2007 4:02 am Post subject: |
|
|
| Code: |
[09:01] child killed: SIGABRT
while executing
"exec date +%m/%d/%Y@%H:%M"
(procedure "getdate" line 2)
invoked from within
"getdate time"
(procedure "myage" line 6)
invoked from within
"myage"
invoked from within
"putlog "\002egg\002-\002fu\002 \002$eggfu\002 loaded! (age: [myage], sex: $sex)
""
(file "scripts/egg-fu_2.0.2.tcl" line 940)
invoked from within
"source scripts/egg-fu_2.0.2.tcl"
(file "Default.conf" line 1356)
[09:01] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR) |
Not not working i have this error |
|
| Back to top |
|
 |
PoHuIsT Voice
Joined: 22 Oct 2007 Posts: 23
|
Posted: Wed Oct 24, 2007 8:26 am Post subject: |
|
|
| so eny help ???? |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Wed Oct 24, 2007 11:29 am Post subject: |
|
|
SIGABRT usually means that the application or one of it's support libraries was unable to complete the request. The cause could be pretty much anything. Your best chance of getting this one fixed is most likely getting in touch with the system administrator. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
PoHuIsT Voice
Joined: 22 Oct 2007 Posts: 23
|
Posted: Thu Oct 25, 2007 4:38 am Post subject: |
|
|
i try all and ic not working : i have a mrc skript good boot but cant conwert hem to tcl maybe you can help ?
here iz a code
| Code: |
on *:text:*:#: {
if (!$isfile(sakiniai.txt)) { write sakiniai.txt labas }
if ($numtok($strip($1-),32) > 1) {
var %n = $nick($chan,0)
var %z = $remove($strip($1-), $me , http:// , www. , $chr(35))
while (%n > 0) {
var %z = $remove(%z,$nick($chan,%n))
dec %n
}
var %a = $read(sakiniai.txt, w , * $+ $gettok($strip($1-),$rand(1,$numtok($strip($1-),32)),32) $+ *, $rand(1,$lines(sakiniai.txt)))
if (%a) { //.timer 1 2 /msg $chan %a } }
if (%z) { write -s $+ $gettok(%z,1,32) sakiniai.txt %z }
}
}
|
|
|
| Back to top |
|
 |
PoHuIsT Voice
Joined: 22 Oct 2007 Posts: 23
|
Posted: Thu Oct 25, 2007 5:58 am Post subject: |
|
|
plz help  |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Oct 25, 2007 6:32 am Post subject: |
|
|
| PoHuIsT wrote: | plz help  |
change: | Code: | | set system [split [concat [exec date +%m/%d/%Y@%H:%M]] @] | to: | Code: | | set system [split [clock format [clock seconds] -format "%m/%d/%Y@%H:%M"] @] |
|
|
| Back to top |
|
 |
PoHuIsT Voice
Joined: 22 Oct 2007 Posts: 23
|
Posted: Thu Oct 25, 2007 6:38 am Post subject: |
|
|
| Quote: |
[11:37] wrong # args: should be "set varName ?newValue?"
while compiling
"set system [split [clock format [clock seconds] -format "%m/%d/%Y@%H:%M"] @] se
t date [split [lindex $system 0] /]"
(compiling body of proc "getdate", line 2)
invoked from within
"getdate time"
(procedure "myage" line 6)
invoked from within
"myage"
invoked from within
"putlog "\002egg\002-\002fu\002 \002$eggfu\002 loaded! (age: [myage], sex: $sex)
""
(file "scripts/egg-fu_2.0.2.tcl" line 939)
invoked from within
"source scripts/egg-fu_2.0.2.tcl"
|
nop dozent work  |
|
| Back to top |
|
 |
PoHuIsT Voice
Joined: 22 Oct 2007 Posts: 23
|
Posted: Thu Oct 25, 2007 6:43 am Post subject: |
|
|
| Code: |
[11:41] can't read "date": no such variable
while executing
"lindex $date 0"
(procedure "getdate" line 4)
invoked from within
"getdate time"
(procedure "myage" line 6)
invoked from within
"myage"
invoked from within
"putlog "\002egg\002-\002fu\002 \002$eggfu\002 loaded! (age: [myage], sex: $sex)
""
(file "scripts/egg-fu_2.0.2.tcl" line 939) |
|
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Oct 25, 2007 6:44 am Post subject: |
|
|
| PoHuIsT wrote: | | Quote: |
[11:37] wrong # args: should be "set varName ?newValue?"
while compiling
"set system [split [clock format [clock seconds] -format "%m/%d/%Y@%H:%M"] @] se
t date [split [lindex $system 0] /]" |
|
You realize you forgot a linefeed or something between the system and date set's right? Because that's your problem now......  |
|
| Back to top |
|
 |
PoHuIsT Voice
Joined: 22 Oct 2007 Posts: 23
|
Posted: Thu Oct 25, 2007 7:12 am Post subject: |
|
|
| Code: |
[11:41] can't read "date": no such variable
while executing
"lindex $date 0"
(procedure "getdate" line 4)
invoked from within
"getdate time"
(procedure "myage" line 6)
invoked from within
"myage"
invoked from within
"putlog "\002egg\002-\002fu\002 \002$eggfu\002 loaded! (age: [myage], sex: $sex)
""
(file "scripts/egg-fu_2.0.2.tcl" line 939) |
no i got this problem  |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Oct 25, 2007 7:16 am Post subject: |
|
|
| PoHuIsT wrote: | | Code: |
[11:41] can't read "date": no such variable
while executing
"lindex $date 0"
(procedure "getdate" line 4)
invoked from within
"getdate time"
(procedure "myage" line 6)
invoked from within
"myage"
invoked from within
"putlog "\002egg\002-\002fu\002 \002$eggfu\002 loaded! (age: [myage], sex: $sex)
""
(file "scripts/egg-fu_2.0.2.tcl" line 939) |
no i got this problem  |
Maybe because I f--ked up. You used an arguement to date check against, whle I just grabbed whatever time it was presently. Try this instead: | Code: | | set system [split [clock format [clock scan $date] -format "%m/%d/%Y@%H:%M"] @] | If you still get problems, its the way exec date returns a different format than clock format even though both use the same directives. |
|
| Back to top |
|
 |
PoHuIsT Voice
Joined: 22 Oct 2007 Posts: 23
|
Posted: Thu Oct 25, 2007 7:27 am Post subject: |
|
|
| Code: |
while executing
"clock scan $date"
(procedure "getdate" line 2)
invoked from within
"getdate time"
(procedure "myage" line 6)
invoked from within
"myage"
invoked from within
"putlog "\002egg\002-\002fu\002 \002$eggfu\002 loaded! (age: [myage], sex: $sex)
""
(file "scripts/egg-fu_2.0.2.tcl" line 939)
invoked from within
"source scripts/egg-fu_2.0.2.tcl" |
this iz now how my tcl locks
| Code: |
#eggdrop1.6 +/-
# ___
# .-----..-----..-----. __ .' _|.--.--.
# | -__|| _ || _ ||__|| ._|| | |
# |_____||___ ||___ | |__| |_____|
# |_____||_____|
# version 2.0.2
#
#
# Copyright (C) 2002, ch3mical
# CitizenK@mad.scientist.com
# irc.secsup.org (EFnet)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Version Information (Major Additions and Bug Fixes!) can be found in the
# Version.txt included in the package.
#
# Feature explanations, instructions, and HELP can be found in
# How-to.txt included in the package.
#
##########################################################################
# If you use the following code in any form partial or modifed, at least #
# give the programmer who did this much hard work his deserved credit! #
##########################################################################
#
# Greetz:
# Tigrrr, psynapse, dilvie, yo momma, mickrip, poke, #trax
# one_, sunrpc, ^PLAID^, Tenebrous, Byte, KottoN, raz0rchiq, Law
# tekneeks, vortek, peeps on the west side, ziricon, and everyone else
#
# Thanks to:
# brainiac for being the beta-test monkey
#
# email your suggestions/questions/comments/bitches to:
# CitizenK@mad.scientist.com
#
##########################################################################
#@##### SETUP THE SCRIPT #######
# Please change the details below
# To work in all channels leave this blank
set workingchans ""
# List any other bots you want to be ignored
set otherbots "dark-bot infobot soundbot"
# Location of your word file
set wordfile "brain.txt"
# [0/1] Set this to 0 to turn off misdirection-learning (not recommended)
set mdirect 1
# This is the character that will PRECEED all !trigger commands (if
# enabled), set this to "-no-" to make triggers work without it
set it "!"
# [0/1] Require a !trigger command for learning?
set lrntrig 0
set ltrigger "set"
# [0/1] Require a !trigger command for questions?
# It's ok to set both triggers the same
set asktrig 0
set atrigger "ask"
# [hjmnoptx] Require which modes to use learn?
# Set to "-" to allow anyone to teach egg-fu
set req(ln) "-|-"
# [hjmnoptx] Require which modes to use ask?
# Set to "-" to allow anyone to ask
set req(ak) "-"
# [hjmnoptx] Require which modes to use <ctcp> or <notice>
# Set to "-" to allow all (not recommended)
set req(cn) "o|o"
# Set the subject range here, this refers to how much of the sentence
# egg-fu will process, (default=4)
set range 4
### DONE ###
# These fields can be modifed if you wish!
# !Q=question !A=answer !U=who asked
# above items are replaced by the script with proper values
proc randy {} {
set apb {
{I heard that !Q is !A}
{Did you know that !Q is !A?}
{!Q is !A}
{I'm sure !Q is !A}
{!U: someone said that !Q is !A}
{!Q might be !A}
{Didn't you say !Q is !A?}
{Could it be !Q is !A?}
{I guess !Q is !A}
{Hmmm. I think !Q is !A}
{Well, !Q is !A}
{!U, !Q is probably !A}
{I bet !Q is !A}
{Isn't !Q !A?}
{!U: !Q is !A}
{Do you think !Q is !A?}
}
return [lindex $apb [rand [llength $apb]]]
}
# add/change these to personalize your bot!
proc randn {} {
set apb {
{I don't know, !U.}
{I'm not sure what !Q is.}
{No idea, !U.}
{Why don't you enlighten me, !U?}
{Can't sleep clowns will eat me!}
{I've got no idea, !U...}
{Yo momma knows about !Q!}
{!U: don't ask me, I don't know.}
{I don't know what !Q is, !U.}
{Well maybe you should tell me, !U?}
}
return [lindex $apb [rand [llength $apb]]]
}
# add/change these to personalize your bot!
proc anyanimal {} {
set randanimal {
{goat}
{llama}
{lemming}
{gerbil}
{penguin}
{dung beetle}
{billy goat}
{grizzly bear}
{ostrich}
{drunken transient}
{donkey}
{sea monkey}
{buffalo}
{dog}
{monkey}
{freaky little hamster}
{monkey faced eel}
{iguana}
{hippo}
{bull}
{cow}
{duck}
{zebra}
{giraffe}
}
return [lindex $randanimal [rand [llength $randanimal]]]
}
# add/change these to personalize your bot!
proc anycolor {} {
set apb {
{red}
{yellow}
{orange}
{green}
{blue}
{brown}
{pink}
{purple}
{magenta}
{black}
{white}
}
return [lindex $apb [rand [llength $apb]]]
}
# add/change these to personalize your bot!
# these are NOUNS
proc anyitem {} {
set apb {
{screw driver}
{fire hose}
{corndog}
{wrench}
{excrement}
{pig cheese}
{barbie doll}
{bleeding pimple}
{trout}
{headless corpse}
{cattle prod}
{blowup sheep}
{dirty diaper}
{dried cum stain}
{portable cheese grater}
{bottle of prozac}
{flying detachable penis}
{condom}
{severed head}
{UNIX manual}
}
return [lindex $apb [rand [llength $apb]]]
}
# add/change these to personalize your bot!
# these are ADJECTIVES
proc anyadj {} {
set apb {
{stupid}
{silly}
{ugly}
{smelly}
{hairy}
{sticky}
{used}
{green}
{pink}
{purple}
{abused}
{torn}
{broken}
{squashed}
{crusty}
{thin}
{fat}
{old}
{slick}
{slippery}
{spicy}
{spiked}
{blown up}
}
return [lindex [concat [concat $apb]] [rand [llength $apb]]]
}
# add/change these to personalize your bot!
proc anyday {} {
set randday {
{Monday}
{Tuesday}
{Wednesday}
{Thursday}
{Friday}
{Saturday}
{Sunday}
{some day}
{any day}
{tomorrow}
{yesterday}
}
return [lindex $randday [rand [llength $randday]]]
}
# add/change these to personalize your bot!
proc anymonth {} {
set randmonth {
{January}
{February}
{March}
{April}
{May}
{June}
{July}
{August}
{September}
{October}
{November}
{December}
}
return [lindex $randmonth [rand [llength $randmonth]]]
}
#####################################################
### Don't need to touch the stuff below this line ###
#$###################################################
bind pubm $req(ak) * askquestion
bind pubm $req(ln) "* is *" learnit
bind pubm $req(ln) "* isn't *" learnit
#bind pubm $req(ln) "* it's *" learnit
#bind pubm $req(ln) "* are *" learnit
bind pubm - "* =~ *" alterit
bind pubm - "*--" karma_action
bind pubm - "*++" karma_action
bind pub o|o thaw thawit
bind pub m|m lock lockit
bind pub o|o freeze freezeit
bind pub m|m unlock unlockit
bind pub o|o forget forgetit
bind pub -|- karma karma_info
#bind dcc o|o "freeze" dcc_freezeit
#bind dcc o|o "forget" dcc_forgetit
set eggfu "2.0.2"
set floodcount 0
proc low {i} {return [string tolower $i]}
proc bit {} {global it;if {$it=="-no-"} {return ""} {return $it}}
proc botsnick {} {global botnick;return $botnick}
proc isfrozen {arg} {
set i 0
set text [getword $arg]
set apos [lsearch -exact $text "=>"]
set text [lrange $text [expr $apos + 1] e]
if {[lindex $text 0] == "!"} {set i 1}
if {[lindex $text 0] == "~"} {set i 1}
return $i
}
proc isinop {arg} {
set i 0
if {$arg=="<reply>"} {set i 1}
if {$arg=="<action>"} {set i 1}
if {$arg=="<ctcp>"} {set i 1}
if {$arg=="<notice>"} {set i 1}
return $i
}
proc alterit {nick host hand chan text} {
global botsnick
regsub -all "[botsnick], " $text "" text
regsub -all " s/" $text " " text
regsub -all "/" $text " / " text
set fseperator [lsearch -exact $text "=~"]
set seperator [lsearch -exact $text "/"]
set alterstring [lrange $text 0 [expr $fseperator -1]]
set alterwhat [lrange $text 2 [expr $seperator -1]]
set alterwith [lrange $text [expr $seperator +1] e]
regsub -all " /" $alterwith "" alterwith
set question [lrange [getword $alterstring] 1 e]
set searchforwhat [lsearch -exact $question $alterwhat]
if {[isfrozen $alterstring]} {
putnotc $nick "'$alterstring' has been frozen."
} elseif {$question == ""} {
putnotc $nick "No variable set!"
} elseif {$searchforwhat == "-1"} {
putnotc $nick "'$alterwhat' not in '$alterstring'!"
} {
regsub -all $alterwhat $question $alterwith result
delword $alterstring
addword $alterstring $result
putlog "!egg-fu! Alter: '$question' is now: $result"
putnotc $nick "'$alterstring' is altered."
}
}
proc freezeit {nick host hand chan text} {
global botsnick
regsub -all "[botsnick], " $text "" text
set wpos [lsearch -exact $text "freeze"]
set what [lrange $text [expr $wpos + 1] e]
set text [getword $what]
set apos [lsearch -exact $text "=>"]
set text [lrange $text [expr $apos + 1] e]
if {[isfrozen $what]} {
putnotc $nick "'$what' has already been frozen."
} elseif {$what != ""} {
putlog "!egg-fu! Freezing '$what'"
delword $what
addword $what "! $text"
putnotc $nick "'$what' is now frozen."
} {putnotc $nick "Freeze what?"}
}
proc thawit {nick host hand chan text} {
set wpos [lsearch -exact $text "thaw"]
set what [lrange $text [expr $wpos + 1] e]
set text [getword $what]
set apos [lsearch -exact $text "=>"]
set text [lrange $text [expr $apos + 1] e]
if {![isfrozen $what]} {
putnotc $nick "'$what' isn't frozen."
} elseif {$what != ""} {
putlog "!egg-fu! Thawing '$what'"
delword $what
addword $what [lrange $text 1 e]
putnotc $nick "'$what' is now unfrozen."
} {putnotc $nick "Thaw what?"}
}
proc lockit {nick host hand chan text} {
global botsnick
regsub -all "[botsnick], " $text "" text
set wpos [lsearch -exact $text "lock"]
set what [lrange $text [expr $wpos + 1] e]
if {[isfrozen $what]} {
putnotc $nick "'$what' has been frozen."
} elseif {$what != ""} {
putlog "!egg-fu! Locking '$what'"
delword $what
addword $what "~"
putnotc $nick "'$what' is now locked."
} {putnotc $nick "Lock what?"}
}
proc unlockit {nick host hand chan text} {
global botsnick
regsub -all "[botsnick], " $text "" text
set wpos [lsearch -exact $text "unlock"]
set what [lrange $text [expr $wpos + 1] e]
set text [lindex [getword $what] e]
if {$text == "~" && $what != ""} {
delword $what
putlog "!egg-fu! Unlocked '$what'"
putnotc $nick "'$what' is now unlocked."
} {putnotc $nick "Unlock what?"}
}
proc forgetit {nick host hand chan text} {
global botsnick
set wpos [lsearch -exact $text "forget"]
set what [lrange $text [expr $wpos + 1] e]
set text [lrange [getword $what] 1 e]
if {[isfrozen $what]} {
putnotc $nick "'$what' has been frozen."
} elseif {$text == ""} {
putnotc $nick "'$what' not found."
} elseif {$what != "" && [llength $what] < 3} {
delword $what
putnotc $nick "'$what' forgotten."
} {putnotc $nick "Forget what?"}
}
proc karma_info {nick host hand chan text} {
global botsnick
set karma_action [lindex $text 0]
regsub -all "\\\?" $text "" text
set karma [lindex $text 1]
if {$karma == "me"} { set karma $nick }
if {$karma == ""} {
putnotc $nick "You have not entered a karma option (karma for/set/reset)"
} elseif {$karma_action == "for"} {
set answer [lrange [getword "<karma> $karma"] 1 e]
if {$answer == "" || $answer == "0"} {
putchan $chan "$karma has neutral karma"
} {
putchan $chan "$karma has karma of $answer"
}
} elseif {$karma_action == "set"} {
set karma_setas [lindex $text 2]
if {$karma == $nick} {
putnotc $nick "Please don't karma yourself."
} elseif {$karma_setas != ""} {
putlog "!egg-fu! Karma: $karma been changed to $karma_setas"
delword "<karma> $karma"
addword "<karma> $karma" $karma_setas
putchan $chan "$karma has now been set to $karma_setas"
} {
putnotc $nick "You have not entered a set value! (karma set <karma> <new value>)"
}
} elseif {$karma_action == "reset"} {
if {$karma == $nick} {
putnotc $nick "Please don't karma yourself."
} else {
delword "<karma> $karma"
addword "<karma> $karma" ""
putchan $chan "$karma has been reset"
}
}
}
proc karma_action {nick host hand chan text} {
global botsnick
regsub -all "\\\+\\\+" $text " \+\+" text
regsub -all "\\\-\\\-" $text " \-\-" text
set karma [lindex $text 0]
set question [lrange [getword "<karma> $karma"] 1 e]
if {$karma == "me"} {set karma $nick}
if {$question == ""} {
addword "<karma> $karma" 1
putlog "!egg-fu! Karma: $karma set to 1"
} elseif {[low $karma] == [low $nick]} {
putnotc $nick "You cannot give yourself karma."
} else {
if {[lsearch -exact $text "\+\+"] == -1} {
incr question -1
} {
incr question 1
}
delword "<karma> $karma"
addword "<karma> $karma" $question
putlog "!egg-fu! Karma: $karma set to $question"
}
}
proc addword {keyword answer} {
global botsnick wordfile mdirect
# let's learn from others
if {$mdirect} {
set fword [lindex $keyword 0]
# putlog "!egg-fu! mDirect check: $fword"
if {[string match *:* $fword]} {
if {[llength $keyword]>1} {set keyword [lrange $keyword 1 e]
} {regsub -all ":" $keyword "" keyword}
# putlog "!egg-fu! Cauterized: $fword"
}
}
# fix the 'mysterious disappearances' bug
set feeler [lrange [getword $keyword] 1 e]
if {$keyword != $feeler && ![isfrozen $keyword]} {
set puts "$keyword => $answer"
regsub -all "\\{" $puts "" puts
regsub -all "\\}" $puts "" puts
set fh [open $wordfile a]
puts $fh $puts
close $fh
putlog "!egg-fu! Learn: $keyword => $answer"
}
}
proc getword {keyword} {
global botsnick wordfile
set foundone 0
set returnit {}
set fh [open $wordfile r]
while {![eof $fh]} {
set stdin [string trim [gets $fh]]
if {[eof $fh]} {break}
set breaker [lsearch -exact $stdin "=>"]
set getkey [low [lrange $stdin 0 [expr $breaker - 1]]]
set getresult [low [lrange $stdin [expr $breaker + 1] e]]
if {[string match -nocase "* $getkey *" "@ $keyword @"] || [string match -nocase "* $keyword *" "@ $getkey @"]} {
set returnit $stdin;set foundone 1
if {[rand 4]==1} {break}
}
}
close $fh
if {$foundone!=0} {return [string trim $returnit]}
}
proc delword {keyword} {
global botsnick wordfile
set fh [open $wordfile r]
set return {}
set del 0
while {![eof $fh]} {
set stdin [string trim [gets $fh]]
set breaker [lsearch -exact $stdin "=>"]
set getkey [low [lrange $stdin 0 [expr $breaker - 1]]]
if {[eof $fh]} {break}
if {![string match -nocase "* $keyword *" " $getkey "]} {
lappend return $stdin
} {incr del 1}
}
close $fh;
set fh [open $wordfile w]
foreach a $return {puts $fh $a}
close $fh
return $del
}
proc anynick {chan} {
global botsnick
set apb [botsnick]
while {$apb == [botsnick]} {
if {$apb != [botsnick]} {break}
set apb [lindex [split [chanlist "$chan"]] [rand [llength [split [chanlist "$chan"]]]]]
}
return $apb
}
proc anyrandq {text} {
regsub -all "\\| " $text "\t" text
set randq [lindex [split $text \t] [rand [llength [split $text \t]]]]
return $randq
}
proc randomize {q n c} {
set israndom [lsearch -exact $q "|"]
if {$israndom!=-1} {set q [anyrandq $q]}
# i plan on adding other $options in the future
regsub -all \\\$date $q [ctime [unixtime]] q
regsub -all \\\$month $q [anymonth] q
regsub -all \\\$day $q [anyday] q
regsub -all \\\$animal $q [anyanimal] q
regsub -all \\\$nick $q [anynick $c] q
# new as of 1.9
regsub -all \\\$item $q [anyitem] q
regsub -all \\\$adj $q [anyadj] q
# new as of 2.0
regsub -all \\\$birthday $q [happybday] q
regsub -all \\\$age $q [myage] q
regsub -all \\\$sex $q [mysex] q
# regsub -all \\\{ $q "" q
# regsub -all \\\} $q "" q
return [string trim $q]
}
proc mysex {} {
set bc [open birth_certificate.egg r]
set sex [gets $bc]
set sex [gets $bc]
close $bc;return $sex
}
proc myage {} {
set bc [open birth_certificate.egg r]
set bdate [gets $bc]
close $bc
set ztime [unoctal [mconv [getdate time]]]
set btime [unoctal [mconv [lindex $bdate 1]]]
set bdate [lindex $bdate 0]
set today [getdate date]
set month [unoctal [lindex [split $today /] 0]]
set bmonth [unoctal [lindex [split $bdate /] 0]]
set zyear [getdate year]
set byear [lindex [split $bdate /] 2]
#putlog "$ztime $btime $bdate $today $month $bmonth $zyear $byear"
if {$today==$bdate} {
return [lconv [expr $ztime - $btime]]
} elseif {$month==$bmonth} {
return "[expr [unoctal [lindex [split $today /] 1]] - [unoctal [lindex [split $bdate /] 1]]] days"
} elseif {$zyear==$byear} {
return "[expr $month - $bmonth] months"
} else {
return "[expr $zyear - $byear] years"
}
}
proc lconv {mins} {
set i 0;set n $mins;set hour 0
while {$i<$n} {
incr i
if {$i>$n} {break}
if {$mins>59} {incr mins -60;incr hour}
}
set mins [unoctal $mins]
set hour [unoctal $hour]
#1440=24
if {$mins!=0} {return "$hour hrs, $mins min"
} {return "$hour hrs"}
}
proc mconv {args} {return [expr [lindex [split $args :] 1] + ([unoctal [lindex [split $args :] 0]] * 60)]}
proc getdate {arg} {
set system [split [clock format [clock scan $date] -format "%m/%d/%Y@%H:%M"] @]
set time [lindex $system 1]
set month [lindex $date 0]
set day [lindex $date 1]
set year [lindex $date 2]
set date [join $date /]
if {$arg=="date"} {return $date}
if {$arg=="time"} {return $time}
if {$arg=="month"} {return $month}
if {$arg=="day"} {return $day}
if {$arg=="year"} {return $year}
}
proc unoctal {args} {
set args [split $args {}]
set n [llength $args]
set i 0
while {$i<$n} {
if {[string match 0 [lindex $args 0]]} {regsub -all "0 " $args "" args}
incr i;set n [llength $args]
if {$i>$n} {break}
}
return [join $args {}]
}
proc happybday {} {
set bc [open birth_certificate.egg r]
set bdate [lindex [gets $bc] 0];close $bc
set bdiff [myage]
# !B is for born (birthdate), !D is for difference (age)
set bday {
{I was born on !B. I'm only !D old}
{My birthday is !B}
{My birthday is !B}
{I'm only !D old!}
{}
}
regsub -all "!B" $bday $bdate bday
regsub -all "!D" $bday $bdiff bday
return [lindex $bday [rand [llength $bday]]]
}
proc learnit {nick host hand chan text} {
global botsnick lrntrig ltrigger otherbots req
regsub -all "\\\"" $text "'" text
# death to leet hax0rz!
# regsub -all "\\\\n|\\\\a|\\\\b|\\\\f|\\\\r|\\\\t|\\\\v" $text "" text
regsub -all "\007|\015|\022|\026|\028|\030" $text "" text
regsub -all "\\\\" $text "\\\\\\\\" text
# regsub -all "\\\[" $text "\\\\\\\[" text
# regsub -all "\\\]" $text "\\\\\\\]" text
# regsub -nocase "'s " $text " is " text
regsub -nocase " let is " $text " lets " text
regsub -nocase " isn't " $text " is not " text
set text [fixgrammar $text]
set start [low [lindex $text 0]]
set ignorewords {[botsnick] who what ok}
if {($lrntrig) && [lindex $text 0]!="[bit]$ltrigger"} {
set do_nothing 1
} elseif {![string match *$nick* $otherbots]} {
# lets not forget about stripping! wooohoooo
if {$lrntrig} {
regsub -all -nocase "[bit]$ltrigger " $text "" text
}
set original {}
set type [lsearch -exact [low $text] "is"]
if {$type!="-1"} {set type "is"} {set type "are"}
set whom [lsearch -exact $text "$type"]
set getword [getword [lrange $text 0 [expr $whom -1]]]
if {$getword!=""} {
set breaker [lsearch -exact $getword "=>"]
set keyword [lrange $getword 0 [expr $breaker - 1]]
set original [lrange $getword [expr $breaker + 1] e]
} else {
set keyword [lrange $text 0 [expr $whom -1]]
}
set response [lrange $text [expr $whom + 1] e]
if {![isinop [lindex $response 0]]} {
set ll [lindex [split [lindex $response e] {}] e]
while {$ll=="."} {
set response "[lrange $response 0 end-1] [join [lrange [split [lindex $response e] {}] 0 end-1] {}]"
set response [string trim $response]
set ll [lindex [split [lindex $response e] {}] e]
}
} {
if {![matchattr $hand $req(cn)]} {
putnotc $nick "Sorry, you don't have access to do that."
return 0
}
}
set also [lindex $text [expr $whom + 1]]
# replace a few things
regsub -all -nocase " my " $response " $nick's " response
regsub -all -nocase " i am " $response " $nick is " response
regsub -all -nocase "[botsnick] is " $response "I am " response
regsub -all -nocase " [botsnick]'s " $response " my " response
regsub -all -nocase "[botsnick], " $text "" text
if {[string match *$start* $ignorewords]} {set text [lrange $text 1 e]}
if {[string match -nocase no, $start] && ![isfrozen $keyword]} {delword $keyword}
if {$original != "" && ![isfrozen $keyword]} {
delword $keyword
set response "$original | $response"
set original {}
}
if {($original == "" && ![isfrozen $keyword]) && ([string length $keyword] >= 3 && [string length $keyword] <= 100)} {
# if {$start == "no,"} {putchan $chan "Ok $nick"}
addword $keyword $response
}
}
}
proc fixgrammar {text} {
# If you can think of any other common things that need to be converted
# PLEASE tell me!! :)
set text "@ $text @"
regsub -all -nocase " i " $text " I " text
regsub -all -nocase " i'm " $text " I'm " text
regsub -all -nocase " i'd " $text " I'd " text
regsub -all -nocase " i've " $text " I've " text
regsub -all -nocase " i'll " $text " I'll " text
regsub -all -nocase " u " $text " you " text
regsub -all -nocase " r " $text " are " text
regsub -all -nocase " ur " $text " your " text
regsub -all -nocase " yer" $text " your" text
regsub -all -nocase " fav " $text " favorite " text
regsub -all -nocase " fav. " $text " favorite " text
regsub -all -nocase " bish " $text " bitch " text
regsub -all -nocase " whut " $text " what " text
regsub -all -nocase " werd " $text " word " text
regsub -all -nocase " werk " $text " work " text
regsub -all -nocase " prolly " $text " probably " text
regsub -all -nocase " better then " $text " better than " text
return [string trim [lrange $text 1 [expr [llength $text] - 2]]]
}
proc askquestion {nick host hand chan text} {
global botnick botsnick wordfile floodcount workingchans eggfu
global asktrig atrigger randmy randmn otherbots range
set botsnick [low $botnick]
set lownick [low $nick]
if {($asktrig && [lindex $text 0]!="[bit]$atrigger") || [string match -nocase *$nick* $otherbots]} {
set do_nothing 1
} elseif {(([lsearch -exact [low $workingchans] [low $chan]] != -1) || ($workingchans == "")) && [string length $text] != 1} {
# dont forget to snip the !cmd
if {$asktrig == 1 && [lindex $text 0] == $atrigger} {regsub -all "$atrigger " $text "" text}
regsub -all "\\\"" $text "'" text
regsub -all "\\\!" $text "" text
regsub -all "\\\?" $text "" text
set ll [lindex [split [lindex $text e] {}] e]
while {$ll=="."} {
set text "[lrange $text 0 end-1] [join [lrange [split [lindex $text e] {}] 0 end-1] {}]"
set text [string trim $text]
set ll [lindex [split [lindex $text e] {}] e]
}
set text [string trim $text]
set q(start) [lindex $text 0]
set q(end) [lrange $text [expr [llength $text] - $range] e]
set q(long) $text
#if {$getquestion == "me?"} {set q(end) $nick}
#regsub -all "me?" $q(end) "$nick" q(end)
regsub -all "\007|\015|\022|\026|\028|\030" $q(start) "" q(start)
set getword [getword $q(end)]
set breaker [lsearch -exact $getword "=>"]
set keyword [lrange $getword 0 [expr $breaker - 1]]
if {[isfrozen $keyword]} {incr breaker}
set q(ans) [lrange $getword [expr $breaker + 1] e]
if {[isfrozen $q(ans)]} {set q(ans) [lrange $q(ans) 2 e]}
if {$q(long)=="egg-fu"} {set q(ans) "<action> is running \002egg-fu $eggfu\002, by ch3mical"}
#if {$q(ans)=="" && $q(end)!=$q(long)} {set q(ans) $q(end)}
set q(ans) [randomize $q(ans) $nick $chan]
regsub -all "\\\$question" $q(ans) "$text" q(ans)
regsub -all "\\\$keyword" $q(ans) "$q(long)" q(ans)
regsub -all "\\{" $keyword "" keyword
regsub -all "\\}" $keyword "" keyword
regsub -all "\\{" $q(ans) "" q(ans)
regsub -all "\\}" $q(ans) "" q(ans)
set sendto $chan
if {$q(start) == "tell"} {
set whom [lsearch -exact $text "tell"]
set target [lindex $text [expr $whom + 1]]
if {$target!=""} {
set sendto $target
regsub -all "\\\$who" $q(ans) $target q(ans)
}
} {regsub -all "\\\$who" $q(ans) $nick q(ans)}
if {$q(ans)!="" && $q(ans)!="~"} {
set getstart [lindex $q(ans) 0]
set getrest [lrange $q(ans) 1 e]
if {$getstart == "<reply>"} {
putserv "PRIVMSG $sendto :$getrest"
if {$sendto!=$nick && $sendto!=$chan} {putnotc $nick "Told $sendto \"$getrest\""}
} elseif {$getstart == "<ctcp>"} {putserv "PRIVMSG $nick :\001$getrest\001"
} elseif {$getstart == "<notice>"} {putnotc $sendto "$getrest"
} elseif {$getstart == "<action>"} {putserv "PRIVMSG $sendto :\001ACTION $getrest\001"
} {
regsub -all "!Q" [randy] $keyword randmy
regsub -all "!A" $randmy $q(ans) randmy
regsub -all "!U" $randmy $nick randmy
putserv "PRIVMSG $sendto :$randmy"
}
} elseif {[string match -nocase [botsnick]* $q(start)] && $q(end) != ""} {
if {[lindex $q(end) 0]==$q(start)} {set q(end) [lrange $q(end) 1 e]}
regsub -all "\\?" $q(end) "" q(end)
regsub -all "!Q" [randn] $q(end) randmn
regsub -all "!A" $randmn $q(ans) randmn
regsub -all "!U" $randmn $nick randmn
putserv "PRIVMSG $sendto :$randmn"
}
}
return 0
}
if {![file exists birth_certificate.egg]} {
set coin [rand 10]
if {$coin>=5} {set sex boy} {set sex girl}
putlog "\002IT'S A [string toupper $sex]!!\002"
putlog "\002Congratulations!\002 You are now the proud parent of an \002egg-fu\002 bot!"
set bdate [clock format [clock seconds] -format "%m/%d/%Y@%H:%M"]
putlog "I was born on \002$bdate\002"
set bc [open birth_certificate.egg w]
puts $bc $bdate
puts $bc $sex;close $bc
if {![file exists $wordfile]} {
putlog "Creating Brain...";set wf [open $wordfile w]
} {set wf [open $wordfile a+]}
puts $wf "born => <reply> \$birthday"
puts $wf "birthday => <reply> \$birthday"
puts $wf "how old are you => <reply> I'm \$age old | <action> is \$age old"
puts $wf "boy or girl => <reply> I'm a \$sex! | <action> is a \$sex"
puts $wf "asl => <reply> \$age/\$sex/earth!"
puts $wf "how => ~"
puts $wf "who => ~"
puts $wf "why => ~"
puts $wf "what => ~"
puts $wf "when => ~"
puts $wf "where => ~"
puts $wf "wtf => ~"
close $wf
}
set bc [open birth_certificate.egg r]
set sex [gets $bc];set sex [gets $bc];close $bc
putlog "\002egg\002-\002fu\002 \002$eggfu\002 loaded! (age: [myage], sex: $sex)"
|
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Oct 25, 2007 7:31 am Post subject: |
|
|
@speechles:
Nah, you did'nt mess up, seems he removed this line, rather than place it on a separate line...
| Code: | | set date [split [lindex $system 0] /] |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|
|
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
|
|