daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest Mar 14th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. dialog Quotes {
  3.   title "Quotes"
  4.   size -1 -1 200 200
  5.   option dbu
  6.   list 1, 5 5 190 150
  7.   button "Add", 2, 10 160 40 20
  8.   button "Del", 3, 55 160 40 20, disable
  9.   button "Clear", 4, 100 160 40 20
  10.   button "Message", 5, 145 160 40 20, disable
  11. }
  12. on 1:dialog:Quotes:*:*:{
  13.   if ($devent == sclick) {
  14.     if ($did == 1) {
  15.       did -e $dname 3,5
  16.     }
  17.     if ($did == 2) {
  18.       dialog -m Add.Quote Add.Quote
  19.     }
  20.     if ($did == 3) {
  21.       write -dl $+ $did(1).sel Quotes.txt
  22.       did -d $dname 1 $did(1).sel
  23.       did -b $dname 3,5
  24.     }
  25.     if ($did == 4) {
  26.       write -c Quotes.txt
  27.       did -r $dname 1
  28.       did -b $dnaem 3,5
  29.     }
  30.     if ($did == 5) {
  31.       var %x 1
  32.       var %z 0
  33.       while ($read(Quotes.txt,%x)) {
  34.         inc %z
  35.         inc %x
  36.       }
  37.       msg $active 14S07elected 14Q07uote14(07 $+ $did(1).sel $+ 14/07 $+ %z $+ 14)00: $did(1).seltext
  38.     }
  39.   }
  40.   if ($devent == init) {
  41.     var %x 1
  42.     while ($read(Quotes.txt,%x)) {
  43.       did -a $dname 1 $read(Quotes.txt,%x)
  44.       inc %x
  45.     }
  46.   }
  47. }
  48. dialog Add.Quote {
  49.   title "Add Quote"
  50.   size -1 -1 200 40
  51.   option dbu
  52.   edit "", 1, 5 5 190 10, autohs
  53.   button "Ok", 2, 70 20 20 10
  54.   button "Cancel", 3, 90 20 20 10
  55. }
  56. on 1:dialog:Add.Quote:*:*:{
  57.   if ($devent == sclick) {
  58.     if ($did == 2) {
  59.       write Quotes.txt $did(1)
  60.       if ($dname == Add.Quote) {
  61.         did -a Quotes 1 $did(1)
  62.         dialog -x $dname $dname
  63.       }
  64.     }
  65.     if ($did == 3) {
  66.       dialog -x $dname $dname
  67.     }
  68.   }
  69. }
  70. alias quotes { dialog -m Quotes Quotes }
  71. alias quote {
  72.   if (!$1) {
  73.     if ($lines(Quotes.txt) == 0) { echo -a 1No quotes. | halt }
  74.     else { var %x $r(1,$lines(Quotes.txt)) | msg $active 1R07andom 1Q06uote1(06# $+ %x $+ 1)00: $read(Quotes.txt,%x) }
  75.   }
  76.   else {
  77.     if ($1 == pass) { noop $1- }
  78.     if ($1 == clear) { echo -a 1Clearing quotes... | write -c Quotes.txt | .timer 1 2 echo -a 1Clear all quotes. | halt }
  79.     if ($1 == total) { echo -a 1Total number of quotes:06 $lines(Quotes.txt) | halt }
  80.     if ($1 == search) {
  81.       if ($2) {
  82.         var %x 1
  83.         var %number $null
  84.         echo -a 1Searching through quote database for06 $2 $+ 1...
  85.         while ($read(Quotes.txt,%x)) {
  86.           if ($2 isin $read(Quotes.txt,%x)) {
  87.             var %number $addtok(%number,%x,32)
  88.             inc %x
  89.           }
  90.           else { inc %x }
  91.         }
  92.         if (%number) { .timer 1 2 echo -a 14Found quotes matching06 $2 $+ 1:06 %number }
  93.         else { .timer 1 2 echo -a 1No quotes found matching06 $2 $+ 1. }
  94.       }
  95.       halt
  96.     }
  97.     if ($1 == last) { msg $active 1L06ast 1Q06uote1(06# $+ $lines(Quotes.txt) $+ 1)00: $read(Quotes.txt,$lines(Quotes.txt)) | halt }
  98.     if ($read(Quotes.txt,$1)) { msg $active 1S06elected 1Q06uote1(06 $+ $1 $+ 1/06 $+ $lines(Quotes.txt) $+ 1)00: $read(Quotes.txt,$1) }
  99.     else { echo -a 14No quote on that line. }
  100.   }
  101. }
  102. alias addquote {
  103.   write Quotes.txt $1-
  104.   echo -a 1Added quote06 $1- 1to the database at line number06 $lines(Quotes.txt) $+ 1.
  105. }
  106. menu * {
  107.   Quotes System:quotes
  108. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top