• Home
  • Servers
  • Chat
  • Channels
  • Commands
  • Forum
  • FAQ
  • Software
  • Quotes
Topic Options
Rate This Topic
#5649 - 08/16/09 06:46 PM What Is Trigger Adder. "HELP NEEDED!!!"
GrimReaper Offline
n00b

Registered: 10/11/08
Posts: 2
Loc: Sussex, UK
Code:
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 10
  if ($exists(whatis.hsh)) { hload whatis.addon whatis.hsh }
}
On *:Close: { 
  if ($hget(whatis.addon)) { 
    hsave -s whatis.addon whatis.hsh 
  } 
}
on *:START: {
  hmake whatis.addon 10
  if ($exists(whatis.hsh)) { hload 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 *:TEXT:*:#: {
  if ($addon.status != on) && ($addon.status != off) { .msg $chan invalid configurations. | halt }
  elseif ($addon.status == off) { halt }
  elseif ($hget(whatis.addon, $remove($1, $chr(46))) != $null) { 
    if ($left($1,1) == $cmdchar) {
      .msg $chan ( $+ $remove($1, $chr(46)) $+ ) $replace($hget(whatis.addon, $remove($1, $chr(46))), <nick>, $nick, <chan>, $chan, <host>, $address($nick,2), <b>, , <u>, )
      halt 
    }
  }
  elseif ($1 == $cmdchar $+ addwhat) { 
    if ($nick !isop $chan) { .notice $nick not enough access. | halt }
    elseif (!$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 ($nick !isop $chan) { .notice $nick not enough access. | halt }
    elseif (!$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 }
}

I can get it to add the trigger's but can't get it to do "What is <trigger>" it ends up being .<Trigger> any help? :s

Top
Sponsored Links
Sponsored Links
Member
*****

Registered: 27/08/04
Posts: 10136
Loc: Mountain View, CA
Top


Moderator:  Jeff, mandy, usrbingeek