Pretty much self-explanatory.
alias quote $iif(!$dialog(quote),dialog -md quote quote)
dialog quote {
title "Quote System v1.0"
size -1 -1 160 136
option dbu
box "", 1, 0 2 160 97
list 2, 1 9 158 89, size hsbar vsbar
edit "", 3, 0 100 160 10
box "", 4, 0 108 160 4
button "a&dd", 5, 85 113 25 10, flat
button "&del", 6, 110 113 25 10, flat
button "e&dit", 7, 135 113 25 10, flat
box "", 8, 0 121 160 4
button "clo&se", 9, 68 126 28 10, flat ok
}
on 1:dialog:quote:init:0: {
if ($exists($+(",$scriptdir,quotes.txt,"))) {
did -a $dname 1 Number of Quotes: $lines($+(",$scriptdir,quotes.txt,"))
}
.loadbuf -ro $dname 2 $+(",$scriptdir,quotes.txt,")
.did -z $dname 2
}
on 1:dialog:quote:sclick:2: { did -ra $dname 3 $did($dname,2).seltext }
on 1:dialog:quote:sclick:5: { if ($did($dname,3).text) { .write $+(",$scriptdir,quotes.txt,") $did($dname,3).text | .loadbuf -ro $dname 2 $+(",$scriptdir,quotes.txt,") | .did -r $dname 3 | .did -z $dname 2 } }
on 1:dialog:quote:sclick:6: { if ($did($dname,2).seltext) { .write -ds $+(",$did($dname,2).seltext,") $+(",$scriptdir,quotes.txt,") | .loadbuf -ro $dname 2 $+(",$scriptdir,quotes.txt,") | .did -r $dname 3 | .did -z $dname 2 } }
on 1:dialog:quote:sclick:7: { .write -l $+ $did($dname,2).sel $+(",$scriptdir,quotes.txt,") $did($dname,3).text | .loadbuf -ro $dname 2 $+(",$scriptdir,quotes.txt,") | .did -r $dname 3 | .did -z $dname 2 }
alias readnx {
if ($lines($+(",$scriptdir,quotes.txt,")) == 0) { echo $colour(info) * No Quotes! | halt }
else { say Random Quote: $read($+(",$scriptdir,quotes.txt,")) }
}
menu channel {
$iif($me ison $server,$style(2)) Quote System
.Config..:quote
.-
.Random Quote:readnx
}