I made this out of a dialog i am making at the moment, but this in it self is pretty good so i though i would put it on here for any one wanting it :).
Features
.Dialog form
.Multiple buttons for channel modes including: limet, moderation, secret, private, invite, password,external messages
.Check boxes that will be ticked if the channel mode is set to on
.Disables buttons if you are not op on the channel
NOTE
To choose the channel you must first have that channel open and have clicked in it to make it the active window
menu channel {
Channel Modes:/dialog -ma test test
}
alias dioc {
if (n isincs $chan($1).mode) { did -fc test 50 }
if (k isincs $chan($1).mode) { did -fc test 48 }
if (s isincs $chan($1).mode) { did -fc test 46 }
if (l isincs $chan($1).mode) { did -fc test 44 }
if (p isincs $chan($1).mode) { did -fc test 42 }
if (i isincs $chan($1).mode) { did -fc test 40 }
if (m isincs $chan($1).mode) { did -fc test 38 }
}
dialog test {
title Channel Modes
size -1 -1 208 112
option dbu
button Moderation, 37, 4 21 190 12, ok disable
check , 38, 194 21 9 10, left disable
button Invite only , 39, 4 33 190 12, ok tab 5 disable
check , 40, 194 33 9 10, left disable
button Private, 41, 4 45 190 12, ok tab 5 disable
check , 42, 194 45 9 10, left disable
button Limet, 43, 4 57 190 12, ok tab 5 disable
check , 44, 194 57 9 10, left disable
button Secret, 45, 4 69 190 12, ok tab 5 disable
check , 46, 194 72 9 10, left disable
button Password, 47, 4 81 190 12, ok tab 5 disable
check , 48, 194 82 9 10, left disable
button External Message, 49, 4 93 190 12, ok tab 5 disable
check , 50, 194 93 9 10, left disable
}
on *:dialog:test:init:*:{
set %channel $active | $dioc(%channel)
if $me isop %channel { did -e test 37,39,41,43,45,47,49 | $dioc(%channel) }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on 1:DIALOG:test:sclick:37:{
if (m isincs $chan(%channel).mode) { mode %channel -m | did -fu test 38 }
if (m !isincs $chan(%channel).mode) { mode %channel +m | did -fc test 38 }
}
on 1:DIALOG:test:sclick:39:{
if $me isop %channel {
if (i isincs $chan(%channel).mode) { mode %channel -i | did -fu test 40 }
if (i !isincs $chan(%channel).mode) { mode %channel +i | did -fc test 40 }
}
}
on 1:DIALOG:test:sclick:41:{
if $me isop %channel {
if (p isincs $chan(%channel).mode) { mode %channel -p | did -fu test 42 }
if (p !isincs $chan(%channel).mode) { mode %channel +p | did -fc test 42 }
}
}
on 1:DIALOG:test:sclick:43:{
if $me isop %channel {
if (l isincs $chan(%channel).mode) { mode %channel -l | did -fu test 44 }
if (l !isincs $chan(%channel).mode) {
$$?"To how many users?"
if $! isnum 0-100 { mode %channel + l $! | did -fc test 44 }
elseif $! isalnum { echo Pleae enter Only a number }
}
}
}
on 1:DIALOG:test:sclick:45:{
if $me isop %channel {
if (s isincs $chan(%channel).mode) { mode %channel -s | did -fu test 46 }
if (s !isincs $chan(%channel).mode) { mode %channel +s | did -fc test 46 }
}
}
on 1:DIALOG:test:sclick:47:{
if (k isincs $chan(%channel).mode) { mode %channel -k $chan(%channel).key | did -fu test 48 }
if (k !isincs $chan(%channel).mode) { mode %channel +k $$?"Password" | did -fc test 48 }
}
on 1:DIALOG:test:sclick:49:{
if (n isincs $chan(%channel).mode) { mode %channel -n | did -fu test 50 }
if (n !isincs $chan(%channel).mode) { mode %channel +n | did -fc test 50 }
}
no what i have done is:
it will only work if the dialogs open, if the click refresh it will close the dialog, then reopen it, and then go to the tab that you were last on, because in another part i have it so when you click a tab, it's set's %tab as that tab's ID
Edit:
Please rate the snippet :)
Also look at http://www.hawkee.com/snippet/7236/ for a newer dialog just made :)
your did -fu $dname is missing a dialog id number
When you use the -x flag you only need to name the dialog once, and in fact, the way you have that at the moment you can just use did -x $dname
The dialog -ma test test is fine, except what if the dialog is already open? You'll get an (ugly imo) error message.Check to see if the dialog is open using an $iif
alias _test dialog $iif($dialog(test),-x,-ma test) test
You could play around with these $iifs too if you felt like it.
did $iif(m isincs $chan(%channel).mode,-c,-u) test 38
mode $chan $iif(m isincs $chan(%channel).mode,+m,-m)
if ($active !ischan) return
I know there is noting suckier than someone telling you to read the help file, but the dialog part of the help file covers alot of good stuff.
There's no need for the f flag either as -c will check the box
I used to use:
alias _load.modes {
if ($active !ischan) return
var %mc = $chan($active).mode
if (m isincs %mc) did -c _options 52
if (N isincs %mc) did -c _options 78
if (I isincs %mc) did -c _options 43
if (R isincs %mc) did -c _options 44
if (L isincs %mc) did -c _options 45
if (f isincs %mc) did -c _options 46
if (G isincs %mc) did -c _options 76
if (C isincs %mc) did -c _options 77
if (n isincs %mc) did -c _options 71
if (t isincs %mc) did -c _options 70
if (Q isincs %mc) did -c _options 81
if (c isincs %mc) did -c _options 73
if (M isincs %mc) did -c _options 82
if (T isincs %mc) did -c _options 79
if (j isincs %mc) did -c _options 60
if (w isincs %mc) did -c _options 61
if (p isincs %mc) did -c _options 80
if (l isincs %mc) did -i _options 84 1 * $gettok(%mc,-1,32)
if (K isincs %mc) did -c _options 72
if (R isincs %mc) did -c _options 74
}
but even then I don't like it, it's too long and messy for such basic code. $iif would work just as well to clean it up as well.
on 1:DIALOG:test:sclick:49:{
if (n isincs $chan(%channel).mode)} { mode %channel -n | did -fu test 50 }
if (n !isincs $chan(%channel).mode)} { mode %channel +n | did -fc test 50 }
}
nothing, but what's wrong with that :/
You have a whole pile of bracket mismatch issues and you could use else in about seven places to shorten it.