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.

Help script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
F
Football
Master
Posts: 205
Joined: Fri Dec 26, 2008 3:08 pm
Location: Quakenet, #Football

Help script

Post by Football »

Couldn't find in the archieve here a script that when you type !Help it plays a help file which you can configure..
s
starpossen
Op
Posts: 139
Joined: Tue Jan 10, 2006 1:08 am

Post by starpossen »

Something like:

Code: Select all

bind pub - !help pub:help
 
proc pub:help {nick uhost hand chan arg} {
set chan [string tolower $chan]
  
  putserv "NOTICE $nick :Hello this is a help text"
 }
This will notic the one typing, instead of posting in the chanel.

Very simple, but i'm sure someone can make a better one
as i'm no pro at .tcl scripting.

*EDIT gah, didn't see you wanted it to read from a file
which mine doesn't.
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Post by Nimos »

Code: Select all

###
# Help script
###
#
###
# Config
###
#
##
# Helpfile:
set helpfile(file) "omfg_its_a_helpfile.txt"
##
#
##
# Output Target (private=0 channel=1)
set helpfile(target) 0
##
#
##
# Output Method (either "PRIVMSG" or "NOTICE")
set helpfile(method) "NOTICE"
##
#
###
# End of Config
###

bind pub !help pub:help

proc pub:help {nick host hand chan text} {
global helpfile

set fp [open $helpfile(file) r]
set data [split [read -nonewline $fp] "\n"]
close $fp

if {$helpfile(target) == 1} {
set target $chan
} else {
set target $nick
} 

foreach line $data {
puthelp "$helpfile(method) $target :$line"
}
}

putlog "Helpfile Reader loaded with file $my_helpfile"
I wrote it in the forums textbox, so its not well formatted, but it should work.

The bot will output every line of the file in its own message, example:

Helpfile:
"Commands:
!help - Shows this text
!kickall - Kicks all users"

Channel:
<User> !help
<Bot> Commands:
<Bot> !help - Shows this text
<Bot> !kickall - Kicks all users
Post Reply