This script relies on a ops hash table to verify if someone is a channel moderator or not.
Example usage
set trigger popcorn Pull up a chair and grab some popcorn
Remove trigger popcorn
To call the trigger you use !popcorn
The Trigger supports 4 responses for one !command you do that by setting trigger..4
set trigger popcorn This is line 1
set trigger popcorn2 This is line 2
set trigger popcorn3 This is line 3
set trigger popcorn4 This is line 4
!popcorn would then show "This is Line 1" etc
;===========================================================
; Dynamic triggers - newtriggers.mrc
;===========================================================
; Author : Bill Larson (blarson@compu.net)
; Revision: 1.0
; FileName: newtriggers.mrc
;===========================================================
on 1:TEXT:set trigger*:#:{
if !$hget(ops,$nick) { /halt }
if !$3 || !$4 {
/notice $nick Format: set trigger <triggername> <info>
/halt
}
/hadd triggers $$3 $4-
/msg $chan trigger for $3 set to
/msg $chan $4-
/hsave -o triggers triggers.hsh
/halt
}
on 1:TEXT:remove trigger*:#:{
if !$hget(ops,$nick) { /halt }
if $3 {
if !$hget(triggers, $3) {
/msg $chan no trigger info is set for $3 sorry.
/msg $chan Try using set trigger first.
/halt
} else {
/hdel triggers $$3
/msg $chan Trigger info was removed for $3
/hsave -o triggers triggers.hsh
/halt
}
} else {
/msg $chan Format: remove trigger Triggername
}
}
on 1:TEXT:!*:#:{
/var %command $remove($1,!)
if $hget(triggers, %command) {
/msg $chan $hget(triggers, %command)
}
if $hget(triggers, %command $+ 2) {
/msg $chan $hget(triggers, %command $+ 2)
}
if $hget(triggers, %command $+ 3) {
/msg $chan $hget(triggers, %command $+ 3)
}
if $hget(triggers, %command $+ 4) {
/msg $chan $hget(triggers, %command $+ 4)
}
/halt
}
alias dumptrigs {
/var %t 1
/var %ttotal $hget(triggers,0).item
while (%t <= %ttotal) {
/echo -s set trigger $hget(triggers,%t).item $hget(triggers,$hget(triggers,%t).item)
/inc %t
}
}
on 1:disconnect:{
/hsave -o triggers triggers.hsh
}
on 1:connect:{
/hmake triggers 100
/hload -o triggers triggers.hsh
}