read inside the script itself :)
update to RC 2!
; ---------------------------------------------------------------------------------------------------------------
; General Info
; ---------------------------------------------------------------------------------------------------------------
;
; Addon Name: Trigger Script
; Created by: Patrick Rennings (Vox)
; Copyright: Memory Services
; Version: RC 2
;
; ---------------------------------------------------------------------------------------------------------------
; Contact Info
; ---------------------------------------------------------------------------------------------------------------
;
; Contact info:
; irc: www.ogamenet.net - #AllNiteCafe // #vox (port 6667)
; /server -m www.ogamenet.net -j #AllNiteCafe
; email: vox@noxxie.nl
;
; ---------------------------------------------------------------------------------------------------------------
; Script info
; ---------------------------------------------------------------------------------------------------------------
;
; This scripts take cares of any trigger you added. If you want that the bot reacts on the text "!vox" and that
; the output will be "Is the creator of the bot." You just add it with the add trigger command. (See the next
; section for triggers info.) And the bot will trigger the text then when "!vox" is typed.
;
; Note: Any other command added within the same file will not be triggerd because of the usage "ON *:TEXT:*:#: {"
; this says that any text specified in the channel will activate the script.
;
; Note: Bug foud? Please report them, doenst matter how you report them (see Contact info how to contact) but
; report them so it canbe fixxed in the next version.
;
; ---------------------------------------------------------------------------------------------------------------
; Availible Commands
; ---------------------------------------------------------------------------------------------------------------
;
; !add <trigger> <text> :: This will add an trigger to the bot.
; !del <trigger> :: Allows you to remove a trigger that was set with the "add" command.
; !list [-ls] :: Allows you to view the triggers that are setted.
;
; if the -l is specified The whole list will be showen with the text that will be showen with the trigger. When
; the -s trigger is specified you can search trough the triggers. An parameter must be set. (!list -s [text])
;
; NOTE: All these commands command character the (!) can ben changed within this script (The alias section and
; then the alias "cmdchar". Here you can set everything you want (an 1 character cmdchar is recommand)
;
; :: Extra ::
; You can still keep this script only but put it "offline" in the alias section you will see an alias with the
; name "addon.status" when this setted to "off" the script will be "offline". When turned "on" the script can be
; used.
;
; ---------------------------------------------------------------------------------------------------------------
; Extra Parameters
; ---------------------------------------------------------------------------------------------------------------
;
; With the !add trigger script. You can use some extra parameters to be shown when the trigger will activate.
; These are:
;
; <b> = Will show the text next in bold (An second <b> will remove the bold)
; <u> = Will show the text next with an underlinde (An second <u> will remove the underline)
; <nick> = This parameter will be replaced with the nick that activated the script.
; <host> = An parameter to replace this text with the hostmask of the users that is been specified.
; <chan> = This paramater will show the channel where the trigger is activated.
;
; ---------------------------------------------------------------------------------------------------------------
; Aliases
; ---------------------------------------------------------------------------------------------------------------
alias aversion { return RC 2 }
alias cmdchar { return ! }
alias trig.storage {
if (!$isdir(Storage)) {
mkdir Storage
}
return Storage\trigger.hsh
}
alias addon.status { return on }
; ---------------------------------------------------------------------------------------------------------------
; on :XXX: events
; ---------------------------------------------------------------------------------------------------------------
on *:LOAD: {
set %emailaddy $?="Wich email should they contact in case of script failure?"
if (!$exists($trig.storage)) {
if (!$hget(trigger.addon)) {
hmake trigger.addon 1000
}
hload trigger.addon $trig.storage
}
else {
hfree trigger.addon
hmake trigger.addon 1000
if (!$isfile($$mircdirStorage\trigger.hsh) { hsave trigger.addon $trig.storage }
hload trigger.addon $trig.storage
}
}
on *:START: {
if (!$exists($trig.storage)) {
if (!$hget(trigger.addon)) {
hmake trigger.addon 1000
}
hload trigger.addon $trig.storage
}
else {
hfree trigger.chan
if (!$isfile($$mircdirStorage\trigger.hsh) { hsave trigger.addon $trig.storage }
hmake trigger.addon 1000
hload trigger.addon $trig.storage
}
}
on *:UNLOAD: {
if ($exists($trig.storage)) {
var %remove $input(Do you want to remove the storage file?,yn)
if (%remove == %true) { .remove -b $trig.storage }
if ($hget(trigger.addon)) {
hfree trigger.addon
var %unload $input(Script has been unloaded.,o)
}
}
}
; ---------------------------------------------------------------------------------------------------------------
; The Trigger script
; ---------------------------------------------------------------------------------------------------------------
on *:TEXT:*:#: {
if ($addon.status != on) && ($addon.status != off) { .msg $chan invalid configurations. | halt }
elseif ($addon.status == off) { halt }
elseif ($hget(trigger.addon, $remove($1, $chr(33))) != $null) {
if ($left($1,1) == $cmdchar) {
.msg $chan ( $+ $remove($1, $chr(33)) $+ ) $replace($hget(trigger.addon, $remove($1, $chr(33))), <nick>, $nick, <chan>, $chan, <host>, $address($nick,2), <b>, , <u>, )
halt
}
}
elseif ($1 == $cmdchar $+ add) {
if ($nick !isop $chan) { .notice $nick not enough access. | halt }
elseif (!$3) { .notice $nick More parameters needed. | halt }
elseif ($2 == $cmdchar $+ add) || ($2 == $cmdchar $+ del) || ($2 == $cmdchar $+ list) { .notice $nick Primary triggers cant be setted. | halt }
elseif ($2 == $cmdchar $+ credits) { .notice $nick Primary triggers cant be setted. | halt }
elseif ($hget(trigger.addon, $2) != $null) { .notice $nick Trigger already taken. | halt }
hadd -m trigger.addon $2 $3-
hsave trigger.addon $trig.storage
.msg $chan A new Trigger was added by $nick (Trigger: $2 $+ , Text: $3-)
}
elseif ($1 == $cmdchar $+ del) {
if ($nick !isop $chan) { .notice $nick not enough access. | halt }
elseif (!$2) { .notice $nick More parameters needed. | halt }
elseif (!$hget(trigger.addon, $2)) { .notice $nick This trigger doenst exist. | halt }
hdel trigger.addon $2
hsave trigger.addon $trig.storage
.msg $chan The trigger $2 has been removed.
}
elseif ($1 == $cmdchar $+ list) {
if (!$2) {
var %total $hget(trigger.addon, 0).item, %count = 0, %lists
while (%count < %total) {
inc %count
%lists = $addtok(%lists, $hget(trigger.addon, %count).item $chr(45) , 32)
}
.notice $nick $iif(%lists == $null, No triggers found, $v1)
}
if ($2 == -l) {
var %total $hget(trigger.addon, 0).item, %count = 0, %lists
while (%count < %total) {
inc %count
.notice $nick $+ $hget(trigger.addon, %count).item $+ : $hget(trigger.addon, $hget(trigger.addon, %count).item)
}
.notice $nick $iif(%total == 0, No triggers found, End of triggerlist.)
}
if ($2 == -s) {
if (!$3) { .notice $nick more parameters needed. | halt }
var %total $hget(trigger.addon, 0).item, %count = 0, %lists
while (%count < %total) {
inc %count
if (* $+ $3 $+ * iswm $hget(trigger.addon, %count).item) {
.notice $nick $+ $hget(trigger.addon, %count).item $+ : $hget(trigger.addon, $hget(trigger.addon, %count).item)
}
}
.notice $nick $iif(%total == 0, No triggers found, End of triggerlist.)
}
}
if ($1 == $cmdchar $+ credits) { .msg $chan 0,1-=[Trigger Addon :: Version: $aversion © by Patrick Rennings (Vox) :: www.ogamenet.net / #allnitecafe $&
For any errors please report them to: %emailaddy $+ ]=- }
else { $null }
}
I have been using the code. although... Everytime I quit my mIRC and my Bot's mIRC it doesn't save the Trigger's in the .hsh file. i have to save them to a seperate .txt file and then load them back into the .hsh file. Although to me it's micely presented. 8/10
Edited Comment,
I have had a look through the snippet. and notice'd there's no on *:EXIT: part to save it
you'll need to add
on *:EXIT:hsave trigger.addon $trig.storage
somewhere within your script.
i think lol