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