This is pretty much the same code as the who is ? script. but with What is ?
Hope people like it and use this as well as the other one.
http://www.hawkee.com/snippet/6719/ <--- located here.
same sort of Trigger Syntax
.addwhat
.delwhat ? (you have to add the ? to the trigger other wise it won't delete)
.listwhat
.listwhat -l
.listwhat -s ?
alias aversion { return 1.0 }
alias cmdchar { return . }
alias addon.status { return on }
; ---------------------------------------------------------------------------------------------------------------
; on :XXX: events
; ---------------------------------------------------------------------------------------------------------------
on *:LOAD: {
set %emailaddy $?="Which email should they contact in case of script failure?"
hmake whatis.addon 10000
if ($exists(whatis.hsh)) { hload whatis.addon whatis.hsh }
}
on *:START: {
hmake whatis.addon 10000
if ($exists(whatis.hsh)) { hload whatis.addon whatis.hsh }
}
On *:Close: {
if ($hget(whatis.addon)) {
hsave -s whatis.addon whatis.hsh
}
}
on *:UNLOAD: {
if ($exists(whatis.hsh)) {
$iif($input(Do you want to remove the storage file?,yn),.remove -b whatis.hsh)
if ($hget(whatis.addon)) {
hfree whatis.addon
var %unload $input(Script has been unloaded.,o)
}
}
}
; ---------------------------------------------------------------------------------------------------------------
; The Trigger script
; ---------------------------------------------------------------------------------------------------------------
on 250:TEXT:*:#: {
if ($addon.status != on) && ($addon.status != off) { .msg $chan invalid configurations. | halt }
elseif ($addon.status == off) { halt }
elseif ($1 == What) {
if ($2 == Is) {
if ($hget(whatis.addon, $3) != $null) {
.msg $chan $replace($hget(whatis.addon, $3), <nick>, $nick, <chan>, $chan, <host>, $address($nick,2), <b>, , <u>, )
halt
}
}
}
elseif ($1 == $cmdchar $+ addwhat) {
if (!$3) { .notice $nick More parameters needed. | halt }
elseif ($2 == $cmdchar $+ addwhat) || ($2 == $cmdchar $+ delwhat) || ($2 == $cmdchar $+ Listwhat) { .notice $nick Primary triggers cant be set. | halt }
elseif ($2 == $cmdchar $+ credits) { .notice $nick Primary triggers cant be set. | halt }
elseif ($hget(whatis.addon, $2) != $null) { .notice $nick Trigger already taken. | halt }
hadd -m whatis.addon $2 $+ ? $3-
hsave whatis.addon whatis.hsh
.msg $chan A new Trigger was added by $nick (Trigger: What Is $2 $+ ?, Text: $3-)
}
elseif ($1 == $cmdchar $+ delwhat) {
if (!$2) { .notice $nick More parameters needed. | halt }
elseif (!$hget(whatis.addon, $2)) { .notice $nick This trigger doesnt exist. | halt }
hdel whatis.addon $2
hsave whatis.addon whatis.hsh
.msg $chan The trigger What Is $2 has been removed.
}
elseif ($1 == $cmdchar $+ ListWhat) {
if (!$2) {
var %totalwhat $hget(whatis.addon, 0).item, %countwhat = 0, %listswhat
while (%countwhat < %totalwhat) {
inc %countwhat
%listswhat = $addtok(%listswhat,What Is $hget(whatis.addon, %countwhat).item $chr(45) , 32)
}
.notice $nick $iif(%listswhat == $null, No triggers found, $v1)
}
if ($2 == -l) {
var %totalwhat $hget(whatis.addon, 0).item, %countwhat = 0, %listswhat
while (%countwhat < %totalwhat) {
inc %countwhat
.notice $nick What Is $hget(whatis.addon, %countwhat).item $+ : $hget(whatis.addon, $hget(whatis.addon, %countwhat).item)
}
.notice $nick $iif(%totalwhat == 0, No triggers found, End of triggerlist.)
}
if ($2 == -s) {
if (!$3) { .notice $nick more parameters needed. | halt }
var %totalwhat $hget(whatis.addon, 0).item, %countwhat = 0, %listswhat
while (%countwhat < %totalwhat) {
inc %countwhat
if (* $+ $3 $+ * iswm $hget(whatis.addon, %countwhat).item) {
.notice $nick What Is $hget(whatis.addon, %countwhat).item $+ : $hget(whatis.addon, $hget(whatis.addon, %countwhat).item)
}
}
.notice $nick $iif(%totalwhat == 0, No triggers found, End of triggerlist.)
}
}
if ($1 == $cmdchar $+ credits) { .msg $chan 0,1-=[What Is Addon :: Version: $aversion © by GrimReaper :: irc.SPUNet.org / #hell $&
For any errors please report them to: %emailaddy $+ ]=- }
else { $null }
}
Here is a bypass for its auser requirement, it also bypasses the who is's one as well. Best used with both scripts.
On :TEXT::#: {
if ($addon.status != on) && ($addon.status != off) { .msg $chan invalid configurations. | halt }
elseif ($addon.status == off) { halt }
elseif ($1 == What) {
if ($2 == Is) {
if ($hget(whatis.addon, $3) != $null) {
.msg $chan $replace($hget(whatis.addon, $3), , $nick, , $chan, , $address($nick,2), , , , )
halt
}
}
}
elseif ($addon.status != on) && ($addon.status != off) { .msg $chan invalid configurations. | halt }
elseif ($addon.status == off) { halt }
elseif ($1 == Who) {
if ($2 == Is) {
if ($hget(whois.addon, $3) != $null) {
msg $chan $replace($hget(whois.addon, $3), , $nick, , $chan, , $address($nick,2), , , , )
halt
}
}
}
}