Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dialog Quotes {
- title "Quotes"
- size -1 -1 200 200
- option dbu
- list 1, 5 5 190 150
- button "Add", 2, 10 160 40 20
- button "Del", 3, 55 160 40 20, disable
- button "Clear", 4, 100 160 40 20
- button "Message", 5, 145 160 40 20, disable
- }
- on 1:dialog:Quotes:*:*:{
- if ($devent == sclick) {
- if ($did == 1) {
- did -e $dname 3,5
- }
- if ($did == 2) {
- dialog -m Add.Quote Add.Quote
- }
- if ($did == 3) {
- write -dl $+ $did(1).sel Quotes.txt
- did -d $dname 1 $did(1).sel
- did -b $dname 3,5
- }
- if ($did == 4) {
- write -c Quotes.txt
- did -r $dname 1
- did -b $dnaem 3,5
- }
- if ($did == 5) {
- var %x 1
- var %z 0
- while ($read(Quotes.txt,%x)) {
- inc %z
- inc %x
- }
- msg $active 14S07elected 14Q07uote14(07 $+ $did(1).sel $+ 14/07 $+ %z $+ 14)00: $did(1).seltext
- }
- }
- if ($devent == init) {
- var %x 1
- while ($read(Quotes.txt,%x)) {
- did -a $dname 1 $read(Quotes.txt,%x)
- inc %x
- }
- }
- }
- dialog Add.Quote {
- title "Add Quote"
- size -1 -1 200 40
- option dbu
- edit "", 1, 5 5 190 10, autohs
- button "Ok", 2, 70 20 20 10
- button "Cancel", 3, 90 20 20 10
- }
- on 1:dialog:Add.Quote:*:*:{
- if ($devent == sclick) {
- if ($did == 2) {
- write Quotes.txt $did(1)
- if ($dname == Add.Quote) {
- did -a Quotes 1 $did(1)
- dialog -x $dname $dname
- }
- }
- if ($did == 3) {
- dialog -x $dname $dname
- }
- }
- }
- alias quotes { dialog -m Quotes Quotes }
- alias quote {
- if (!$1) {
- if ($lines(Quotes.txt) == 0) { echo -a 1No quotes. | halt }
- else { var %x $r(1,$lines(Quotes.txt)) | msg $active 1R07andom 1Q06uote1(06# $+ %x $+ 1)00: $read(Quotes.txt,%x) }
- }
- else {
- if ($1 == pass) { noop $1- }
- if ($1 == clear) { echo -a 1Clearing quotes... | write -c Quotes.txt | .timer 1 2 echo -a 1Clear all quotes. | halt }
- if ($1 == total) { echo -a 1Total number of quotes:06 $lines(Quotes.txt) | halt }
- if ($1 == search) {
- if ($2) {
- var %x 1
- var %number $null
- echo -a 1Searching through quote database for06 $2 $+ 1...
- 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) { .timer 1 2 echo -a 14Found quotes matching06 $2 $+ 1:06 %number }
- else { .timer 1 2 echo -a 1No quotes found matching06 $2 $+ 1. }
- }
- halt
- }
- if ($1 == last) { msg $active 1L06ast 1Q06uote1(06# $+ $lines(Quotes.txt) $+ 1)00: $read(Quotes.txt,$lines(Quotes.txt)) | halt }
- if ($read(Quotes.txt,$1)) { msg $active 1S06elected 1Q06uote1(06 $+ $1 $+ 1/06 $+ $lines(Quotes.txt) $+ 1)00: $read(Quotes.txt,$1) }
- else { echo -a 14No quote on that line. }
- }
- }
- alias addquote {
- write Quotes.txt $1-
- echo -a 1Added quote06 $1- 1to the database at line number06 $lines(Quotes.txt) $+ 1.
- }
- menu * {
- Quotes System:quotes
- }
Add Comment
Please, Sign In to add comment