This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Learn script where and need help

Old posts that have not been replied to for several years.
Locked
J
Jailmann
Voice
Posts: 33
Joined: Fri Apr 09, 2004 2:50 pm

Learn script where and need help

Post by Jailmann »

Hallo


I have this Script but i have a few change to it or somone noes where to find another one

1 need to Put in the script so user kan write navn?

2 Can it be possible to set in the script waht channel there works whit ? navn or navn? og what channel i can learn the stuff in


The script is here


putlog "Learn v1.0 by Nite"

set learnfile "/sti/$botnick.learn"
bind pub o|o !learn pub:learn
#bind msg o|o !learn msg:learn
bind pub - "?" pub:learned
#bind msg o|o "?" msg:learned
bind pub - "??" pub:learned
#bind msg o|o "??" msg:learned
bind pub o|o !forget pub:forget
#bind msg o|o !forget msg:forget

# Tcl chokes on this for unknown reasons. *sigh*
proc ctoken {str delim} {
set index [string match [$delim] $str]
set token [string range $str 0 $index]
set strvar [string range $str $index [string length $str] ]
return $token
}

# Tcl barfs on this on two. Who knows why?
proc msg:learn {nick host hand args} {
pub:learn {$nick $host $hand "" $args}
}

proc pub:learn {nick host hand chan args} {
global learnfile
set args [string trim $args "{} "]

# Seperate the first word from the rest of the line.
# Should be: set word [ctoken $args " "]

set len [string length $args]
if {$len == 0} {
putserv "PRIVMSG $chan $nick :How am I to learn that? No Way!"
return
}

set space [string first " " $args]
if {$space == -1} {
putserv "PRIVMSG $chan $nick :Hey, you did it wrong! Go to
school!"
return
}

set word [string trim [string range $args 0 $space] ]
set learn [string trim [string range $args $space $len] ]

# Add it into the *.learn file.
set file [open $learnfile a+]
puts $file "${word}::$learn"
close $file

putserv "PRIVMSG $chan $nick :$word... Okay."
}



proc pub:learned {nick host hand chan args} {
global learnfile

set found 0

set args [string trim $args "{} "]
if {[string length $args] == 0} {
putserv "NOTICE $nick :Eh? Try '? help'"
return
}

if [file readable $learnfile] {
set file [open $learnfile RDONLY]
while {1} {
if [eof $file] break
set line [gets $file]

# Get the word. Should be: set word [ctoken $line ":"]
set len [string length $line]
set colon [string first ":" $line]
set word [string range $line 0 [expr $colon -1] ]
set line [string range $line [expr $colon +1] $len]

# Get the flags. Should be: set flags [ctoken $line ":"]
set len [string length $line]
set colon [string first ":" $line]
set flags [string range $line 0 [expr $colon -1] ]
set line [string range $line [expr $colon +1] $len]

if {[string compare $args $word] == 0} {
putserv "PRIVMSG $chan :$word == $line"
incr found
}
}
close $file
} else {
putserv "NOTICE $nick :But I don't know anything!"
return
}
if {$found == 0} {
putserv "NOTICE $nick :$args? What are you jabbering about?"
}

}



# copyfile doesn't work. frename doesn't work. I hate kludges!
proc pub:forget {nick host hand chan args} {
global learnfile
set found 0

set args [string trim $args "{} "]

if {[string length $args] == 0} {
putserv "NOTICE $nick :I don't remember what you wanted me to
forget."
return
}

# Step one: Create a new file without the $args keyword.
if [file readable $learnfile] {
set file [open $learnfile RDONLY]
set newfile [open $learnfile.tmp w]

while {1} {
if [eof $file] break
set line [gets $file]

# Get the word. Should be: set word [ctoken $line ":"]
set len [string length $line]
set colon [string first ":" $line]
set word [string range $line 0 [expr $colon -1] ]
set line [string range $line [expr $colon] $len]

if {[string compare $args $word]} {
puts $newfile "$word$line"
} else {
incr found
}
}
close $file
close $newfile
} else {
putserv "NOTICE $nick :But I don't know anything!"
return
}

if {$found == 0} {
putserv "PRIVMSG $chan $nick :But I have no idea what \"$args\" is!"
return
}

# Step two: Rewrite the $learnfile from the new file.
set file [open $learnfile w]
set newfile [open $learnfile.tmp r]
while { 1 } {
if [eof $newfile] break
puts $file [gets $newfile]
}
close $file
close $newfile
putserv "PRIVMSG $chan $nick :Oh no! I just forgot what \"$args\" was!"
}
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

what are u talking about ? could you plz give an example of what you want

and what is navn ?
XplaiN but think of me as stupid
J
Jailmann
Voice
Posts: 33
Joined: Fri Apr 09, 2004 2:50 pm

Post by Jailmann »

Hallo

Sorry hehe i write somthing in danish


The script works like this

i can !learn Ofloo is the best

then i write ? Ofloo

then the bot answer Ofloo is the best

But can there be add so peaplo can do this Ofloo? then the bot will answher to

And can there be add in the script what channel there workes whit what there these triggers now

?? Ofloo
? Ofloo
and if there can be add Ofloo?

If i have channel #test and #test1

Can there be add this in the script ? only works in #test and Ofloo? only works in #test1 so i can chose what channel the diffrent trigger works in ??
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

sounds easy hmm does it require more then one line ?? and every one can add eh ..? or do i understand wrong ..

do you wana set ur own id for the input or .. do you want it the match anything like

ofloo is the test

if u say !trigger test it shows ofloo is the test
or only when u say !trigger ofloo
XplaiN but think of me as stupid
J
Jailmann
Voice
Posts: 33
Joined: Fri Apr 09, 2004 2:50 pm

Post by Jailmann »

it is a learn script i can learn the bot anuthing like this

!learn vuf is a dog

!learn cat is a mis

then to se the answer is ?? vuf or ? vuf then the bot will answer vuf is a dog or ?? cat or ? cat then the bot will answer cat is a mis

i need thebot to use Vuf? the bot will answer the same vuf? vuf is a dog

i can learn the bot anything whit the !learn triggers there in the script to
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

hmm i don't think u can teach the bot anything i think this script was made for u to enter something then when some one asks u about something u can say !learn target format

and the bot will tell the target about format command .. or something like this not sur didn't realy look at the script yet ..

i think what you want is a chat bot try megahall or something look for it it is a chat bot thing not sur how it works never used it or don't know if it is any good but its the only one that i know that does this ...
XplaiN but think of me as stupid
J
Jailmann
Voice
Posts: 33
Joined: Fri Apr 09, 2004 2:50 pm

Post by Jailmann »

no no i dont need at chat bot

this script i need whit one change

i can learn the bot som words and when a user ask whit ? or ?? the bot will anser if the bot no the word after ?? or ? but i need to add so the user can ask the word? after

like this the bot is in a channel where there a rules then user now have to aks ? rules it will be better if the user can ask rules? and example this
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

again megahall ive seen this before on megahall u want a faq engine or something like that ..
XplaiN but think of me as stupid
Locked