alias -l CreateHelp {
hmake Help 100
if ($isfile(Help.hsh)) { hload Help Help.hsh }
}
on *:start: {
CreateHelp
}
on *:text:*:#: {
if ($1 != !learn && $1 != !replace && $1 != !append && $1 != !delete && $1 != !whoset && $1 != !listall && $1 != !last && $1 != $chr(63)) { return }
if ($hget(Help) == $null) { CreateHelp }
if ($1 == !listall) {
var %list.cnt = 1
var %line.cnt = 1
while (%list.cnt <= $hget(Help,0).item) {
if ($len(%list [ $+ [ %line.cnt ] ]) > 300) { inc %line.cnt }
var %list. $+ %line.cnt %list. [ $+ [ %line.cnt ] ] $+ , $+ $hget(Help, [ %list.cnt ] ).item
inc %list.cnt
}
var %list.cnt = 1
while (%list.cnt <= %line.cnt) {
[color:red]write list.tmp [/color]$right(%list. [ $+ [ %line.cnt ] ],-1)
inc %list.cnt
}
[color:green]play $chan list.tmp 1500
.remove list.tmp[/color]
return
}
if (!$2) { msg $chan Please include a keyword with the command | return }
if ($1 == !learn) {
if ($hget(Help,$2)) { msg $chan That keyword is already used. Please choose another, or use !replace or !append. | return }
msg $chan Learned $3-
hadd Help $2 $nick $3-
}
elseif ($1 == $chr(63)) {
var %data = $gettok($hget(Help,$2),2-,32)
if (%data == $null) { msg $chan No help available on that item. }
else {
msg $chan %data
}
}
elseif ($1 == !replace) {
if ($hget(Help,$2)) {
msg $chan Replaced $gettok($hget(Help,$2),2-,32) with $2-
hadd Help $2 $nick $3-
}
else msg $chan No such keyword ( $+ $2 $+ ).
}
elseif ($1 == !append) {
if ($hget(Help,$2)) {
msg $chan Appended $3- to $hget(Help,$2)
hadd Help $2 $nick $gettok($hget(Help,$2),2-,32) $3-
}
else msg $chan No such keyword ( $+ $2 $+ ).
}
elseif ($1 == !delete) {
if ($hget(Help,$2)) {
msg $chan Deleted $2 -- $gettok($hget(Help,$2),2-,32)
hdel Help $2
}
else msg $chan No such keyword ( $+ $2 $+ ).
}
elseif ($1 == !whoset) {
if ($hget(Help,$2)) {
msg $chan $gettok($hget(Help,$2),1,32) was the last person to update $2 $+ .
}
else msg $chan No such keyword ( $+ $2 $+ ).
}
hsave Help Help.hsh
}