;I haven't scripted in quite some time. So some of this might not work. I need testing, feedback, criticism, etc. Tell me if you like it, what you'd do to fix it, and the sort. Credits given to everyone who's ever posted dialog based snippets in which I've taught myself from, as well as a few good guys who've encouraged me (begged, pleaded, for their own personal gain:P) to mess around again.
;Have a quotes.txt file. It should write one automatically when adding your first quote. type /qd to activate the dialog, which should make for a little simpler use. To edit quotes, you have to do it through the txt file, reason being, if possible, I'm not sure how to write to delete individual submissions.
---Begin script---
alias qd { //dialog -m quoter quoter }
on *:LOAD: { set %qs off | echo -a JoystyK[Quoter]v1.0 is currently %qs }
menu status {
.quoter ( $+ %qs $+ ) {
if ( %qs == off ) { //set %qs on | enable #qs | halt }
elseif ( %qs == on ) { //set %qs off | disable #qs | halt }
}
}
#qs off
alias addquote { write quotes.txt $1- }
alias randomquote { //say $read(quotes.txt) }
alias searchquote { set %qssq $?="What are you looking for?" | //say $read(quotes.txt, w, * $+ %qssq $+ *) }
alias quotecount { //echo -a there are currently $lines(quotes.txt) quotes in your quote library }
on *:TEXT:!Addquote*:#: { write quotes.txt $2- }
on *:TEXT:!Randomquote:#: { //msg $chan $read(quotes.txt) }
on *:TEXT:!searchquote*:#: { set %qssq $2- | //msg $chan $read(quotes.txt, w, * $+ %qssq $+ *) }
on *:TEXT:!Quotecount:#: { //msg $chan There are currently $lines(quote.txt) in the JoystyK[QuoteR]Database }
#qs end
dialog quoter {
title "JoystyK Quoter Script"
size -l -l 215 100
option dbu
box "Quoter Control Panel", 1, 2 1 210 190
edit "Add quote here", 2, 3 9 124 15, multi autovs
button "Add", 3, 130 9 75 15
edit "Search quotes here", 4, 3 25 124 15, multi autovs
button "Search", 5, 130 25 75 15
button "Random", 6, 65 45 75 15
button "Turn On/Off", 7, 75 70 50 15
}
on *:dialog:quoter:sclick:3: {
if ($did($dname,2) = $null) { .did -ra $dname 2 Type a quote you want to add! | halt }
elseif ($did($dname,2) != $null) { //write quotes.txt $did($dname,2),seltext) | .did -ra $dname 2 Quote added! | halt }
}
on *:dialog:quoter:sclick:5: {
if ($did($dname,5) = $null) { .did -ra $dname 5 You need to enter a keyword first! | halt }
elseif ($did($dname,5) != $null) { set %qssq $did($dname,4),seltext) | //msg $chan -a $read(quotes.txt, w, * $+ %qssq $+ *) | halt }
}
on *:dialog:quoter:sclick:6: { //msg $chan $read(quotes.txt) }
on *:dialog:quoter:sclick:7: {
if ( %qs == off ) { //set %qs on | enable #qs | halt }
elseif ( %qs == on ) { //set %qs off | disable #qs | halt }
}
---End Script---