Max's Quote Dialog

By MaxEvans on May 18, 2009

Image

This is another quote script for my collection. I made this to test using simple sockets in dialogs. And seeing as it worked fine, and pretty decent. Here it is.

It's obvious how it works. When you open the dialog, it'll show a quote, just click "Get another quote" to refresh the quote. You can send the quote to the channel, or to send it in a query to someone specific. To send a query to someone, just type their nick in the textbox and click "Send to nick".

Have fun with it. =]

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
;       Max's Quote Dialog      ;
;         By: Max Evans         ;
;       irc.geekshed.net        ;
;   #GeekUnderground & #Chris   ;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;

dialog Quote {
  title "Max's Quote Dialog"
  size -1 -1 160 136
  option dbu
  box "Quote", 1, 5 5 151 72
  text , 2, 11 15 139 56, center
  button "Get Another Quote", 3, 21 80 56 11
  button "Send Quote To Channel", 4, 51 107 67 11
  edit "", 5, 21 93 56 11, autohs
  button "Send Quote To Nick", 6, 78 93 67 11
  button "Close Dialog", 7, 65 122 36 11, ok cancel
  button "Copy Quote To Clipboard", 8, 78 80 67 11
}

alias -l htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ) | return %x }

alias qdialog {
  if (!$sock(quotationspage)) {
    sockopen quotationspage www.quotationspage.com 80
  }
}
on *:sockopen:quotationspage: {
  sockwrite -n $sockname GET /random.php3 HTTP/2.0
  sockwrite -n $sockname Host: www.quotationspage.com
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
}
on *:sockread:quotationspage: {
  sockread %quotationspage
  if (<dt class="quote"> isin %quotationspage) {
    set %quote %quotationspage
  }
}
on *:sockclose:quotationspage: {
  set %author $htmlfree($gettok(%quote,19-,62))
  did -a Quote 2 $qt($remove($htmlfree(%quote),%author)) - %author
}

on *:Dialog:Quote:init:*: {
  qdialog
}

on *:Dialog:Quote:sclick:*: {
  if ($did == 3) { qdialog | unset %quot* %author }
  if ($did == 4) { msg $active $did(Quote,2).text }
  if ($did == 6) { msg $did(Quote,5) $did(Quote,2).text }
  if ($did == 8) { clipboard $did(Quote,2) }
}

Menu * {
  .Max's Quote Dialog: { dialog -m Quote Quote }
}

Comments

Sign in to comment.
MaxEvans   -  May 29, 2009

Added clipboard button to copy the quote to the clipboard for sharing with friends or family (or anyone else). =]

 Respond  
MaxEvans   -  May 19, 2009

I edited the dialog and made it a bit smaller, and made the button size bigger.

 Respond  
MaxEvans   -  May 18, 2009

I'll fix the buttons. I need to re-arrange the dialog too.

 Respond  
Aucun50   -  May 18, 2009

I like it although the buttons seem a little small for the words in them, they look somewhat smushed together.

 Respond  
WorldDMT   -  May 18, 2009

hi

for "button "Close Dialog", 7, 84 95 34 9, ok cancel" put only ok or cancel like this

button Close Dialog, 7, 84 95 34 9, ok

for the alias htmlfree u can do this

alias -l htmlfree return $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,)

for dialog event u have be sur if $active is a chan and the id 5 isnt empty and u can replace $did(Quote,2).text to only $did(2) so

on *:Dialog:Quote:sclick:*:{
  if ($did == 3) { qdialog | unset %quot* %author }
  elseif (($did == 4) && ($active == #)) msg $v1 $did(2)
  elseif (($did == 6) && ($did(5))) msg $v1 $did(2)
}

attention!! dont use a "*" into menu

must be menu status,nicklist,menubar becose if u have a game coded with picwin u will get "Max's Quote Dialog" into the menu and that is not good

 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.