Haven't scripted in a long time, so here goes...
Well I was basically reading a joke book the other day, and thought it would be nice if you could store these jokes. So, I made this. Load into remotes and type /jokes or right-click anywhere and click "Joke Bank".
It's rather simple at the moment, but suggestions will be followed.
Additional feature: channel messaging.
!randjoke - displays a random joke to the channel (from another user)
!joke X - displays joke number X into the channel
!jokeanswer X - notices the answer of joke X to the nick
I am hoping to make the channel messaging more configurable in the future, so think of this as a template if you will.
Oh, and if you want to read my jokes so far (only 10):
What's orange and sounds like a parrot?A carrot!
What's brown and sticky?A stick!
What's the difference between a lightbulb and a pregnant woman?You can unscrew a lightbulb!
What do christmas trees and priests have in common?Their balls are just for decoration.
Why do blonde women have such big bellybuttons?They've been sleeping with too many blonde men.
What do you call a Scottish lesbian?Gaelic.
What do pubic hair and parsley have in common?You push it aside, and keep on eating!
What do you call a sheep tied to a lamp-post in Wales?A leisure center!
How did Burger King get Dairy Queen pregnant? He forgot to wrap his whopper.
Why was the washing machine laughing?Because it was taking the piss out of the pants.
What's the difference between a penis and a bonus?*Your wife will always blow your bonus.
dialog jokes {
title "Joke Bank"
size -1 -1 350 104
option dbu
list 1, 2 2 345 65, vsbar size
edit "", 2, 5 75 339 10, read autohs
box "Answer", 3, 2 67 345 21
button "Remove", 5, 273 90 37 12
button "Add", 6, 235 90 37 12
button "View file", 7, 311 90 37 12
}
menu * {
Joke Bank:jokes
}
alias jokes { dialog $iif($dialog(jokes),-v,-m) jokes jokes }
on *:DIALOG:jokes:init:0: { jokesload }
on *:DIALOG:jokes:sclick:*: {
if ($did == 6) { dialog $iif($dialog(jokeadd),-v,-m) jokeadd jokeadd }
if ($did == 5) {
if (!$did(1).sel) {
noop $input(Please select a joke to remove.,uwo,Error!)
}
else {
write -dl $+ $did(1).sel $qt(jokes.txt)
dialog -x jokes
dialog -m jokes jokes
}
}
if ($did == 7) { run $qt(jokes.txt) }
if ($did == 4) { dialog $iif($dialog(jokeoptions),-v,-m) jokeoptions jokeoptions }
if ($did == 1) { did -ra jokes 2 $gettok($read($qt(jokes.txt),$did(1).sel),2-,42) }
}
alias jokesload {
if (!$isfile($qt(jokes.txt))) { halt }
else {
window -h @jokeslist
loadbuf @jokeslist $qt(jokes.txt)
var %x = 1
while (%x <= $line(@jokeslist,0)) {
did -a jokes 1 $gettok($line(@jokeslist,%x),1,42)
inc %x
}
}
window -c @jokeslist
}
dialog jokeadd {
title "Add Joke"
size -1 -1 254 58
option dbu
edit "", 1, 5 8 245 10, autohs
box "Joke", 2, 2 0 250 21
edit "", 3, 5 30 245 10, autohs
box "Asnwer", 4, 2 22 250 21
button "Add", 5, 215 45 37 12
}
on *:DIALOG:jokeadd:sclick:5: {
if (!$did(1).text) || (!$did(3).text) {
noop $input(Please fill in both sections.,uwo,Error!)
}
else {
write -a $qt(jokes.txt) $+($did(1).text,*,$did(3).text)
dialog -x jokeadd
dialog -x jokes
dialog -m jokes jokes
}
}
on *:TEXT:!randjoke:#: {
if (!$lines($qt(jokes.txt))) { halt }
else {
var %l = $rand(1,$lines($qt(jokes.txt)))
msg $chan $gettok($read($qt(jokes.txt),%l),1,42)
msg $chan Want the answer? Type !jokeanswer %l to get it.
}
}
on *:TEXT:!jokeanswer *:#: {
if (!$lines($qt(jokes.txt))) { halt }
else {
.notice $nick $gettok($read($qt(jokes.txt),$2),2-,42)
}
}
on *:TEXT:!joke *:#: {
if ($2 !isnum) {
msg $chan Error! That is not a number!
}
elseif (!$read($qt(jokes.txt),$2)) {
msg $chan Error! There is not that many jokes in my database!
}
else {
msg $chan $gettok($read($qt(jokes.txt),$2),1,42)
msg $chan Want the answer? Type !jokeanswer $2 to get it!
}
}