Joke Bank

By ^Neptune on Mar 11, 2009

Haven't scripted in a long time, so here goes...

Image

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!
  }
}

Comments

Sign in to comment.
Jonesy44   -  Sep 06, 2009

Awesome dialog dude, real tidy :)

 Respond  
Ghost-writer   -  Sep 06, 2009

nice neptune :P. Get more jokes and join my channel with it >:3.

 Respond  
TheboyskinG   -  Sep 06, 2009

This snippet and !commands same with to a random msg,why not %read(name.txt) is very simple :P upZz...i give you point 90 bro :)

sorry,my english so bad :(

 Respond  
Heyyous   -  Apr 01, 2009

sweet script and i do like the idea of having random jokes every x minutes.
only thing i could think of is make it read jokes off of websites the the !quote script.

 Respond  
GreyFox   -  Mar 16, 2009

it looks nice... but it need more features....
Need it or not is good :) 7/10

 Respond  
PATX   -  Mar 14, 2009

kewl!rate it a 5

 Respond  
slacker   -  Mar 11, 2009

dialog is abit big for what you are having it do.

 Respond  
Kirby   -  Mar 11, 2009

Very nice Neptune. :d
Although, I don't have any suggestions for it, although > Maybe have a auto joke system like every x number of minutes it well say a joke then followed by the answer., sounds good to me. Like an /amsg?

 Respond  
Blitzjager   -  Mar 11, 2009

I think it would be better to have the answer on a timer.
Maybe add a dclick to the dialog to message the joke you click.

 Respond  
Aucun50   -  Mar 11, 2009

Maybe have a auto joke system like every x number of minutes it well say a joke then followed by the answer.

 Respond  
^Neptune   -  Mar 11, 2009

Suggestions are what are really wanted here, so I hope I get some!

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.