Basic quote script

By monster18 on Jun 14, 2012

My first quote script using a .txt file.

;;Script made by monster18/Adam_C.;;

on *:TEXT:!learn*:#: {
  /write Quotes.txt $2- Quote added by $nick
  describe $chan You have quoted $2- $+.
}

on *:TEXT:!say*:#: {
  if ( $read(Quotes.txt, $2 ) == $null ) {
    describe $Chan $+ $nick that quote does not exist. | halt
  }
  if ( $read(Quotes.txt, $2 ) != $null ) {
    describe $chan Quote $2 $+ : $read(Quotes.txt, $2 ) | halt
  } 
}

on *:TEXT:!randquote*:#: {
  describe $chan Random Quote: $+ $read(Quotes.txt)
}

on *:TEXT:!quotes*:#: {
  describe $chan I have a total of $lines(Quotes.txt) quotes.
}

on *:TEXT:!clearlist*:#: {
  if ($nick($chan,$nick,@&~)) {
    set %quotes 0
    /remove -b Quotes.txt
    msg $chan The Quotes list has been cleared.
  }
  else {
    msg $nick Sorry $nick but you cannot use this command.
  }
}

on *:TEXT:!delquote*:#: {
  if ($nick($chan,$nick,@&~)) {
    /write -dl [ $+ [ $2 ] ] Quotes.txt
    msg $chan Quote $2 has been deleted. 
    /dec %quotes 1
  }
  else { 
    msg $nick You cannot delete quotes.
  }
}

on *:TEXT:!search*:#: {
  if ($2-) {
    var %x = 1, %number = $null
    describe $chan Searching through quotes for: $2-
    while ($read(quotes.txt, %x)) {
      if ($2- isin $read(quotes.txt, %x)) {
        var %number = $addtok(%number,%x,32)
        inc %x
      }
      else { inc %x }
    }
    if (%number) describe $chan Found quotes matching $2- $+ : Quote number: $regsubex($replace(%number,$chr(32),$+($chr(44),$chr(32))),/(\054)( \S+)$/,$replace(\1,$chr(44),$+($chr(32),and))\2) 
    else describe $chan No quotes found matching $2-   
  }

Comments

Sign in to comment.
Stewie1k94   -  Jun 14, 2012

.

 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.