Quote System

By MichaelA on Sep 23, 2011

Just a quote system I was working on, don't particularly feel like working on it any more, so make what you can of it people :P It works, although I must admit there's a few problems, and I could have shortened it. xD

Add a quote: /aquote
Random quote: /rquote
Quote #: /quote
Delete a quote: /dquote
Display number of quotes for the network you're on: /cquote
Find a quote: /fquote
Display all quotes(Prints onto your screen only): /allquotes

alias aquote {
  write Quote_Database_ $+ $network $+ .txt $1-
  echo -a 4,1.:[11Added Quote4]:. .:[11Quote4:9 $1- $+ 4]:.
}

alias quote {
  if ($1 <= $lines(Quote_Database_ $+ $network $+ .txt)) {
    msg $active 4,1.:[11Quote Number4:8 $1 $+ 4]:. .:[11Quote4:9 $read(Quote_Database_ $+ $network $+ .txt,$1) $+ 4]:.
  }
}
alias rquote {
  msg $active 4,1.:[11Random Quote4]:. .:[11Quote4:9 $read(Quote_Database_ $+ $network $+ .txt) $+ 4]:.
}
alias dquote {
  if ($1 <= $lines(Quote_Database_ $+ $network $+ .txt)) {
    echo -a 4,1.:[11Congratulations4:9 Quote8 $qt($read(Quote_Database_ $+ $network $+ .txt,$1)) 9was deleted successfully4]:.
    write -dl $+ $1 Quote_Database_ $+ $network $+ .txt
  }
  elseif ($1 > $lines(Quote_Database_ $+ $network $+ .txt)) {
    echo 4,1.:[11ERROR4:9 Quote8 $1 9does not exist4]:.
  }
}
alias cquote {
  msg $active 4,1.:[11Quote Information4:9 I currently have8 $lines(Quote_Database_ $+ $network $+ .txt) 9quotes in my database for8 $network $+ 4,1]:.
}
alias allquotes {
  play -a playalias Quote_Database_ $+ $network $+ .txt 0
}

alias fquote {
  var %found = $false
  noop $read(0)
  while ($read(Quote_Database_ $+ $network $+ .txt,nw,$+(*,$$1-,*),$calc($readn +1))) {
    %found = $true
    echo -a Line $readn $+ : $v1
  }
  if (!%found) echo -a No quotes were found!
}

Comments

Sign in to comment.
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.