Quote Bot

By M[n]M on Sep 05, 2007

when u have a quote bot and u lazy to access to ur bot and set ramdom play quote, this is a simple snippet that let's u on ur ramdom play quote with out accessing ur bot.
Note: this tigger can only be on by same ip as bot, becouse some ppl may off it using !quote

on 1:TEXT:*:#:{ 
  if ($1 == !Quotes) { 
    if ($2 == start) { 
      set %addressnick $remove($address($nick,2),*!*@) 
      set %addressme $remove($address($me,2),*!*@) 
      if (%addressnick = %addressme) { 
        if (%quotesystemstatus == off) { 
          /set %quotesystemstatus on 
          /set %totalquotes $lines(C:\quotes.txt) 
   /set %quoteline $rand(0,%totalquotes) 
          .timerquote 0 300 msg # (# $+ %quoteline $+ ) $!read(C:\quotes.txt, %quoteline) 

        } 
        else { 
          .notice $nick Sorry Owner. You already start the Quote System! if you wan to stop pls type !Quotes Stop. 
        }      
      } 
      else { 
        .notice Sorry You are not my owner. 
      } 
    } 
    elseif ($2 == add) { 
      set %addressnick $remove($address($nick,2),*!*@) 
      set %addressme $remove($address($me,2),*!*@) 
      if (%addressnick = %addressme) { 
        /write C:\quotes.txt $3- 
      } 
      else { 
        .notice Sorry You are not my owner. 
      } 
    } 
    elseif ($2 == stop) { 
      set %addressnick $remove($address($nick,2),*!*@) 
      set %addressme $remove($address($me,2),*!*@) 
      if (%addressnick = %addressme) { 
        /set %quotesystemstatus off 
        .timerquote off 
      } 
      else { 
        .notice Sorry You are not my owner. 
      } 
    } 

  } 
} 

Comments

Sign in to comment.
Jethro   -  Oct 25, 2010

DragonFlare, > if ($1 == AddQuote) { if (%Quotes == On) {You should use the handy && operator:

if ($1 == AddQuote) && (%Quotes == On) {
           ...
         }
         elseif (...) && (...) {
          ...
        }

Why put another if statement within the else condition and halt it? (In fact, you don't need the else condition at all) You don't want your code to appear redundant. Same for the rest.

If possible, don't make the use of pipe a habit, as well as the the /halt where it's not necessary.

Edit: I see what you tried to achieve. But this will look a lot better nevertheless:

on *:text:*:#:{
  tokenize 32 $strip($1-)
  if ($1 == quotes) && ($2 == on) { 
    set %Quotes On 
    msg Random Quotes Activated. 
  }
  elseif ($1 == quotes) && ($2 == off) {
    msg $chan Random Quotes Are Off. 
  }
}

If you know regex, it can be shortened a bit further:

on $*:text:/^quotes\so(n|ff)$/iS:#:{
  if ($regml(1) == n) {
    set %quotes On 
    msg # Random Quotes Activated. 
  }
  else { 
    set %quotes off
    msg # Random Quotes Are Off.
  }
}
 Respond  
DragonFlare   -  Oct 24, 2010

Why when you could just set it as a variable like and have it triggered the way you're doing it is pointless here

On *:Text:*:#:{
  var %Quote write QuoteDatabase.txt $2-
  var %Read $read(QuoteDatabase.txt)
  tokenize 32 $Strip($1-)
  if ($1 == Quotes) { if ($2 == On) { set %Quotes On | msg Random Quotes Activated. }
    else { if ($2 == Off) { set %Quotes Off | msg $chan Random Quotes Are Off. }
    }
  }
  if ($1 == AddQuote) { if (%Quotes == On) { %Quote | msg $chan $2- Added. }
    else { if (%Quotes == Off) { Halt }
    }
  }
  if ($1 == Quote) { if (%Quotes == On) { msg chan %Read }
    else { if (%Quotes == Off) { Halt }
    }
  }
}

Simple Bot Code Without the Hassle.
And don't use /'s in scripts they look better without them

 Respond  
Cazz   -  Sep 22, 2007

this is a confusing script and i cant figure out how to work it but just saying, it does not have to be so complicated. instead you could make it:

on *:TEXT:*:#:{
  if ($1 == !quotes) { 
play # quotes.txt
}
 Respond  
Marshtomp   -  Sep 07, 2007

God damnit, stop posting a lot of small scripts :\
anyways, don\'t bother to test, Sorry isn\'t a nick on my server :\

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.