mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#178472 10/06/07 08:40 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
How do I turn on/off a groupe of sclick dialog?
Exemple:

}
on 1:dialog:popusn:sclick:14:{
if $did(14).state == 1 { set %Relay2 on }
if $did(14).state == 0 { set %Relay2 off }
}
on 1:dialog:popusn:sclick:15:{
if $did(15).state == 1 { set %Relay1 on }
if $did(15).state == 0 { set %Relay1 off }
}
on 1:dialog:popusn:sclick:16:{
if $did(16).state == 1 { set %Relay on }
if $did(16).state == 0 { set %Relay off }
}
on 1:dialog:popusn:sclick:17:{
if $did(17).state == 1 { set %Relay3 on }
if $did(17).state == 0 { set %Relay3 off }
}
on 1:dialog:popusn:init:*:{
if (%Relay2 == on) { did -c $dname 14 }
if (%Relay1 == on) { did -c $dname 15 }
if (%Relay == on) { did -c $dname 16 }
if (%Relay3 == on) { did -c $dname 17 }

Last edited by Garou; 10/06/07 08:41 PM.
Garou #178473 10/06/07 09:12 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
On *:Dialog:popusn:*:*: {
  if ($devent == sclick) {
    if ($did == 14) set %Relay2 $iif($did(14).state == 1,on,off)
    if ($did == 15) set %Relay1 $iif($did(15).state == 1,on,off)
    if ($did == 16)  set %relay $iif($did(16).state == 1,on,off)
    if ($did == 17) set %relay3 $iif($did(17).state == 1,on,off)
  }
  if ($devent == init) {
    if (%Relay2 == on) { did -c $dname 14 }
    if (%Relay1 == on) { did -c $dname 15 }
    if (%Relay == on) { did -c $dname 16 }
    if (%Relay3 == on) { did -c $dname 17 } 
  }
}

Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
I want to check or uncheck a groupe check box from one check box, is that wat this will do?

Garou #178477 10/06/07 09:29 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I guess I must have misread your post, and I still don't think I am understanding you properly, sorry.

Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
I have 5 tabs on my dialog with 15 check box indide each tab. I want to close check or uncheck all check box on one click for all check box.

Garou #178481 10/06/07 09:43 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You want an option to check all check boxes from a single checkbox? Paste your entire dialog script here, I'll take a look at it for you, I'll probably understand a little better too as I might be able to see it from your POV.

Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Code:
 

  dialog popusn {
  title "Settings"
  size -1 -1 333 330
  icon graphics\cfg.ico
  TAB "OPS1",2, 0 0 330 425
  TAB "OPS2",3
  TAB "OPS3",4
  TAB "OPS4",5
  TAB "OPS5",6
  TAB "OPS6",7
  edit "", 90, 20 70 295 25,push,tab 7
  button "Userlist Settings", 70, 20 70 110 25,flat,tab 5
  button "Display Settings", 71, 20 100 110 25,flat,tab 5
  button "General Settings", 72, 20 130 110 25,flat,tab 5
  button "Network Settings", 73, 20 160 110 25,flat,tab 5
  button "Channel Protections", 74, 20 190 110 25,flat,tab 5
  button "Vhost Scaner", 75, 190 70 110 25,flat,tab 5
  button "Proxy Scaner", 76, 190 100 110 25,flat,tab 5
  button "Sound Settings", 77, 190 130 110 25,flat,tab 5
  button "Blacklist Trigger", 78, 190 160 110 25,flat,tab 5
  button "Blacklist Settings", 79, 190 190 110 25,flat,tab 5
  button "MP3 Player", 80, 20 70 110 25,flat,tab 6
  button "Ignore List", 81, 20 100 110 25,flat,tab 6
  button "Spy Settings", 82, 20 130 110 25,flat,tab 6
  button "Whois Channel", 83, 20 160 110 25,flat,tab 6
  button "Unwanted Text", 84, 20 190 110 25,flat,tab 6
  button "Banned Channel", 85, 190 70 110 25,flat,tab 6
  button "Screan Flood", 95, 190 100 110 25,flat,tab 6
  button "Punctuation Flood", 96, 190 130 110 25,flat,tab 6
  button "DNS", 86, 20 105 110 25,flat,tab 7
  button "WHOIS", 87, 20 140 110 25,flat,tab 7
  button "NICK INFO", 88, 190 105 110 25,flat,tab 7
  button "CHANNEL INFO", 89, 190 140 110 25,flat,tab 7
  button "CHANSERV", 92, 20 175 110 25,flat,tab 7
  button "MENU INFO", 93, 190 175 110 25,flat,tab 7
  button "Close", 12, 20 290 295 25,flat, cancel
  text "Protection from spam and flood....",13, 22 40 200 20,tab 2
  check "Relay-1",14, 20 70 80 20,tab 2
  check "Relay-2",15, 20 100 80 20,tab 2
  check "Relay-3",16, 20 130 80 20,tab 2
  check "Relay-4",17, 20 160 80 20,tab 2
  check "Nick Flood",18, 20 190 80 20,tab 2
  check "Quit Flood",19, 120 70 80 20,tab 2
  check "Chan Flood",20, 120 100 80 20,tab 2
  check "Dcc Flood",21, 120 130 80 20,tab 2
  check "Ctcp Flood",22, 120 160 80 20,tab 2
  check "Querie Flood",23, 120 190 80 20,tab 2
  check "Join FLood",24, 220 70 80 20,tab 2
  check "Mass FLood",25, 220 100 80 20,tab 2
  check "Letter Flood",26, 220 130 80 20,tab 2
  check "Word Flood",27, 220 160 80 20,tab 2
  check "Color Flood",28, 220 190 80 20,tab 2
  check "Rev Door",29, 20 70 80 20,tab 3
  check "Spam Bot",30, 20 100 80 20,tab 3
  check "Drone Bot",31, 20 130 80 20,tab 3
  check "Drone Nick",32, 20 160 80 20,tab 3
  check "Quit Bot",33, 20 190 80 20,tab 3
  check "Bad Away",34, 120 70 80 20,tab 3
  check "Bad Name",35, 120 100 80 20,tab 3
  check "Chan Notice",36, 120 130 80 20,tab 3
  check "Private Notice",37, 120 160 85 20,tab 3
  check "Notify BanList",38, 120 190 85 20,tab 3
  check "Trout Slap",39, 220 70 80 20,tab 3
  check "Nosense Nick",40, 220 100 85 20,tab 3
  check "Bad Script",41, 220 130 80 20,tab 3
  check "Auto Whois",42, 220 160 80 20,tab 3
  check "Ban Enforcer",57, 220 190 80 20,tab 3
  check "Spy Log",43, 20 70 80 20,tab 4
  check "Auto Op",44, 20 100 80 20,tab 4
  check "Mode Log",45, 20 130 80 20,tab 4
  check "Auto Unban",46, 20 160 80 20,tab 4
  check "Part Log",47, 20 190 80 20,tab 4
  check "Topic Log",48, 120 70 85 20,tab 4
  check "Kick Log",49, 120 100 80 20,tab 4
  check "Join Log",50, 120 130 80 20,tab 4
  check "Nick Log",51, 120 160 80 20,tab 4
  check "Quit Log",52, 120 190 80 20,tab 4
  check "Sticky Ban",53, 220 70 80 20,tab 4
  check "none",54, 220 100 80 20,tab 4
  text "Protection from notice and bot flood....",55, 22 40 200 20,tab 3
  text "Protection and logs....",56, 22 40 200 20,tab 4
  text "Channel Protection....",59, 22 40 200 20,tab 5
  text "Channel Protection....",60, 22 40 200 20,tab 6
  text "Enter nick or channel to get info....",91, 22 40 200 20,tab 7
  box "",200, 20 220 290 50
  text "This Dialog helps you choose the protection or settings you need.",201, 40 230 230 30
  box "",202, 5 25 320 300

}
on 1:dialog:popusn:sclick:14:{ 
  if $did(14).state == 1 { set %Relay2 on  }
  if $did(14).state == 0 { set %Relay2 off }
}
on 1:dialog:popusn:sclick:15:{ 
  if $did(15).state == 1 { set %Relay1 on  }
  if $did(15).state == 0 { set %Relay1 off }
}
on 1:dialog:popusn:sclick:16:{ 
  if $did(16).state == 1 { set %Relay on  }
  if $did(16).state == 0 { set %Relay off }
}
on 1:dialog:popusn:sclick:17:{ 
  if $did(17).state == 1 { set %Relay3 on  }
  if $did(17).state == 0 { set %Relay3 off }
}
on 1:dialog:popusn:sclick:18:{ 
  if $did(18).state == 1 { set %longnick on  }
  if $did(18).state == 0 { set %longnick off }
}
on 1:dialog:popusn:sclick:19:{ 
  if $did(19).state == 1 { set %quitpart on  }
  if $did(19).state == 0 { set %quitpart off }
}
on 1:dialog:popusn:sclick:20:{ 
  if $did(20).state == 1 { set %flood on  }
  if $did(20).state == 0 { set %flood off }
}
on 1:dialog:popusn:sclick:21:{ 
  if $did(21).state == 1 { set %Dcc. on  }
  if $did(21).state == 0 { set %Dcc. off }
}
on 1:dialog:popusn:sclick:22:{ 
  if $did(22).state == 1 { set %Ctcp. on  }
  if $did(22).state == 0 { set %Ctcp. off }
}
on 1:dialog:popusn:sclick:23:{ 
  if $did(23).state == 1 { set %Query. on  }
  if $did(23).state == 0 { set %Query. off }
}
on 1:dialog:popusn:sclick:24:{ 
  if $did(24).state == 1 { set %opsjoin. on  }
  if $did(24).state == 0 { set %opsjoin. off }
}
on 1:dialog:popusn:sclick:25:{ 
  if $did(25).state == 1 { set %join on  }
  if $did(25).state == 0 { set %join off }
}
on 1:dialog:popusn:sclick:26:{ 
  if $did(26).state == 1 { set %Letter on  }
  if $did(26).state == 0 { set %Letter off }
}
on 1:dialog:popusn:sclick:27:{ 
  if $did(27).state == 1 { set %word on  }
  if $did(27).state == 0 { set %word off }
}
on 1:dialog:popusn:sclick:28:{ 
  if $did(28).state == 1 { set %cnt on  }
  if $did(28).state == 0 { set %cnt off }
}

on 1:dialog:popusn:sclick:29:{ 
  if $did(29).state == 1 { set %door on  }
  if $did(29).state == 0 { set %door off }
}
on 1:dialog:popusn:sclick:30:{ 
  if $did(30).state == 1 { set %bot on  }
  if $did(30).state == 0 { set %bot off }
}
on 1:dialog:popusn:sclick:31:{ 
  if $did(31).state == 1 { set %drone on  }
  if $did(31).state == 0 { set %drone off }
}
on 1:dialog:popusn:sclick:32:{ 
  if $did(32).state == 1 { set %drones on  }
  if $did(32).state == 0 { set %drones off }
}
on 1:dialog:popusn:sclick:33:{ 
  if $did(33).state == 1 { set %quit on  }
  if $did(33).state == 0 { set %quit off }
}
on 1:dialog:popusn:sclick:34:{ 
  if $did(34).state == 1 { set %away on  }
  if $did(34).state == 0 { set %away off }
}
on 1:dialog:popusn:sclick:35:{ 
  if $did(35).state == 1 { set %name on  }
  if $did(35).state == 0 { set %name off }
}
on 1:dialog:popusn:sclick:36:{ 
  if $did(36).state == 1 { set %notice on  }
  if $did(36).state == 0 { set %notice off }
}
on 1:dialog:popusn:sclick:37:{ 
  if $did(37).state == 1 { set %notice. on  }
  if $did(37).state == 0 { set %notice. off }
}
on 1:dialog:popusn:sclick:38:{ 
  if $did(38).state == 1 { set %bnn on  }
  if $did(38).state == 0 { set %bnn off }
}
on 1:dialog:popusn:sclick:39:{ 
  if $did(39).state == 1 { set %slap on  }
  if $did(39).state == 0 { set %slap off }
}
on 1:dialog:popusn:sclick:40:{ 
  if $did(40).state == 1 { set %op.nopsenseSW on  }
  if $did(40).state == 0 { set %op.nopsenseSW off }
}
on 1:dialog:popusn:sclick:41:{ 
  if $did(41).state == 1 { set %CTCPREPLY on  }
  if $did(41).state == 0 { set %CTCPREPLY off }
}
on 1:dialog:popusn:sclick:42:{ 
  if $did(42).state == 1 { set %op.random On | timerrandomwhois 0 60 randomnick  }
  if $did(42).state == 0 { set %op.random Off | timerrandomwhois Off randomnick }
}
on 1:dialog:popusn:sclick:43:{ 
  if $did(43).state == 1 { set %spy.counter on  }
  if $did(43).state == 0 { set %spy.counter off }
}
on 1:dialog:popusn:sclick:44:{ 
  if $did(44).state == 1 { set %deop on  }
  if $did(44).state == 0 { set %deop off }
}
on 1:dialog:popusn:sclick:45:{ 
  if $did(45).state == 1 { set %rawmode on  }
  if $did(45).state == 0 { set %rawmode off }
}
on 1:dialog:popusn:sclick:46:{ 
  if $did(46).state == 1 { set %unban on  }
  if $did(46).state == 0 { set %unban off }
}
on 1:dialog:popusn:sclick:47:{ 
  if $did(47).state == 1 { set %part.counter on }
  if $did(47).state == 0 { set %part.counter off }
}
on 1:dialog:popusn:sclick:48:{ 
  if $did(48).state == 1 { set %topic.counter on  }
  if $did(48).state == 0 { set %topic.counter off }
}
on 1:dialog:popusn:sclick:49:{ 
  if $did(49).state == 1 { set %Kick.counter on  }
  if $did(49).state == 0 { set %Kick.counter off }
}
on 1:dialog:popusn:sclick:50:{ 
  if $did(50).state == 1 { set %join.counter on  }
  if $did(50).state == 0 { set %join.counter off }
}

on 1:dialog:popusn:sclick:51:{ 
  if $did(51).state == 1 { set %nick.counter on  }
  if $did(51).state == 0 { set %nick.counter off }
}
on 1:dialog:popusn:sclick:52:{ 
  if $did(52).state == 1 { set %quit.counter on  }
  if $did(52).state == 0 { set %quit.counter off }
}
on 1:dialog:popusn:sclick:53:{ 
  if $did(53).state == 1 { set %sticky.ban on  }
  if $did(53).state == 0 { set %sticky.ban off }
}
on 1:dialog:popusn:sclick:54:{ 
  if $did(54).state == 1 { set %topic.counter on  }
  if $did(54).state == 0 { set %topic.counter off }
}
on 1:dialog:popusn:sclick:57:{ 
  if $did(57).state == 1 { set %ban on }
  if $did(57).state == 0 { set %ban off }
}

on 1:dialog:popusn:init:*:{
  if (%Relay2 == on) { did -c $dname 14 }
  if (%Relay1 == on) { did -c $dname 15 }
  if (%Relay == on) { did -c $dname 16 }
  if (%Relay3 == on) { did -c $dname 17 }
  if (%longnick == on) { did -c $dname 18 }
  if (%quitpart == on) { did -c $dname 19 }
  if (%flood  == on) { did -c $dname 20 }
  if (%Dcc. == on) { did -c $dname 21 }
  if (%Ctcp. == on) { did -c $dname 22 }
  if (%Query. == on) { did -c $dname 23 }
  if (%opsjoin. == on) { did -c $dname 24 }
  if (%join == on) { did -c $dname 25 }
  if (%Letter  == on) { did -c $dname 26 }
  if (%word == on) { did -c $dname 27 }
  if (%cnt == on) { did -c $dname 28 }
  if (%door == on) { did -c $dname 29 }
  if (%bot == on) { did -c $dname 30 }
  if (%drone == on) { did -c $dname 31 }
  if (%drones == on) { did -c $dname 32 }
  if (%quit == on) { did -c $dname 33 }
  if (%away == on) { did -c $dname 34 }
  if (%name == on) { did -c $dname 35 }
  if (%notice == on) { did -c $dname 36 }
  if (%notice. == on) { did -c $dname 37 }
  if (%bnn == on) { did -c $dname 38 }
  if (%slap == on) { did -c $dname 39 }
  if (%op.nopsenseSW == on) { did -c $dname 40 }
  if (%CTCPREPLY  == on) { did -c $dname 41 }
  if (%op.random == on) { did -c $dname 42 }
  if (%spy.counter == on) { did -c $dname 43 }
  if (%deop == on) { did -c $dname 44 }
  if (%rawmode == on) { did -c $dname 45 }
  if (%unban == on) { did -c $dname 46 }
  if (%part.counter  == on) { did -c $dname 47 }
  if (%topic.counter == on) { did -c $dname 48 }
  if (%Kick.counter == on) { did -c $dname 49 }
  if (%join.counter == on) { did -c $dname 50 }
  if (%nick.counter == on) { did -c $dname 51 }
  if (%quit.counter == on) { did -c $dname 52 }
  if (%sticky.ban == on) { did -c $dname 53 }
  if (%topic.counter == on) { did -c $dname 54 }
  if (%ban == on) { did -c $dname 57 }
}


Garou #178484 10/06/07 09:50 PM
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
mabe make an alias of it, then call the alias everytime click in the dialog? then u can use the same alias on init to, maybe less work for you? i made it that way in some of my dialogs, dont know if it's any bether way to do it.

alias load.click {
if (%bla == on) { did -c $dname 1 }
if (%test == on) { did -c $dname 2 }
if (%try == on) { did -c $dname 3 }
}

on 1:dialog:popusn:sclick:14:{
if $did(14).state == 1 { set %Relay2 on | load.click }
if $did(14).state == 0 { set %Relay2 off | load.click }
}


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Garou #178487 10/06/07 10:24 PM
Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
From mIRC Help file for /did:
Quote:
-c check checkbox/radiobutton list/combo line
-u uncheck checkbox/radiobutton list/combo line
-k works with -cu, keeps other selections in a listbox

The '-k' is also used for 3-state check boxes.

Garou #178491 10/06/07 11:32 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You can use /did commands with multiple IDs. Just do that.

Example:
/did -u $dname 1,2,3,4,5,6,7,8

Or, put all of the IDs into a variable and use:
/did -u $dname %IDs


Invision Support
#Invision on irc.irchighway.net
Riamus2 #178494 10/06/07 11:48 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Ok something like this?

on 1:dialog:popusn:sclick:14:{
did -c $dname 14
did -u $dname 14,15,16,17,18,20,

then I have to add 2 push botton like this:

check "Select none", 1oo, 94 83 37 12, push
check "Select all", 101, 94 96 37 12, push

Garou #178495 10/06/07 11:56 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
dialog popusn {
  title "Settings"
  size -1 -1 333 330
  icon graphics\cfg.ico
  TAB "OPS1",2, 0 0 330 425
  TAB "OPS2",3
  TAB "OPS3",4
  TAB "OPS4",5
  TAB "OPS5",6
  TAB "OPS6",7
  edit "", 90, 20 70 295 25,push,tab 7
  button "Userlist Settings", 70, 20 70 110 25,flat,tab 5
  button "Display Settings", 71, 20 100 110 25,flat,tab 5
  button "General Settings", 72, 20 130 110 25,flat,tab 5
  button "Network Settings", 73, 20 160 110 25,flat,tab 5
  button "Channel Protections", 74, 20 190 110 25,flat,tab 5
  button "Vhost Scaner", 75, 190 70 110 25,flat,tab 5
  button "Proxy Scaner", 76, 190 100 110 25,flat,tab 5
  button "Sound Settings", 77, 190 130 110 25,flat,tab 5
  button "Blacklist Trigger", 78, 190 160 110 25,flat,tab 5
  button "Blacklist Settings", 79, 190 190 110 25,flat,tab 5
  button "MP3 Player", 80, 20 70 110 25,flat,tab 6
  button "Ignore List", 81, 20 100 110 25,flat,tab 6
  button "Spy Settings", 82, 20 130 110 25,flat,tab 6
  button "Whois Channel", 83, 20 160 110 25,flat,tab 6
  button "Unwanted Text", 84, 20 190 110 25,flat,tab 6
  button "Banned Channel", 85, 190 70 110 25,flat,tab 6
  button "Screan Flood", 95, 190 100 110 25,flat,tab 6
  button "Punctuation Flood", 96, 190 130 110 25,flat,tab 6
  button "DNS", 86, 20 105 110 25,flat,tab 7
  button "WHOIS", 87, 20 140 110 25,flat,tab 7
  button "NICK INFO", 88, 190 105 110 25,flat,tab 7
  button "CHANNEL INFO", 89, 190 140 110 25,flat,tab 7
  button "CHANSERV", 92, 20 175 110 25,flat,tab 7
  button "MENU INFO", 93, 190 175 110 25,flat,tab 7
  button "Close", 12, 20 290 295 25,flat, cancel
  text "Protection from spam and flood....",13, 22 40 200 20,tab 2
  check "Relay-1",14, 20 70 80 20,tab 2
  check "Relay-2",15, 20 100 80 20,tab 2
  check "Relay-3",16, 20 130 80 20,tab 2
  check "Relay-4",17, 20 160 80 20,tab 2
  check "Nick Flood",18, 20 190 80 20,tab 2
  check "Quit Flood",19, 120 70 80 20,tab 2
  check "Chan Flood",20, 120 100 80 20,tab 2
  check "Dcc Flood",21, 120 130 80 20,tab 2
  check "Ctcp Flood",22, 120 160 80 20,tab 2
  check "Querie Flood",23, 120 190 80 20,tab 2
  check "Join FLood",24, 220 70 80 20,tab 2
  check "Mass FLood",25, 220 100 80 20,tab 2
  check "Letter Flood",26, 220 130 80 20,tab 2
  check "Word Flood",27, 220 160 80 20,tab 2
  check "Color Flood",28, 220 190 80 20,tab 2
  check "Rev Door",29, 20 70 80 20,tab 3
  check "Spam Bot",30, 20 100 80 20,tab 3
  check "Drone Bot",31, 20 130 80 20,tab 3
  check "Drone Nick",32, 20 160 80 20,tab 3
  check "Quit Bot",33, 20 190 80 20,tab 3
  check "Bad Away",34, 120 70 80 20,tab 3
  check "Bad Name",35, 120 100 80 20,tab 3
  check "Chan Notice",36, 120 130 80 20,tab 3
  check "Private Notice",37, 120 160 85 20,tab 3
  check "Notify BanList",38, 120 190 85 20,tab 3
  check "Trout Slap",39, 220 70 80 20,tab 3
  check "Nosense Nick",40, 220 100 85 20,tab 3
  check "Bad Script",41, 220 130 80 20,tab 3
  check "Auto Whois",42, 220 160 80 20,tab 3
  check "Ban Enforcer",55, 220 190 80 20,tab 3
  check "Spy Log",43, 20 70 80 20,tab 4
  check "Auto Op",44, 20 100 80 20,tab 4
  check "Mode Log",45, 20 130 80 20,tab 4
  check "Auto Unban",46, 20 160 80 20,tab 4
  check "Part Log",47, 20 190 80 20,tab 4
  check "Topic Log",48, 120 70 85 20,tab 4
  check "Kick Log",49, 120 100 80 20,tab 4
  check "Join Log",50, 120 130 80 20,tab 4
  check "Nick Log",51, 120 160 80 20,tab 4
  check "Quit Log",52, 120 190 80 20,tab 4
  check "Sticky Ban",53, 220 70 80 20,tab 4
  check "none",54, 220 100 80 20,tab 4
  text "Protection from notice and bot flood....",206, 22 40 200 20,tab 3
  text "Protection and logs....",56, 22 40 200 20,tab 4
  text "Channel Protection....",59, 22 40 200 20,tab 5
  text "Channel Protection....",60, 22 40 200 20,tab 6
  text "Enter nick or channel to get info....",91, 22 40 200 20,tab 7
  box "",200, 20 220 290 50
  text "This Dialog helps you choose the protection or settings you need.",201, 40 230 230 30
  box "",202, 5 25 320 300
  check "Check/Uncheck all", 204, 208 39 116 20, tab 2
  check "Check/Uncheck all", 205, 208 39 116 20, tab 3
  check "Check/Uncheck all", 207, 208 39 116 20, tab 4
}

On *:Dialog:popusn:*:*: {
  if ($devent == sclick) {
    if ($did == 204) { 
      did $+(-,$iif($did(204).state == 0,u,c)) $dname 14-28 
    }
    if ($did == 205) { 
      did $+(-,$iif($did(205).state == 0,u,c)) $dname 29-42
      did $+(-,$iif($did(205).state == 0,u,c)) $dname 55
    }
    if ($did == 207) { 
      did $+(-,$iif($did(207).state == 0,u,c)) $dname 43-53
    }
  }
  if ($devent == init) {
    if (%Relay2 == on) { did -c $dname 14 }
    if (%Relay1 == on) { did -c $dname 15 }
    if (%Relay == on) { did -c $dname 16 }
    if (%Relay3 == on) { did -c $dname 17 }
    if (%longnick == on) { did -c $dname 18 }
    if (%quitpart == on) { did -c $dname 19 }
    if (%flood  == on) { did -c $dname 20 }
    if (%Dcc. == on) { did -c $dname 21 }
    if (%Ctcp. == on) { did -c $dname 22 }
    if (%Query. == on) { did -c $dname 23 }
    if (%opsjoin. == on) { did -c $dname 24 }
    if (%join == on) { did -c $dname 25 }
    if (%Letter  == on) { did -c $dname 26 }
    if (%word == on) { did -c $dname 27 }
    if (%cnt == on) { did -c $dname 28 }
    if (%door == on) { did -c $dname 29 }
    if (%bot == on) { did -c $dname 30 }
    if (%drone == on) { did -c $dname 31 }
    if (%drones == on) { did -c $dname 32 }
    if (%quit == on) { did -c $dname 33 }
    if (%away == on) { did -c $dname 34 }
    if (%name == on) { did -c $dname 35 }
    if (%notice == on) { did -c $dname 36 }
    if (%notice. == on) { did -c $dname 37 }
    if (%bnn == on) { did -c $dname 38 }
    if (%slap == on) { did -c $dname 39 }
    if (%op.nopsenseSW == on) { did -c $dname 40 }
    if (%CTCPREPLY  == on) { did -c $dname 41 }
    if (%op.random == on) { did -c $dname 42 }
    if (%spy.counter == on) { did -c $dname 43 }
    if (%deop == on) { did -c $dname 44 }
    if (%rawmode == on) { did -c $dname 45 }
    if (%unban == on) { did -c $dname 46 }
    if (%part.counter  == on) { did -c $dname 47 }
    if (%topic.counter == on) { did -c $dname 48 }
    if (%Kick.counter == on) { did -c $dname 49 }
    if (%join.counter == on) { did -c $dname 50 }
    if (%nick.counter == on) { did -c $dname 51 }
    if (%quit.counter == on) { did -c $dname 52 }
    if (%sticky.ban == on) { did -c $dname 53 }
    if (%topic.counter == on) { did -c $dname 54 }
    if (%ban == on) { did -c $dname 54 }
  }
  if ($devent == close) { call.popusn }
}

alias call.popusn {
  if ($did(14).state == 1) { set %Relay2 on }
  else { set %relay2 off }
  if ($did(15).state == 1) { set %Relay1 on }
  else { set %relay1 off }
  if ($did(16).state == 1) { set %relay on }
  else { set %relay off }
  if ($did(17).state == 1) { set %relay3 on }
  else { set %relay3 off }
  if ($did(18).state == 1) { set %longnick on }
  else { set %longnick off }
  if ($did(19).state == 1) { set %quitpart on }
  else { set %quitpart off }
  if ($did(20).state == 1) { set %flood on }
  else { set %flood off }
  if ($did(21).state == 1) { set %dcc. on }
  else { set %dcc. off }
  if ($did(22).state == 1) { set %ctcp. on }
  else { set %ctcp. off }
  if ($did(23).state == 1) { set %query. on }
  else { set %query. off }
  if ($did(24).state == 1) { set %opsjoin. on }
  else { set %opsjoin. off }
  if ($did(25).state == 1) { set %join on }
  else { set %join off }
  if ($did(26).state == 1) { set %letter on }
  else { set %letter off }
  if ($did(27).state == 1) { set %word on }
  else { set %word off }
  if ($did(28).state == 1) { set %cnt on }
  else { set %cnt off }
  if ($did(29).state == 1) { set %door on }
  else { set %door off }
  if ($did(30).state == 1) { set %bot on }
  else { set %bot off }
  if ($did(31).state == 1) { set %drone on }
  else { set %drone off }
  if ($did(32).state == 1) { set %drones on }
  else { set %drones off }
  if ($did(33).state == 1) { set %quit on }
  else { set %quit off }
  if ($did(34).state == 1) { set %away on }
  else { set %away off }
  if ($did(35).state == 1) { set %name on }
  else { set %name off }
  if ($did(36).state == 1) { set %notice on }
  else { set %notice off }
  if ($did(37).state == 1) { set %notice. on }
  else { set %notice. off }
  if ($did(38).state == 1) { set %bnn on }
  else { set %bnn off }
  if ($did(39).state == 1) { set %slap on }
  else { set %slap off }
  if ($did(40).state == 1) { set %op.nopsenseSW on }
  else { set %op.nopsenseSW off }
  if ($did(41).state == 1) { set %CTCPREPLY on }
  else { set %CTCPREPLY off }
  if ($did(42).state == 1) { set %op.random on }
  else { set %op.random off }
  if ($did(43).state == 1) { set %spy.counter on }
  else { set %spy.counter off }
  if ($did(44).state == 1) { set %deop  on }
  else { set %deop off }
  if ($did(45).state == 1) { set %rawmode on }
  else { set %rawmode off }
  if ($did(46).state == 1) { set %unban on }
  else { set %unban off }
  if ($did(47).state == 1) { set %part.counter on }
  else { set %part.counter off }
  if ($did(48).state == 1) { set %topic.counter on }
  else { set %topic.counter off }
  if ($did(49).state == 1) { set %kick.counter on }
  else { set %kick.counter off }
  if ($did(50).state == 1) { set %join.counter on }
  else { set %join.counter off }
  if ($did(51).state == 1) { set %nick.counter on }
  else { set %nick.counter off }
  if ($did(52).state == 1) { set %quit.counter on }
  else { set %quit.counter off }
  if ($did(53).state == 1) { set %sticky.ban on }
  else { set %sticky.ban off }
  if ($did(54).state == 1) { set %ban on }
  else { set %ban off }
}


Try this witha fresh mIRC just so you don't overwrite your current script. There is a minor and that's because in your code you have 2 %topic.counter variables, which you will need to go through and sort out..

Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Thx you very much, its exacly what I needed smile

Garou #178498 11/06/07 12:24 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Personally, I'd cut down the size of your script by either using a hash table or else a settings file. Doing so, you can loop through your settings on init rather than having so many IFs. It may not speed it up considerably, but it will shorten it considerably.

If you use a hash table, I would recommend setting each item up with the same itemname as the ID in your dialog. Then, you can easily loop through the IDs/Itemnames.

If you use a settings file, you could set it up to include the ID and On or Off. Then, you can use /filter to filter out only those settings marked On and loop through them to check them off. That will cut down on the checks since you don't need to worry about the settings that are off.

Again, I don't know that either method will increase the speed of the script, but it will definitely decrease the size of the script.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #178499 11/06/07 12:35 AM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Yes your right its big but its the only way I knew how so if you have time surething thx.

Riamus2 #178501 11/06/07 01:08 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
All yours Riamus. laugh

Riamus2 #178503 11/06/07 01:54 AM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
I cant open my buttons?

Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
Code:
alias call.popusn
  set %Relay2 $iif($did(14).state == 1, on, off)
  set %relay1 $iif($did(15).state == 1, on, off)
  set %relay $iif($did(16).state == 1, on, off)
  set %relay3 $iif($did(17).state == 1, on, off)
  set %longnick $iif($did(18).state == 1, on, off)
  set %quitpart $iif($did(19).state == 1, on, off)
  set %flood $iif($did(20).state == 1, on, off)
  set %dcc. $iif($did(21).state == 1, on, off)
  set %ctcp. $iif($did(22).state == 1, on, off)
  set %query. $iif($did(23).state == 1, on, off)
  set %opsjoin. $iif($did(24).state == 1, on, off)
  set %join $iif($did(25).state == 1, on, off)
  set %letter $iif($did(26).state == 1, on, off)
  set %word $iif($did(27).state == 1, on, off)
  set %cnt $iif($did(28).state == 1, on, off)
  set %door $iif($did(29).state == 1, on, off)
  set %bot $iif($did(30).state == 1, on, off)
  set %drone $iif($did(31).state == 1, on, off)
  set %drones $iif($did(32).state == 1, on, off)
  set %quit $iif($did(33).state == 1, on, off)
  set %away $iif($did(34).state == 1, on, off)
  set %name $iif($did(35).state == 1, on, off)
  set %notice $iif($did(36).state == 1, on, off)
  set %notice. $iif($did(37).state == 1, on, off)
  set %bnn $iif($did(38).state == 1, on, off)
  set %slap $iif($did(39).state == 1, on, off)
  set %op.nopsenseSW $iif($did(40).state == 1, on, off)
  set %CTCPREPLY $iif($did(41).state == 1, on, off)
  set %op.random $iif($did(42).state == 1, on, off)
  set %spy.counter $iif($did(43).state == 1, on, off)
  set %deop  $iif($did(44).state == 1, on, off)
  set %rawmode $iif($did(45).state == 1, on, off)
  set %unban $iif($did(46).state == 1, on, off)
  set %part.counter $iif($did(47).state == 1, on, off)
  set %topic.counter $iif($did(48).state == 1, on, off)
  set %kick.counter $iif($did(49).state == 1, on, off)
  set %join.counter $iif($did(50).state == 1, on, off)
  set %nick.counter $iif($did(51).state == 1, on, off)
  set %quit.counter $iif($did(52).state == 1, on, off)
  set %sticky.ban $iif($did(53).state == 1, on, off)
  set %ban $iif($did(54).state == 1, on, off)
}

is the messy-cleanup.

The loopy-way using a token-list of hash table would be neater still, using this sort of concept:
Code:
alias call.popusn {
  var %settings = relay2#14 relay1#15 relay#16 relay3#17 longnick#18 quitpart#19 ....
  var %count = 1
  while ($gettok(%settings, %count, 32)) {
    var %var = $gettok($v1, 1,  35)
    var %num = $gettok($v1, 2,  35)
    set $+(%, %var) = $iif($did(%num).state == 1, on, off)
    inc %count
  }
}

Doing it in reverse for the 'did -c' is also possible, using the same '%settings' string for complete coverage.

Last edited by Bekar; 11/06/07 01:59 AM.
Bekar #178505 11/06/07 02:06 AM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
I cant open my buttons??
Why buttons 70 to 93 wont open anymore?

Code:
 

dialog popusn {
  title "Settings"
  size -1 -1 333 330
  icon graphics\cfg.ico
  TAB "OPS1",2, 0 0 330 425
  TAB "OPS2",3
  TAB "OPS3",4
  TAB "OPS4",5
  TAB "OPS5",6
  TAB "OPS6",7
  edit "", 90, 20 70 295 25,push,tab 7
  button "Userlist Settings", 70, 20 70 110 25,flat,tab 5
  button "Display Settings", 71, 20 100 110 25,flat,tab 5
  button "General Settings", 72, 20 130 110 25,flat,tab 5
  button "Network Settings", 73, 20 160 110 25,flat,tab 5
  button "Channel Protections", 74, 20 190 110 25,flat,tab 5
  button "Vhost Scaner", 75, 190 70 110 25,flat,tab 5
  button "Proxy Scaner", 76, 190 100 110 25,flat,tab 5
  button "Sound Settings", 77, 190 130 110 25,flat,tab 5
  button "Blacklist Trigger", 78, 190 160 110 25,flat,tab 5
  button "Blacklist Settings", 79, 190 190 110 25,flat,tab 5
  button "MP3 Player", 80, 20 70 110 25,flat,tab 6
  button "Ignore List", 81, 20 100 110 25,flat,tab 6
  button "Spy Settings", 82, 20 130 110 25,flat,tab 6
  button "Whois Channel", 83, 20 160 110 25,flat,tab 6
  button "Unwanted Text", 84, 20 190 110 25,flat,tab 6
  button "Banned Channel", 85, 190 70 110 25,flat,tab 6
  button "Screan Flood", 95, 190 100 110 25,flat,tab 6
  button "Punctuation Flood", 96, 190 130 110 25,flat,tab 6
  button "DNS", 86, 20 105 110 25,flat,tab 7
  button "WHOIS", 87, 20 140 110 25,flat,tab 7
  button "NICK INFO", 88, 190 105 110 25,flat,tab 7
  button "CHANNEL INFO", 89, 190 140 110 25,flat,tab 7
  button "CHANSERV", 92, 20 175 110 25,flat,tab 7
  button "MENU INFO", 93, 190 175 110 25,flat,tab 7
  button "Close", 12, 20 290 295 25,flat, cancel
  check "Relay-1",14, 20 70 80 20,tab 2
  check "Relay-2",15, 20 100 80 20,tab 2
  check "Relay-3",16, 20 130 80 20,tab 2
  check "Relay-4",17, 20 160 80 20,tab 2
  check "Nick Flood",18, 20 190 80 20,tab 2
  check "Quit Flood",19, 120 70 80 20,tab 2
  check "Chan Flood",20, 120 100 80 20,tab 2
  check "Dcc Flood",21, 120 130 80 20,tab 2
  check "Ctcp Flood",22, 120 160 80 20,tab 2
  check "Querie Flood",23, 120 190 80 20,tab 2
  check "Join FLood",24, 220 70 80 20,tab 2
  check "Mass FLood",25, 220 100 80 20,tab 2
  check "Letter Flood",26, 220 130 80 20,tab 2
  check "Word Flood",27, 220 160 80 20,tab 2
  check "Color Flood",28, 220 190 80 20,tab 2
  check "Rev Door",29, 20 70 80 20,tab 4
  check "Spam Bot",30, 20 100 80 20,tab 3
  check "Drone Bot",31, 20 130 80 20,tab 3
  check "Drone Nick",32, 20 160 80 20,tab 3
  check "Quit Bot",33, 20 190 80 20,tab 3
  check "Bad Away",34, 120 70 80 20,tab 3
  check "Bad Name",35, 120 100 80 20,tab 3
  check "Chan Notice",36, 120 130 80 20,tab 3
  check "Private Notice",37, 120 160 85 20,tab 3
  check "Notify BanList",38, 120 190 85 20,tab 3
  check "Trout Slap",39, 220 70 80 20,tab 3
  check "Nosense Nick",40, 220 100 85 20,tab 3
  check "Bad Script",41, 20 100 80 20,tab 4
  check "Auto Whois",42, 20 160 80 20,tab 4
  check "Ban Enforcer",55, 220 70 80 20,tab 4
  check "Spy Log",43, 20 70 80 20,tab 3
  check "Auto Op",44, 220 130 80 20,tab 3
  check "Mode Log",45, 20 130 80 20,tab 4
  check "Auto Unban",46, 220 160 80 20,tab 3
  check "Part Log",47, 20 190 80 20,tab 4
  check "Topic Log",48, 120 70 85 20,tab 4
  check "Kick Log",49, 120 100 80 20,tab 4
  check "Join Log",50, 120 130 80 20,tab 4
  check "Nick Log",51, 120 160 80 20,tab 4
  check "Quit Log",52, 120 190 80 20,tab 4
  check "Sticky Ban",53, 220 190 80 20,tab 3
  check "none",54, 220 100 80 20,tab 4
  text "Enter nick or channel to get info....",91, 22 40 200 20,tab 7
  box "",200, 20 220 290 50
  text "This Dialog helps you choose the protection or settings you need.",201, 40 230 230 30
  box "",202, 5 25 320 300
  check "Check or Uncheck All", 204, 20 39 116 25, tab 2
  check "Check or Uncheck All", 205, 20 39 116 25, tab 3
  check "Check or Uncheck All", 207, 20 39 116 25, tab 4
}

      On *:Dialog:popusn:*:*: {
      if ($devent == sclick) {
      if ($did == 204) { 
      did $+(-,$iif($did(204).state == 0,u,c)) $dname 14-28 
    }
    if ($did == 205) { 
      did $+(-,$iif($did(205).state == 0,u,c)) $dname 30-40
      did $+(-,$iif($did(205).state == 0,u,c)) $dname 43-44
      did $+(-,$iif($did(205).state == 0,u,c)) $dname 46
      did $+(-,$iif($did(205).state == 0,u,c)) $dname 53
    }
    if ($did == 207) { 
      did $+(-,$iif($did(207).state == 0,u,c)) $dname 29
      did $+(-,$iif($did(207).state == 0,u,c)) $dname 41-42
      did $+(-,$iif($did(207).state == 0,u,c)) $dname 45
      did $+(-,$iif($did(207).state == 0,u,c)) $dname 47-52
      did $+(-,$iif($did(207).state == 0,u,c)) $dname 54-55
    }
}
    if ($devent == init) {
    if (%Relay2 == on) { did -c $dname 14 }
    if (%Relay1 == on) { did -c $dname 15 }
    if (%Relay == on) { did -c $dname 16 }
    if (%Relay3 == on) { did -c $dname 17 }
    if (%longnick == on) { did -c $dname 18 }
    if (%quitpart == on) { did -c $dname 19 }
    if (%flood  == on) { did -c $dname 20 }
    if (%Dcc. == on) { did -c $dname 21 }
    if (%Ctcp. == on) { did -c $dname 22 }
    if (%Query. == on) { did -c $dname 23 }
    if (%opsjoin. == on) { did -c $dname 24 }
    if (%join == on) { did -c $dname 25 }
    if (%Letter  == on) { did -c $dname 26 }
    if (%word == on) { did -c $dname 27 }
    if (%cnt == on) { did -c $dname 28 }
    if (%door == on) { did -c $dname 29 }
    if (%bot == on) { did -c $dname 30 }
    if (%drone == on) { did -c $dname 31 }
    if (%drones == on) { did -c $dname 32 }
    if (%quit == on) { did -c $dname 33 }
    if (%away == on) { did -c $dname 34 }
    if (%name == on) { did -c $dname 35 }
    if (%notice == on) { did -c $dname 36 }
    if (%notice. == on) { did -c $dname 37 }
    if (%bnn == on) { did -c $dname 38 }
    if (%slap == on) { did -c $dname 39 }
    if (%op.nopsenseSW == on) { did -c $dname 40 }
    if (%CTCPREPLY  == on) { did -c $dname 41 }
    if (%op.random == on) { did -c $dname 42 }
    if (%spy.counter == on) { did -c $dname 43 }
    if (%deop == on) { did -c $dname 44 }
    if (%rawmode == on) { did -c $dname 45 }
    if (%unban == on) { did -c $dname 46 }
    if (%part.counter  == on) { did -c $dname 47 }
    if (%topic.counter == on) { did -c $dname 48 }
    if (%Kick.counter == on) { did -c $dname 49 }
    if (%join.counter == on) { did -c $dname 50 }
    if (%nick.counter == on) { did -c $dname 51 }
    if (%quit.counter == on) { did -c $dname 52 }
    if (%sticky.ban == on) { did -c $dname 53 }
    if (%none == on) { did -c $dname 54 }
    if (%ban == on) { did -c $dname 55 }
  }
  if ($devent == close) { call.popusn }
}

  alias call.popusn {
  if ($did(14).state == 1) { set %Relay2 on }
  else { set %relay2 off }
  if ($did(15).state == 1) { set %Relay1 on }
  else { set %relay1 off }
  if ($did(16).state == 1) { set %relay on }
  else { set %relay off }
  if ($did(17).state == 1) { set %relay3 on }
  else { set %relay3 off }
  if ($did(18).state == 1) { set %longnick on }
  else { set %longnick off }
  if ($did(19).state == 1) { set %quitpart on }
  else { set %quitpart off }
  if ($did(20).state == 1) { set %flood on }
  else { set %flood off }
  if ($did(21).state == 1) { set %dcc. on }
  else { set %dcc. off }
  if ($did(22).state == 1) { set %ctcp. on }
  else { set %ctcp. off }
  if ($did(23).state == 1) { set %query. on }
  else { set %query. off }
  if ($did(24).state == 1) { set %opsjoin. on }
  else { set %opsjoin. off }
  if ($did(25).state == 1) { set %join on }
  else { set %join off }
  if ($did(26).state == 1) { set %letter on }
  else { set %letter off }
  if ($did(27).state == 1) { set %word on }
  else { set %word off }
  if ($did(28).state == 1) { set %cnt on }
  else { set %cnt off }
  if ($did(29).state == 1) { set %door on }
  else { set %door off }
  if ($did(30).state == 1) { set %bot on }
  else { set %bot off }
  if ($did(31).state == 1) { set %drone on }
  else { set %drone off }
  if ($did(32).state == 1) { set %drones on }
  else { set %drones off }
  if ($did(33).state == 1) { set %quit on }
  else { set %quit off }
  if ($did(34).state == 1) { set %away on }
  else { set %away off }
  if ($did(35).state == 1) { set %name on }
  else { set %name off }
  if ($did(36).state == 1) { set %notice on }
  else { set %notice off }
  if ($did(37).state == 1) { set %notice. on }
  else { set %notice. off }
  if ($did(38).state == 1) { set %bnn on }
  else { set %bnn off }
  if ($did(39).state == 1) { set %slap on }
  else { set %slap off }
  if ($did(40).state == 1) { set %op.nopsenseSW on }
  else { set %op.nopsenseSW off }
  if ($did(41).state == 1) { set %CTCPREPLY on }
  else { set %CTCPREPLY off }
  if ($did(42).state == 1) { set %op.random on }
  else { set %op.random off }
  if ($did(43).state == 1) { set %spy.counter on }
  else { set %spy.counter off }
  if ($did(44).state == 1) { set %deop  on }
  else { set %deop off }
  if ($did(45).state == 1) { set %rawmode on }
  else { set %rawmode off }
  if ($did(46).state == 1) { set %unban on }
  else { set %unban off }
  if ($did(47).state == 1) { set %part.counter on }
  else { set %part.counter off }
  if ($did(48).state == 1) { set %topic.counter on }
  else { set %topic.counter off }
  if ($did(49).state == 1) { set %kick.counter on }
  else { set %kick.counter off }
  if ($did(50).state == 1) { set %join.counter on }
  else { set %join.counter off }
  if ($did(51).state == 1) { set %nick.counter on }
  else { set %nick.counter off }
  if ($did(52).state == 1) { set %quit.counter on }
  else { set %quit.counter off }
  if ($did(53).state == 1) { set %sticky.ban on }
  else { set %sticky.ban off }
  if ($did(54).state == 1) { set %none on }
  else { set %none off }
  if ($did(55).state == 1) { set %ban on }
  else { set %ban off }
}

  on 1:dialog:popusn:init:*:{
  if (%Relay2 == on) { did -c $dname 14 }
  if (%Relay1 == on) { did -c $dname 15 }
  if (%Relay == on) { did -c $dname 16 }
  if (%Relay3 == on) { did -c $dname 17 }
  if (%longnick == on) { did -c $dname 18 }
  if (%quitpart == on) { did -c $dname 19 }
  if (%flood  == on) { did -c $dname 20 }
  if (%Dcc. == on) { did -c $dname 21 }
  if (%Ctcp. == on) { did -c $dname 22 }
  if (%Query. == on) { did -c $dname 23 }
  if (%opsjoin. == on) { did -c $dname 24 }
  if (%join == on) { did -c $dname 25 }
  if (%Letter  == on) { did -c $dname 26 }
  if (%word == on) { did -c $dname 27 }
  if (%cnt == on) { did -c $dname 28 }
  if (%door == on) { did -c $dname 29 }
  if (%bot == on) { did -c $dname 30 }
  if (%drone == on) { did -c $dname 31 }
  if (%drones == on) { did -c $dname 32 }
  if (%quit == on) { did -c $dname 33 }
  if (%away == on) { did -c $dname 34 }
  if (%name == on) { did -c $dname 35 }
  if (%notice == on) { did -c $dname 36 }
  if (%notice. == on) { did -c $dname 37 }
  if (%bnn == on) { did -c $dname 38 }
  if (%slap == on) { did -c $dname 39 }
  if (%op.nopsenseSW == on) { did -c $dname 40 }
  if (%CTCPREPLY  == on) { did -c $dname 41 }
  if (%op.random == on) { did -c $dname 42 }
  if (%spy.counter == on) { did -c $dname 43 }
  if (%deop == on) { did -c $dname 44 }
  if (%rawmode == on) { did -c $dname 45 }
  if (%unban == on) { did -c $dname 46 }
  if (%part.counter  == on) { did -c $dname 47 }
  if (%topic.counter == on) { did -c $dname 48 }
  if (%Kick.counter == on) { did -c $dname 49 }
  if (%join.counter == on) { did -c $dname 50 }
  if (%nick.counter == on) { did -c $dname 51 }
  if (%quit.counter == on) { did -c $dname 52 }
  if (%sticky.ban == on) { did -c $dname 53 }
  if (%ban == on) { did -c $dname 57 }
}

on 1:dialog:popusn:sclick:70: {
  { set %St.nick $snick($active) |  /ul }
}
on 1:dialog:popusn:sclick:71: {
  { set %St.nick $snick($active) | /display }
}
on 1:dialog:popusn:sclick:72: {
  { set %St.nick $snick($active) | /setup }
}
on 1:dialog:popusn:sclick:73: {
  { set %St.nick $snick($active) | /nets }
}
on 1:dialog:popusn:sclick:74: {
  { set %St.nick $snick($active) | /prots }
}
on 1:dialog:popusn:sclick:75: {
  { set %St.nick $snick($active) | /opvhostdial }
}
on 1:dialog:popusn:sclick:76: {
  { set %St.nick $snick($active) | dialog -dmn Proxy Proxy }
}
on 1:dialog:popusn:sclick:77: {
  { set %St.nick $snick($active) |  /evsound }
}
on 1:dialog:popusn:sclick:78: {
  { set %St.nick $snick($active) | dialog -dmn BL.sd BL.sd  }
}
on 1:dialog:popusn:sclick:79: {
  { set %St.nick $snick($active) | dialog -dmn BL.bl BL.bl }
}
on 1:dialog:popusn:sclick:80: {
  { set %St.nick $snick($active) | mp3c }
}
on 1:dialog:popusn:sclick:81: {
  { set %St.nick $snick($active) | dialog -dmn iglist iglist }
}
on 1:dialog:popusn:sclick:82: {
  { set %St.nick $snick($active) | dialog -dmn opwatch opwatch }
}
on 1:dialog:popusn:sclick:83: {
  { set %St.nick $snick($active) | dialog -dmn SpamChannel SpamChannel }
}
on 1:dialog:popusn:sclick:84: {
  { set %St.nick $snick($active) | dialog -dmn spamk spamk }
}
on 1:dialog:popusn:sclick:85: {
  { set %St.nick $snick($active)  | dialog -dmn expbanchan expbanchan }
}
on 1:dialog:popusn:sclick:92: {
  { set %St.nick $snick($active)  | dialog -dmn cs cs }
}
on 1:dialog:popusn:sclick:95: {
  { set %St.nick $snick($active)  | dialog -dmn Opsscrean Opsscrean }
}
on 1:dialog:popusn:sclick:96: {
  { set %St.nick $snick($active)  | dialog -dmn  Dctrl  Dctrl }
}
on 1:dialog:popusn:sclick:93: {
  { set %St.nick $snick($active)  | dialog -dmn opcon opcon }
}



Last edited by Garou; 11/06/07 03:41 AM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ok, here is a hashtable method. As you can see, it's much shorter. As for faster, you'll have to try it out to see.

To check a setting later on, you will use:

$hget(popusn,ID)

ID is the ID in your dialog. If you'd prefer not to remember IDs while writing this, you could also add an alias to handle it for you, though that does increase the script size. See the code at the end for an alias if you want to use it.

Code:
dialog popusn {
  title "Settings"
  size -1 -1 333 330
  icon graphics\cfg.ico
  TAB "OPS1",2, 0 0 330 425
  TAB "OPS2",3
  TAB "OPS3",4
  TAB "OPS4",5
  TAB "OPS5",6
  TAB "OPS6",7
  edit "", 90, 20 70 295 25,push,tab 7
  button "Userlist Settings", 70, 20 70 110 25,flat,tab 5
  button "Display Settings", 71, 20 100 110 25,flat,tab 5
  button "General Settings", 72, 20 130 110 25,flat,tab 5
  button "Network Settings", 73, 20 160 110 25,flat,tab 5
  button "Channel Protections", 74, 20 190 110 25,flat,tab 5
  button "Vhost Scaner", 75, 190 70 110 25,flat,tab 5
  button "Proxy Scaner", 76, 190 100 110 25,flat,tab 5
  button "Sound Settings", 77, 190 130 110 25,flat,tab 5
  button "Blacklist Trigger", 78, 190 160 110 25,flat,tab 5
  button "Blacklist Settings", 79, 190 190 110 25,flat,tab 5
  button "MP3 Player", 80, 20 70 110 25,flat,tab 6
  button "Ignore List", 81, 20 100 110 25,flat,tab 6
  button "Spy Settings", 82, 20 130 110 25,flat,tab 6
  button "Whois Channel", 83, 20 160 110 25,flat,tab 6
  button "Unwanted Text", 84, 20 190 110 25,flat,tab 6
  button "Banned Channel", 85, 190 70 110 25,flat,tab 6
  button "Screan Flood", 95, 190 100 110 25,flat,tab 6
  button "Punctuation Flood", 96, 190 130 110 25,flat,tab 6
  button "DNS", 86, 20 105 110 25,flat,tab 7
  button "WHOIS", 87, 20 140 110 25,flat,tab 7
  button "NICK INFO", 88, 190 105 110 25,flat,tab 7
  button "CHANNEL INFO", 89, 190 140 110 25,flat,tab 7
  button "CHANSERV", 92, 20 175 110 25,flat,tab 7
  button "MENU INFO", 93, 190 175 110 25,flat,tab 7
  button "Close", 12, 20 290 295 25,flat, cancel
  text "Protection from spam and flood....",13, 22 40 200 20,tab 2
  check "Relay-1",14, 20 70 80 20,tab 2
  check "Relay-2",15, 20 100 80 20,tab 2
  check "Relay-3",16, 20 130 80 20,tab 2
  check "Relay-4",17, 20 160 80 20,tab 2
  check "Nick Flood",18, 20 190 80 20,tab 2
  check "Quit Flood",19, 120 70 80 20,tab 2
  check "Chan Flood",20, 120 100 80 20,tab 2
  check "Dcc Flood",21, 120 130 80 20,tab 2
  check "Ctcp Flood",22, 120 160 80 20,tab 2
  check "Querie Flood",23, 120 190 80 20,tab 2
  check "Join FLood",24, 220 70 80 20,tab 2
  check "Mass FLood",25, 220 100 80 20,tab 2
  check "Letter Flood",26, 220 130 80 20,tab 2
  check "Word Flood",27, 220 160 80 20,tab 2
  check "Color Flood",28, 220 190 80 20,tab 2
  check "Rev Door",29, 20 70 80 20,tab 3
  check "Spam Bot",30, 20 100 80 20,tab 3
  check "Drone Bot",31, 20 130 80 20,tab 3
  check "Drone Nick",32, 20 160 80 20,tab 3
  check "Quit Bot",33, 20 190 80 20,tab 3
  check "Bad Away",34, 120 70 80 20,tab 3
  check "Bad Name",35, 120 100 80 20,tab 3
  check "Chan Notice",36, 120 130 80 20,tab 3
  check "Private Notice",37, 120 160 85 20,tab 3
  check "Notify BanList",38, 120 190 85 20,tab 3
  check "Trout Slap",39, 220 70 80 20,tab 3
  check "Nosense Nick",40, 220 100 85 20,tab 3
  check "Bad Script",41, 220 130 80 20,tab 3
  check "Auto Whois",42, 220 160 80 20,tab 3
  check "Ban Enforcer",55, 220 190 80 20,tab 3
  check "Spy Log",43, 20 70 80 20,tab 4
  check "Auto Op",44, 20 100 80 20,tab 4
  check "Mode Log",45, 20 130 80 20,tab 4
  check "Auto Unban",46, 20 160 80 20,tab 4
  check "Part Log",47, 20 190 80 20,tab 4
  check "Topic Log",48, 120 70 85 20,tab 4
  check "Kick Log",49, 120 100 80 20,tab 4
  check "Join Log",50, 120 130 80 20,tab 4
  check "Nick Log",51, 120 160 80 20,tab 4
  check "Quit Log",52, 120 190 80 20,tab 4
  check "Sticky Ban",53, 220 70 80 20,tab 4
  check "none",54, 220 100 80 20,tab 4
  text "Protection from notice and bot flood....",206, 22 40 200 20,tab 3
  text "Protection and logs....",56, 22 40 200 20,tab 4
  text "Channel Protection....",59, 22 40 200 20,tab 5
  text "Channel Protection....",60, 22 40 200 20,tab 6
  text "Enter nick or channel to get info....",91, 22 40 200 20,tab 7
  box "",200, 20 220 290 50
  text "This Dialog helps you choose the protection or settings you need.",201, 40 230 230 30
  box "",202, 5 25 320 300
  check "Check/Uncheck all", 204, 208 39 116 20, tab 2
  check "Check/Uncheck all", 205, 208 39 116 20, tab 3
  check "Check/Uncheck all", 207, 208 39 116 20, tab 4
}

On *:Dialog:popusn:*:*: {
  if ($devent == sclick) {
    if ($did == 204) { 
      did $+(-,$iif($did(204).state == 0,u,c)) $dname 14-28 
    }
    if ($did == 205) { 
      did $+(-,$iif($did(205).state == 0,u,c)) $dname 29-42
      did $+(-,$iif($did(205).state == 0,u,c)) $dname 55
    }
    if ($did == 207) { 
      did $+(-,$iif($did(207).state == 0,u,c)) $dname 43-53
    }
  }
  if ($devent == init) {
    var %cnt = 14
    while (%cnt <= 55) {
      if ($hget(popusn,%cnt) == On) { did -c $dname %cnt }
      inc %cnt
    }
  }
  if ($devent == close) { call.popusn }
}

alias call.popusn {
  if (!$hget(popusn)) {
    hmake popusn 10
    if ($exists($scriptdir\popusn.hsh)) { hload popusn $scriptdir\popusn.hsh }
  }
  var %cnt = 14
  while (%cnt <= 55) {
    if ($did(%cnt).state == 1) { hadd popusn %cnt On }
    else { hadd popusn %cnt Off }
    inc %cnt
  }
  hsave popusn $scriptdir\popusn.hsh
}


Here's an optional alias to make it easier to get a setting value for a specific item without remembering the ID.

Code:
alias get.popusn {
  if (!$1) { echo -a ERROR: Invalid format.  Use $get.popusn(name) | return }
  var %names = Relay2,Relay1,Relay,Relay3,longnick,quitpart,flood,dcc.,ctcp.,query,opsjoin,join,Letter,word,cnt,door,bot,drone,drones,quit,away,name,notice,notice.,bnn,slap,op.nopsenseSW,CTCPREPLY,op.random,spy.counter,deop,rawmode,unban,part.counter,topic.counter,Kick.counter,join.counter,nick.counter,quit.counter,sticky.ban,none,ban
  var %ID = $calc($gettok(%names,$findtok(%names,$1,44),44) + 13)
  if (!%ID) { return Error: Invalid name. }
  return $hget(popusn,%ID)
}


To use that alias to get a setting's value, use:
$get.popusn(name)

Example:
$get.popusn(unban)

The names match what you were using in your script. You can change them if you want by changing the names in the %names alias.

Last edited by Riamus2; 11/06/07 04:09 PM.

Invision Support
#Invision on irc.irchighway.net
Page 1 of 2 1 2

Link Copied to Clipboard