Max's Channel Favorites Dialog

By MaxEvans on Apr 21, 2009

This originally started out as an autojoin dialog, then I decided to make it a channel favorites dialog. Because instead of the traditional on/off on autojoin, I put checkboxes beside each text box that if you want it to autojoin the channels, you can check the boxes. But as long as the checkboxes aren't checked, it won't autojoin. To use there's a menu item to get to it, and you can type /favs and it'll open the dialog.

You can store up to 20 channels in this dialog. You can join the channels from the dialog, and clear ones you don't want anymore. It's a pretty simple dialog, but took me a while to finish. I made this as part of a script I'm builing. =]

Screenshot:
Image

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
; Max's Channel Favorites Dialog ;
;          By: Max Evans         ;
;        irc.wyldryde.org        ;
;       #Max-chat & #Chris       ;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;

dialog MCFD {
  title "Max's Channel Favorites Dialog"
  size -1 -1 420 270
  option pixels
  button Okay, 100, 170 244 42 19, ok
  button Cancel, 200, 215 244 42 19, cancel
  text "Channels", 5, 63 10 54 15, center
  check "", 2, 17 32 15 15
  edit %cfchan1, 3, 37 30 95 20, autohs center
  check "", 7, 17 52 15 15
  edit %cfchan2, 8, 37 50 95 20, autohs center
  check "", 10, 17 72 15 15
  edit %cfchan3, 11, 37 70 95 20, autohs center
  check "", 13, 17 92 15 15
  edit %cfchan4, 14, 37 90 95 20, autohs center
  check "", 16, 17 112 15 15
  edit %cfchan5, 17, 37 110 95 20, autohs center
  check "", 19, 17 132 15 15
  edit %cfchan6, 20, 37 130 95 20, autohs center
  check "", 22, 17 152 15 15
  edit %cfchan7, 23, 37 150 95 20, autohs center
  check "", 25, 17 172 15 15
  edit %cfchan8, 26, 37 170 95 20, autohs center
  check "", 28, 17 192 15 15
  edit %cfchan9, 29, 37 190 95 20, autohs center
  check "", 31, 17 212 15 15
  edit %cfchan10, 32, 37 210 95 20, autohs center
  button Clear, 36, 173 32 33 16
  button Clear, 37, 173 52 33 16
  button Clear, 38, 173 72 33 16
  button Clear, 39, 173 92 33 16
  button Clear, 40, 173 112 33 16
  button Clear, 41, 173 132 33 16
  button Clear, 42, 173 152 33 16
  button Clear, 43, 173 172 33 16
  button Clear, 44, 173 192 33 16
  button Clear, 45, 173 212 33 16
  button Join, 1, 136 172 33 16
  button Join, 4, 136 192 33 16
  button Join, 6, 136 212 33 16
  button Join, 9, 136 52 33 16
  button Join, 12, 136 72 33 16
  button Join, 15, 136 92 33 16
  button Join, 18, 136 112 33 16
  button Join, 21, 136 132 33 16
  button Join, 24, 136 152 33 16
  button Join, 27, 136 32 33 16
  text "Join", 30, 141 10 22 16
  text "Clear", 33, 174 10 28 16
  check "", 35, 218 52 15 15
  check "", 46, 218 72 15 15
  check "", 47, 218 92 15 15
  check "", 48, 218 112 15 15
  check "", 49, 218 132 15 15
  check "", 50, 218 152 15 15
  check "", 51, 218 172 15 15
  check "", 52, 218 192 15 15
  button Clear, 53, 374 172 33 16
  button Clear, 54, 374 192 33 16
  button Clear, 55, 374 212 33 16
  button Clear, 56, 374 52 33 16
  button Clear, 57, 374 72 33 16
  button Clear, 58, 374 92 33 16
  button Clear, 59, 374 112 33 16
  button Clear, 60, 374 132 33 16
  text "Channels", 61, 264 10 54 15, center
  check "", 62, 218 212 15 15
  check "", 63, 218 32 15 15
  button Clear, 64, 374 152 33 16
  button Clear, 65, 374 32 33 16
  button Join, 66, 337 32 33 16
  button Join, 67, 337 52 33 16
  button Join, 68, 337 72 33 16
  button Join, 69, 337 92 33 16
  button Join, 70, 337 112 33 16
  button Join, 71, 337 132 33 16
  button Join, 72, 337 152 33 16
  button Join, 73, 337 172 33 16
  button Join, 74, 337 192 33 16
  button Join, 75, 337 212 33 16
  edit %cfchan11, 76, 238 30 95 20, autohs center
  edit %cfchan12, 77, 238 50 95 20, autohs center
  edit %cfchan13, 78, 238 70 95 20, autohs center
  edit %cfchan14, 79, 238 90 95 20, autohs center
  edit %cfchan15, 80, 238 110 95 20, autohs center
  edit %cfchan16, 81, 238 130 95 20, autohs center
  edit %cfchan20, 82, 238 210 95 20, autohs center
  edit %cfchan18, 83, 238 170 95 20, autohs center
  edit %cfchan19, 84, 238 190 95 20, autohs center
  edit %cfchan17, 85, 238 150 95 20, autohs center
  text "Join", 86, 342 10 22 16
  text "Clear", 87, 375 10 28 16
  text "Auto Join", 88, 13 3 23 26, center
  text "Auto Join", 89, 213 4 23 26, center
}

on *:dialog:MCFD:init:*: {
  if (%cfchk1 = ON) { did -c MCFD  2 }
  if (%cfchk2 = ON) { did -c MCFD 7 }
  if (%cfchk3 = ON) { did -c MCFD 10 }
  if (%cfchk4 = ON) { did -c MCFD 13 }
  if (%cfchk5 = ON) { did -c MCFD 16 }
  if (%cfchk6 = ON) { did -c MCFD 19 }
  if (%cfchk7 = ON) { did -c MCFD 22 }
  if (%cfchk8 = ON) { did -c MCFD 25 }
  if (%cfchk9 = ON) { did -c MCFD 28 }
  if (%cfchk10 = ON) { did -c MCFD 31 }
  if (%cfchk11 = ON) { did -c MCFD 63 }
  if (%cfchk12 = ON) { did -c MCFD 35 }
  if (%cfchk13 = ON) { did -c MCFD 46 }
  if (%cfchk14 = ON) { did -c MCFD 47 }
  if (%cfchk15 = ON) { did -c MCFD 48 }
  if (%cfchk16 = ON) { did -c MCFD 49 }
  if (%cfchk17 = ON) { did -c MCFD 50 }
  if (%cfchk18 = ON) { did -c MCFD 51 }
  if (%cfchk19 = ON) { did -c MCFD 52 }
  if (%cfchk20 = ON) { did -c MCFD 62 }
}
on *:dialog:MCFD:sclick:100: {
  if ($did(MCFD,2).state = 1) { %cfchk1 = on } | else { %cfchk1 = off }
  if ($did(MCFD,7).state = 1) { %cfchk2 = on } | else { %cfchk2 = off }
  if ($did(MCFD,10).state = 1) { %cfchk3 = on } | else { %cfchk3 = off }
  if ($did(MCFD,13).state = 1) { %cfchk4 = on } | else { %cfchk4 = off }
  if ($did(MCFD,16).state = 1) { %cfchk5 = on } | else { %cfchk5 = off }
  if ($did(MCFD,19).state = 1) { %cfchk6 = on } | else { %cfchk6 = off }
  if ($did(MCFD,22).state = 1) { %cfchk7 = on } | else { %cfchk7 = off }
  if ($did(MCFD,25).state = 1) { %cfchk8 = on } | else { %cfchk8 = off }
  if ($did(MCFD,28).state = 1) { %cfchk9 = on } | else { %cfchk9 = off }
  if ($did(MCFD,31).state = 1) { %cfchk10 = on } | else { %cfchk10 = off } 
  if ($did(MCFD,63).state = 1) { %cfchk11 = on } | else { %cfchk11 = off }
  if ($did(MCFD,35).state = 1) { %cfchk12 = on } | else { %cfchk12 = off }
  if ($did(MCFD,46).state = 1) { %cfchk13 = on } | else { %cfchk13 = off }
  if ($did(MCFD,47).state = 1) { %cfchk14 = on } | else { %cfchk14 = off }
  if ($did(MCFD,48).state = 1) { %cfchk15 = on } | else { %cfchk15 = off }
  if ($did(MCFD,49).state = 1) { %cfchk16 = on } | else { %cfchk16 = off }
  if ($did(MCFD,50).state = 1) { %cfchk17 = on } | else { %cfchk17 = off }
  if ($did(MCFD,51).state = 1) { %cfchk18 = on } | else { %cfchk18 = off }
  if ($did(MCFD,52).state = 1) { %cfchk19 = on } | else { %cfchk19 = off }
  if ($did(MCFD,62).state = 1) { %cfchk20 = on } | else { %cfchk20 = off } 
  %cfchan1 = $did(3) | %cfchan2 = $did(8) | %cfchan3 = $did(11) | %cfchan4 = $did(14) | %cfchan5 = $did(17) | %cfchan6 = $did(20) | %cfchan7 = $did(23) | %cfchan8 = $did(26) | %cfchan9 = $did(29) | %cfchan10 = $did(32)
  %cfchan11 = $did(76) | %cfchan12 = $did(77) | %cfchan13 = $did(78) | %cfchan14 = $did(79) | %cfchan15 = $did(80) | %cfchan16 = $did(81) | %cfchan17 = $did(85) | %cfchan18 = $did(83) | %cfchan19 = $did(84) | %cfchan20 = $did(82)
} 
on *:dialog:MCFD:sclick:*: {
  if ($did = 36) { did -ru MCFD 3,2 }
  if ($did = 37) { did -ru MCFD 7,8 }
  if ($did = 38) { did -ru MCFD 10,11 }
  if ($did = 39) { did -ru MCFD 13,14 }
  if ($did = 40) { did -ru MCFD 16,17 }
  if ($did = 41) { did -ru MCFD 19,20 }
  if ($did = 42) { did -ru MCFD 22,23 }
  if ($did = 43) { did -ru MCFD 25,26 }
  if ($did = 44) { did -ru MCFD 28,29 }
  if ($did = 45) { did -ru MCFD 31,32 }
  if ($did = 65) { did -ru MCFD 76,63 }
  if ($did = 56) { did -ru MCFD 77,35 }
  if ($did = 57) { did -ru MCFD 78,46 }
  if ($did = 58) { did -ru MCFD 79,47 }
  if ($did = 59) { did -ru MCFD 80,48 }
  if ($did = 60) { did -ru MCFD 81,49 }
  if ($did = 64) { did -ru MCFD 85,50 }
  if ($did = 53) { did -ru MCFD 83,51 }
  if ($did = 54) { did -ru MCFD 84,52 }
  if ($did = 55) { did -ru MCFD 82,62 }
  if ($did = 27) { join $did(MCFD,3) }
  if ($did = 9) { join $did(MCFD,8) }
  if ($did = 12) { join $did(MCFD,11) }
  if ($did = 15) { join $did(MCFD,14) }
  if ($did = 18) { join $did(MCFD,17) }
  if ($did = 21) { join $did(MCFD,20) }
  if ($did = 24) { join $did(MCFD,23) }
  if ($did = 1) { join $did(MCFD,26) }
  if ($did = 4) { join $did(MCFD,29) }
  if ($did = 6) { join $did(MCFD,32) }
  if ($did = 66) { join $did(MCFD,76) }
  if ($did = 67) { join $did(MCFD,77) }
  if ($did = 68) { join $did(MCFD,78) }
  if ($did = 69) { join $did(MCFD,79) }
  if ($did = 70) { join $did(MCFD,80) }
  if ($did = 71) { join $did(MCFD,81) }
  if ($did = 72) { join $did(MCFD,85) }
  if ($did = 73) { join $did(MCFD,83) }
  if ($did = 74) { join $did(MCFD,84) }
  if ($did = 75) { join $did(MCFD,82) }
}
on *:connect: {
  if (%cfchk1 = on) { join %cfchan1 }
  if (%cfchk2 = on) { join %cfchan2 }
  if (%cfchk3 = on) { join %cfchan3 }
  if (%cfchk4 = on) { join %cfchan4 }
  if (%cfchk5 = on) { join %cfchan5 }
  if (%cfchk6 = on) { join %cfchan6 }
  if (%cfchk7 = on) { join %cfchan7 }
  if (%cfchk8 = on) { join %cfchan8 }
  if (%cfchk9 = on) { join %cfchan9 }
  if (%cfchk10 = on) { join %cfchan10 }
  if (%cfchk11 = on) { join %cfchan11 }
  if (%cfchk12 = on) { join %cfchan12 }
  if (%cfchk13 = on) { join %cfchan13 }
  if (%cfchk14 = on) { join %cfchan14 }
  if (%cfchk15 = on) { join %cfchan15 }
  if (%cfchk16 = on) { join %cfchan16 }
  if (%cfchk17 = on) { join %cfchan17 }
  if (%cfchk18 = on) { join %cfchan18 }
  if (%cfchk19 = on) { join %cfchan19 }
  if (%cfchk20 = on) { join %cfchan20 }
}

menu * {
  .Max's Channel Favorites Dialog: { dialog -m MCFD MCFD }
}

alias favs {
  $iif($dialog(MCFD),dialog -c MCFD MCFD) dialog -m MCFD MCFD
}

Comments

Sign in to comment.
Firstmate   -  Apr 22, 2009

Combo boxes have the option to add checkboxes to each item. I suggest using that.

 Respond  
Aucun50   -  Apr 22, 2009

I like it but maybe you should add them and have a list with the option to change the auto join for every channel. Also you could use some elseif in there.

 Respond  
MaxEvans   -  Apr 21, 2009

I hadn't thought of that. Since I'm new to dialogs, I'm still trying to get the hang of it all. But I'll check on doing that, because that actually would be better.

 Respond  
Kirby   -  Apr 21, 2009

Cool Max.

Though, don't you think it is repetitive to have 20 different variables and if statements in the code?

I was thinking, to make it lessen the redundancy, somehow display all "added" channels with the use of tokens. As channel names cannot have the comma character (,) in them, each channel can be separated through that single token, saving you tons of space.
You could do the same thing with the "status" of the "Auto-Join" checkbox, using a similar concept.

If you don't think that's a good idea, then it might be better to use hashes. =/

 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.