Zion Sphinx — File Browser

ZionSphinxv3.0 / ZionSphinxv3.0 / zionoptions.mrc

zionoptions.mrc — 48.21 KB — Download this file

; --------< Zion >----------------------------------------------------
; Name....: Zion Options
; File....: zionoptions.mrc
; Ver.....: 1.0b130807
; Author..: sprion
; Email...: sprion@lyniq.com
; Date....: 13 Aug 07
; URL.....: http://zinc.sg
; Info....: Options Dialog
; Changes.: Fixed the Unload button bug.;Using $ z.goodsv identifier.
;---------------------------------------------------------------------
;translatable

; to switch back to 'ipaddress control' find the quoted text, see war3 gameset too
; script unload signal
on *:signal:zion_unload:.unload -rs $+(",$script,")
on *:signal:zion_plugin_load:if ($dialog(z.options)) .timer 1 0 z.opt.refreshlist z.options $1-
on *:signal:zion_plugin_unload:if ($dialog(z.options)) .timer 1 0 z.opt.refreshlist z.options $1-

on *:signal:zion_cmdlistopen:{
  zion.listcmd z.options ; Opens the Options Dialog. ; /z.options [-default|-gameoptions|-snooping|-plugs] ; /z.options -snooping
}


on *:load:if ((!$dcx(IsUsingGDI)) && ($z.pop($z.lang(options,nogdiprompt),$z.lang(options,header_nogdi),1,48,0,0) = 1)) { var %i http://dcx.scriptsdb.org/gdiplus.zip | run %i | z.echo $z.head(err) $z.lang(options,nogdi) %i }

alias zion.options.id return ZOPTIONS.1b130807

alias z.options {
  var %v z.options
  %zion.s.opt.para = $1-
  if ($dialog(%v)) {
    if ($1 != -gameoptions) z.echo $z.head(err) $z.lang(options,fail)
  }
  else dialog -m %v %v
}

dialog z.options {
  title $z.lang(options,name)
  size -1 -1 480 400
}

ON *:DIALOG:z.options:*:*: {
  
  if ( $devent == init ) {
    dll_mc SetIcon -w $dialog($dname).hwnd 3 $z.icl
    dcx Mark $dname z.options_cb
    xdialog -b $dname +hty
    _init
    ; plugins/games
    .signal -n zion_options
  }
  
}

; [DIALOG] [EVENT] [ID] [PARMS]
alias z.options_cb {
  
  if ( $2 == sizing || $2 == moving ) { return }
  if ( $2 == max ) return
  
;  echo -s 1: $1 - 2: $2 - 3: $3 - 4: $4-
  
  ; capture rebar changing size
  if ( $2 == change && $3 == 1 ) {
    
    if ( $xdialog( $1, 100 ).isid ) {
      var %s = $xdid( $1, 100 ).pos
      xdialog -l $1 space root $chr(9) + 0 $calc($5 + 2) 0 $calc( $gettok( %s, 4, 32 ) - 2 )
    }
    else {
      xdialog -l $1 space root $chr(9) + 0 $calc($5 + 2) 0 0
    }
    xdialog -l $1 update
  }
  
  ; capture toolbar switching
  if ( $2 = sclick ) {
    if $3 = 1 {
      var %i 5,%c 1
      while (%c <= %i) {
        if (%c != $4) {
        ; depress & hide associated box
          xdid -t $1 1 %c -p
          xdid -h $1 $+(%c,00)
        }
        inc %c
      }
    ; press & show box
      xdid -t $1 1 $4 +p
      xdid -s $1 $+($4,00)
      %zion.s.opt.help = options.htm# $+ $4
    }
    ; ok
;    z.options - 2: sclick - 3: 998
; z.options_cb z.options sclick 998
    elseif $3 = 998 {
      xdialog -h $1
      _savesettings $1
      .signal -n zion_options_save
      .timer 1 0 dialog -x $1
      if (%z.i.inst) z.inst.iall
    }
    ; cancel
    elseif $3 = 997 {
      dialog -x $1
    }
    ; notify checkbox
    elseif $3 = 323 {
      var %e $iif($xdid($1, $3).state,-e,-b)
      xdid %e $1 324
      xdid %e $1 325
    }
    ; exclude checkbox
    elseif $3 = 327 {
      xdid $iif($xdid($1, $3).state,-e,-b) $1 328
    }
    ; add channel
    elseif $3 = 313 {
      z.options_addchan
    }
    ; delete
    elseif $3 = 314 {
      var %s $gettok($xdid($1, 312).selpath,1,32)
      if (%s) {
        if %s = 1 return
        if ($z.pop($z.lang(options,deletechan) $xdid($1, 312, %s).text $+ ?,$z.lang(options,confirm),4,32,0,0) = 6) {
          xdid -d $1 312 %s
        }
      }
    }
    ; selecting plugins/gamesets
;1: z.options - 2: sclick - 3: 401 - 4: 1 1
    elseif $3 = 401 {
      if (!$4) return
      var %s = $xdid($1, $3, $4-).tooltip,%d %zion.s.opt.current
      if ((%s != -) && (%zion.s.opt.sel != %s)) {
;        if ($xdialog($1,450).isid) xdid -d z.options 400 450
        .signal zion_options_sel $+(%s,|,%zion.s.opt.sel)
        %zion.s.opt.sel = %s
        if (%d) { .timer 1 0 xdid -h $1 %d }
        .timerz.options.nodock -om 1 50 _undocked %s
        
        if ($script($+(",%s,"))) { xdid -e $1 404 | xdid -b $1 403 }
        else { xdid -b $1 404 | xdid -e $1 403 }
      }
    }
    elseif $3 = 403 {
      if ($isfile($+(",%zion.s.opt.sel,"))) {
        .load -rs $+(",%zion.s.opt.sel,")
        unset %zion.s.opt.sel
      }
      else z.echo $z.head(err) $z.lang(options,noselection)
    }
    elseif $3 = 404 {
      if ($script($+(",%zion.s.opt.sel,"))) {
        if ($z.pop($z.lang(options,confirmunload) ' $+ $z.fileinfo(%zion.s.opt.sel,Name) $+ '?,$z.lang(options,confirm),1,48,256,0) = 1) {
          .unload -rs $+(",%zion.s.opt.sel,")
          unset %zion.s.opt.sel
        }
      }
      else z.echo $z.head(err) $z.lang(options,noselection)
    }
    elseif $3 = 405 run $+(http://,$z.forumhost,/viewforum.php?f=4)
    
    elseif ($3 = 524) { dialog -x $1 | zion.install repair }
    elseif ($3 = 523) { if ($z.pop($z.lang(options,confirmrepair),$z.lang(options,header_repair),1,48,256,0) = 1) { dialog -x $1 | z.remsettings | zion.install repair } }
    elseif ($3 = 504) z.options_proxy
    ; check ip now
    elseif ($3 = 216) { var %r $z.pop($z.lang(options,yourip) $z.ip(-r),$z.lang(options,extip),0,48,0,0) | xdid -ra $1 215 $z.ip }
    
    elseif ($3 = 143) {
      var %v zion_friends
      if ($isalias(%v)) %v
      else %v = $input($z.lang(err,mfriends),owd,$z.lang(err,oops))
    }
    elseif ($3 = 163) {
      if ($xdid($1,162,1).sel) z.splay $ifmatch
    }
    elseif ($3 = 130) run $z.privacystatement
    elseif ($3 = 169) run $z.registerdoc
    elseif ($3 = 170) run $+(http://,$z.host,/donate/donate.html)
    elseif ($3 = 996) z.help %zion.s.opt.help
    elseif ($3 = 121) { if ($4) %zion.s.opt.help = options.htm#1_ $+ $4 }
    elseif ($3 = 131) zion_user_auth -ma
    elseif ($3 = 132) {
      if (($z.started) && ($input($z.lang(options,confirmlogout),yqv,$z.lang(options,header_logout)) = $no)) return
      z.deauth | xdid -b $1 132 | xdid -e $1 131
    }
  }
  
  elseif ( $2 = dclick ) {
    ; 1: z.options - 2: dclick - 3: 162 - 4: 2
    ; sound event
    if ($3 = 162) {
      var %f $$sfile($+(",$scriptdir,fx\,"),$z.lang(options,selectsound),$z.lang(options,select))
      if ($scriptdir isin $nofile(%f)) %f = $remove(%f,$scriptdir)
      xdid -v $1 $3 $4 1 %f
    }
  }
  
  
  elseif ( $2 = stateclick ) {
    ; capture snoop chan
;    if (( $3 = 312 ) && ( $4- = 1 1 1 )) .timer 1 0 xdid -k $1 $3 2 1 1
    
  }
  
;  1: z.options - 2: close - 3: 0 - 4:
  ;.timerzion.s.opt.close 1 0
  if ( $2 = close ) { .signal -n zion_options_end | _closealldocks | unset %zion.s.opt.* | .timerz.options.* off }
  
}
alias _scriptpath {
  var %p,%n = $xdid($1,401,$chr(9) $z.fileinfo($2,Name) $chr(9),W,0).find
  while (%n > 0) {
    %p = $xdid($1,401,$chr(9) $z.fileinfo($2,Name) $chr(9),W,%n).find
    if ($xdid($1,401,%p).tooltip = $2) return %p
    dec %n
  }
  return 0
}
alias -l _closealldocks {
  var %n $numtok(%zion.s.opt.closeonend,44)
  while (%n > 0) {
    .timer 1 0 xdialog -x $gettok(%zion.s.opt.closeonend,%n,44)
    dec %n
  }
}
alias z.options.pbg return $rgb(216,227,236)

alias z.options.bg return $rgb(226,231,193)
alias z.options.bg2 return $rgb(228,231,212)
alias z.options.bg2_ return $rgb(92,93,81)
alias -l _init {
  var %d $dname
;  var %pbg $z.options.pbg
  var %bg $z.options.bg
  var %bg2 $z.options.bg2
;    var %bg2 $rgb(200,207,149)
  var %bg2_ $z.options.bg2_
  
  
    ; bgcolor
;    xdialog -g %d +b %pbg
  
  
    ; TOOLBAR
    ; creating toolbar
  xdialog -c %d 999 panel 0 0 480 60
  xdid -C %d 999 +bkt $rgb(255,255,255)
  
  xdid -c %d 999 1 toolbar 0 0 1 1 top group flat transparent
  xdid -f %d 1 +a ansi 8 Tahoma
  
    ; setting icon size
  xdid -l %d 1 32
  
    ; adding icons
  xdid -w %d 1 +nh 4 $z.icl
  xdid -w %d 1 +nh 5 $z.icl
  xdid -w %d 1 +nh 6 $z.icl
  xdid -w %d 1 +nh 7 $z.icl
  xdid -w %d 1 +nh 8 $z.icl
  
    ; adding items
  xdid -a %d 1 0 +plbc 63 1 0 $z.lang(options,personal) $chr(9) hello
  xdid -a %d 1 0 +lbc 73 2 0 $z.lang(options,general) $chr(9) hello
  xdid -a %d 1 0 +lbc 70 3 0 $z.lang(options,snooping2) $chr(9) hello
  xdid -a %d 1 0 +lbc 105 4 0 $z.lang(options,plugs) $chr(9) hello
  xdid -a %d 1 0 +lbc 78 5 0 $z.lang(options,advanced) $chr(9) hello
  
  xdialog -c %d 998 button 230 365 70 25
  xdid -f %d 998 +a ansi 8 tahoma
  xdid -t %d 998 $z.lang(options,ok)
  
  xdialog -c %d 997 button 310 365 70 25
  xdid -f %d 997 +a ansi 8 tahoma
  xdid -t %d 997 $z.lang(options,cancel)
  
  xdialog -c %d 996 button 390 365 70 25
  xdid -f %d 996 +a ansi 8 tahoma
  xdid -t %d 996 $z.lang(options,help)
  
  
    ; BOX
    ; creating dummy box
;    xdialog -c %d 100 box 0 54 480 500
;    xdialog -c %d 999 box 0 55 480 500
    ; setting bg color
;    xdid -C %d 999 +bkt %bg
  
  
  
    ; BOX
    ; creating personal panel
  xdialog -c %d 100 panel 0 55 480 305
    ; setting bg color
;  xdid -C %d 100 +b %pbg
  xdid -C %d 100 +kt %bg
  
  
      ; text
  xdid -c %d 100 122 text 10 10 460 30
;      xdialog -c %d 22 text 10 10 460 30
  xdid -f %d 122 +a ansi 8 Tahoma
  xdid -t %d 122 $z.lang(options,personalmsg)
;  xdid -C %d 122 +kb %pbg
;  xdid -C %d 122 +t %bg2_
  
  
      ;$z.lang(inst,badver)
  
    ; personal tabs
  xdid -c %d 100 121 tab 10 50 460 250 rightjustify
;      xdialog -c %d 21 tab 10 50 460 250
  xdid -C %d 121 +bkt %bg2
;      xdid -C %d 121 +bkt %bg2_
  xdid -f %d 121 +a ansi 8 tahoma
  
  xdid -a %d 121 0 0 $z.lang(options,myaccount) $chr(9) 150 panel 10 10 450 240
  
  xdid -a %d 121 0 0 $z.lang(options,friends) $chr(9) 151 panel 10 10 450 240
  xdid -a %d 121 0 0 $z.lang(options,sounds) $chr(9) 152 panel 10 10 450 240
  xdid -a %d 121 0 0 $z.lang(options,reg) $chr(9) 153 panel 10 10 450 240
  
  
        ; my details tab
  xdid -C %d 150 +b %bg2
;        xdid -C %d 150 +t %bg2_
  
  xdid -c %d 150 126 text 40 10 250 20
  xdid -f %d 126 +ab ansi 8 tahoma
  xdid -C %d 126 +kb %bg2
  xdid -C %d 126 +t %bg2_
  xdid -t %d 126 $z.lang(options,typename)
  
  xdid -c %d 150 127 edit 40 30 150 20 disabled
  xdid -f %d 127 +a ansi 8 arial
  
  xdid -c %d 150 128 text 40 70 250 80
  xdid -f %d 128 +a ansi 8 tahoma
  xdid -C %d 128 +kb %bg2
  xdid -C %d 128 +t %bg2_
  xdid -t %d 128 $z.lang(options,loggedin)
  
  xdid -c %d 150 131 button 300 70 125 25
  xdid -f %d 131 +a ansi 8 tahoma
  xdid -t %d 131 $z.lang(options,setlogin)
  
  xdid -c %d 150 132 button 300 100 125 25
  xdid -f %d 132 +a ansi 8 tahoma
  xdid -t %d 132 $z.lang(options,remlogin)
  
  
  xdid -c %d 150 130 button 40 160 140 25
  xdid -f %d 130 +a ansi 8 tahoma
  xdid -t %d 130 $z.lang(options,viewprivstate)
  
  
        ; friends tab
  xdid -C %d 151 +b %bg2
  
  xdid -c %d 151 141 text 40 10 400 40
  xdid -f %d 141 +a ansi 8 tahoma
  xdid -C %d 141 +kb %bg2
  xdid -C %d 141 +t %bg2_
  xdid -t %d 141 $z.lang(options,friendsmsg)
  
  xdid -c %d 151 142 check 45 45 300 20
  xdid -f %d 142 +a ansi 8 tahoma
  xdid -C %d 142 +kb %bg2
  xdid -C %d 142 +t %bg2_
  xdid -t %d 142 $z.lang(options,alwaysprompt)
  
  xdid -c %d 151 143 button 40 160 95 25
  xdid -f %d 143 +a ansi 8 tahoma
  xdid -t %d 143 $z.lang(options,viewfriendsl)
  
  xdid -c %d 151 144 text 40 80 400 40
  xdid -f %d 144 +a ansi 8 tahoma
  xdid -C %d 144 +kb %bg2
  xdid -C %d 144 +t %bg2_
  xdid -t %d 144 $z.lang(options,zionnotify)
  
  xdid -c %d 151 145 check 45 115 280 20
  xdid -f %d 145 +a ansi 8 tahoma
  xdid -C %d 145 +kb %bg2
  xdid -C %d 145 +t %bg2_
  xdid -t %d 145 $z.lang(options,allowinvis)
  
  
        ; sounds tab
  xdid -C %d 152 +b %bg2
  
  xdid -c %d 152 171 text 40 10 400 40
  xdid -f %d 171 +a ansi 8 tahoma
  xdid -C %d 171 +kb %bg2
  xdid -C %d 171 +t %bg2_
  xdid -t %d 171 $z.lang(options,soundsmsg)
  
  xdid -c %d 152 162 listview 45 45 385 125 report checkbox tooltip
  xdid -C %d 162 +kb %bg2
  xdid -f %d 162 +a ansi 8 tahoma
  
  xdid -t %d 162 +c 0 140 Event $chr(9) +l 0 230 Sound File
  
  var %tt C:\ILoveZion.wav,%t1 xdid -a %d 162 0 0 +cbk 0 1 0 0 %bg2_ -1,%t2 xdid -a %d 162 0 0 +cbk 0 1 0 0 %bg2_ %bg
  %t1 $z.lang(options,welcome) $chr(9) + 0 %tt
  %t2 $z.lang(options,firstgame) $chr(9) + 0 %tt
  %t1 $z.lang(options,fronline) $chr(9) + 0 %tt
;  xdid -a %d 162 0 0 +cbk 0 1 0 0 %bg2_ %bg Friend In Game $chr(9) + 0 %tt
;  xdid -a %d 162 0 0 +cbk 0 1 0 0 %bg2_ -1 Friend Joins Game $chr(9) + 0 %tt
;  xdid -a %d 162 0 0 +cbk 0 1 0 0 %bg2_ %bg Friend Parts Game $chr(9) + 0 %tt
  %t2 $z.lang(options,listed) $chr(9) + 0 %tt
  %t1 $z.lang(options,gamefound) $chr(9) + 0 %tt
  %t2 $z.lang(options,gamefull) $chr(9) + 0 %tt
  %t1 $z.lang(options,starting) $chr(9) + 0 %tt
  %t2 $z.lang(options,started) $chr(9) + 0 %tt
  %t1 $z.lang(options,maploaded) $chr(9) + 0 %tt
  %t1 $z.lang(options,leaver) $chr(9) + 0 %tt
  %t1 $z.lang(options,cheater) $chr(9) + 0 %tt
  %t1 $z.lang(options,reminder) $chr(9) + 0 %tt
  
  
  xdid -c %d 152 163 button 360 180 70 25
  xdid -f %d 163 +a ansi 8 tahoma
  xdid -t %d 163 $z.lang(options,playsound)
  
        ; registration tab
  xdid -C %d 153 +b %bg2
  
  if (!$isalias(z.reg.display)) {
    xdid -c %d 153 161 text 40 10 400 30
    xdid -f %d 161 +a ansi 8 tahoma
    xdid -C %d 161 +kb %bg2
    xdid -C %d 161 +t %bg2_
    xdid -t %d 161 $z.lang(options,registermsg)
    
    
    xdid -c %d 153 1710 text 40 55 400 100
    xdid -f %d 1710 +a ansi 8 tahoma
    xdid -C %d 1710 +kb %bg2
    xdid -C %d 1710 +t %bg2_
    xdid -t %d 1710 $z.lang(options,bonus)
    
    xdid -c %d 153 1711 text 250 55 400 100
    xdid -f %d 1711 +a ansi 8 tahoma
    xdid -C %d 1711 +kb %bg2
    xdid -C %d 1711 +t %bg2_
    xdid -t %d 1711 $z.lang(options,bonus2)
    
    xdid -c %d 153 164 text 40 140 370 20 center
    xdid -f %d 164 +ab ansi 8 tahoma
    xdid -C %d 164 +kb %bg2
    xdid -t %d 164 $z.lang(options,notregistered)
    
    xdid -c %d 153 169 button 340 170 90 25
    xdid -f %d 169 +a ansi 8 tahoma
    xdid -t %d 169 $z.lang(options,registernow)
    
    xdid -c %d 153 170 button 278 170 57 25
    xdid -f %d 170 +a ansi 8 tahoma
    xdid -t %d 170 $z.lang(options,donate)
    
  }
  else z.reg.display %d
  
  
;        xdid -h %d 151
    ; BOX
    ; creating general panel
  xdialog -c %d 200 panel 0 55 480 305
    ; setting bg colors
;  xdid -C %d 200 +b %pbg
  xdid -C %d 200 +kt %bg
  
  xdid -h %d 200
  
    ; general box items 200
      ; default server box 11
  xdid -c %d 200 211 box 10 15 460 90
  xdid -C %d 211 +b %bg2
  xdid -C %d 211 +kt %bg2_
  xdid -f %d 211 +a ansi 8 Tahoma
;      xdid -t %d 11 Default Server (Ctrl+F12)
  
        ; default server label
  xdid -c %d 211 208 text 7 3 200 20
  xdid -C %d 208 +kb %bg2
  xdid -C %d 208 +t %bg2_
  xdid -f %d 208 +ab ansi 7 Tahoma
  xdid -t %d 208 $z.lang(options,defserver) (Ctrl+F12)
  
        ; text
  xdid -c %d 211 209 text 20 20 400 35
  xdid -C %d 209 +kb %bg2
  xdid -C %d 209 +t %bg2_
  xdid -f %d 209 +a ansi 8 Tahoma
  xdid -t %d 209 $z.lang(options,defservermsg)
  
        ; irc server
  xdid -c %d 211 204 comboex 90 55 200 250 group dropedit tabstop
  xdid -f %d 204 +a ansi 8 arial
  
  
        ; irc server label
  xdid -c %d 211 205 text 20 60 70 20
  xdid -C %d 205 +kb %bg2
  xdid -C %d 205 +t %bg2_
  xdid -f %d 205 +ab ansi 8 Tahoma
  xdid -t %d 205 $z.lang(options,ircserver)
  
        ; irc port label
  xdid -c %d 211 206 text 320 60 30 20
  xdid -C %d 206 +kb %bg2
  xdid -C %d 206 +t %bg2_
  xdid -f %d 206 +ab ansi 8 Tahoma
  xdid -t %d 206 $z.lang(options,port)
  
        ; irc port
  xdid -c %d 211 207 edit 358 55 80 23
  xdid -f %d 207 +a ansi 8 arial
  
      ; external IP
  xdid -c %d 200 212 box 10 120 460 90
  xdid -C %d 212 +b %bg2
  xdid -C %d 212 +kt %bg2_
  xdid -f %d 212 +a ansi 8 Tahoma
  
        ; external ip label
  xdid -c %d 212 213 text 7 3 200 20
  xdid -C %d 213 +kb %bg2
  xdid -C %d 213 +t %bg2_
  xdid -f %d 213 +ab ansi 7 Tahoma
  xdid -t %d 213 $z.lang(options,extip)
  
        ; ip label
  xdid -c %d 212 214 text 20 60 70 20
  xdid -C %d 214 +kb %bg2
  xdid -C %d 214 +t %bg2_
  xdid -f %d 214 +ab ansi 8 Tahoma
  xdid -t %d 214 $z.lang(options,ipadd)
  
; ipaddress control
  xdid -c %d 212 215 ipaddress 90 57 150 20
;  xdid -c %d 212 215 edit 90 57 150 20
  xdid -f %d 215 +ab ansi 8 arial
  
        ; lookup button
  xdid -c %d 212 216 button 367 57 70 25
  xdid -f %d 216 +a ansi 8 tahoma
  xdid -t %d 216 $z.lang(options,checknow)
  
        ; text
  xdid -c %d 212 217 text 20 20 400 30
  xdid -C %d 217 +kb %bg2
  xdid -C %d 217 +t %bg2_
  xdid -f %d 217 +a ansi 8 Tahoma
  xdid -t %d 217 $z.lang(options,ipaddmsg)
  
  
  
  
  
      ; language
  xdid -c %d 200 221 box 10 225 460 60
  xdid -C %d 221 +b %bg2
  xdid -C %d 221 +kt %bg2_
  xdid -f %d 221 +a ansi 8 Tahoma
  
        ; lang label
  xdid -c %d 221 222 text 7 3 200 20
  xdid -C %d 222 +kb %bg2
  xdid -C %d 222 +t %bg2_
  xdid -f %d 222 +ab ansi 7 Tahoma
  xdid -t %d 222 Language/ÓïÑÔ
  
        ; ip label
  xdid -c %d 221 223 text 20 25 120 20
  xdid -C %d 223 +kb %bg2
  xdid -C %d 223 +t %bg2_
  xdid -f %d 223 +ab ansi 8 Tahoma
  xdid -t %d 223 $z.lang(options,selectlang)
  
        ; irc server
  xdid -c %d 221 224 comboex 130 20 170 250 group dropdown tabstop
  xdid -f %d 224 +a ansi 8 arial
  
  
    ; creating snooping panel
  xdialog -c %d 300 panel 0 55 480 305
    ; setting bg colors
;  xdid -C %d 300 +b %pbg
  xdid -C %d 300 +kt %bg
  xdid -h %d 300
  
          ; channels box 11
  xdid -c %d 300 311 box 10 15 460 120
  xdid -C %d 311 +b %bg2
  xdid -C %d 311 +kt %bg2_
  xdid -f %d 311 +a ansi 8 Tahoma
;      xdid -t %d 11 Channels
  
        ; channels label
  xdid -c %d 311 308 text 7 3 200 20
  xdid -C %d 308 +kb %bg2
  xdid -C %d 308 +t %bg2_
  xdid -f %d 308 +ab ansi 7 Tahoma
  xdid -t %d 308 $z.lang(options,channels)
  
        ; tree view
  xdid -c %d 311 312 treeview 20 25 200 80 checkbox hasbuttons singleexpand haslines showsel
  
  .timerz.options.c 1 0 xdid -c %d 312 1
  
        ; text
  xdid -c %d 311 315 text 240 25 200 50
  xdid -C %d 315 +kb %bg2
  xdid -C %d 315 +t %bg2_
  xdid -f %d 315 +a ansi 8 Tahoma
  xdid -t %d 315 $z.lang(options,snoopingmsg)
  
        ; add button
  xdid -c %d 311 313 button 257 80 80 25
  xdid -f %d 313 +a ansi 8 tahoma
  xdid -t %d 313 $z.lang(options,addchan)
  
        ; rem button
  xdid -c %d 311 314 button 347 80 90 25
  xdid -f %d 314 +a ansi 8 tahoma
  xdid -t %d 314 $z.lang(options,remchan)
  
          ; notify box 11
  xdid -c %d 300 321 box 10 145 460 155
  xdid -C %d 321 +b %bg2
  xdid -C %d 321 +kt %bg2_
  xdid -f %d 321 +a ansi 8 Tahoma
;      xdid -t %d 11 Channels
  
        ; notify label
  xdid -c %d 321 322 text 7 3 200 20
  xdid -C %d 322 +kb %bg2
  xdid -C %d 322 +t %bg2_
  xdid -f %d 322 +ab ansi 7 Tahoma
  xdid -t %d 322 $z.lang(options,gamelistopt)
  
        ; text
  xdid -c %d 321 326 text 20 20 400 20
  xdid -C %d 326 +kb %bg2
  xdid -C %d 326 +t %bg2_
  xdid -f %d 326 +a ansi 8 Tahoma
  xdid -t %d 326 $z.lang(options,notifymsg)
  
  xdid -c %d 321 323 check 25 40 200 20
  xdid -C %d 323 +kb %bg2
  xdid -C %d 323 +t %bg2_
  xdid -f %d 323 +a ansi 8 Tahoma
  xdid -t %d 323 $z.lang(options,notifywhen)
  
  xdid -c %d 321 324 comboex 37 65 85 100 dropdown
  xdid -a %d 324 0 0 0 0 0 $z.lang(options,containsany)
  xdid -a %d 324 0 0 0 0 0 $z.lang(options,matches)
  xdid -a %d 324 0 0 0 0 0 $z.lang(options,haswords)
  
;        xdid -C %d 324 +kb %bg2
;        xdid -C %d 324 +t %bg2_
  xdid -f %d 324 +a ansi 8 arial
;        xdid -t %d 324 Notify me when game description
  
  xdid -c %d 321 325 edit 130 65 312 23 autohs
  xdid -f %d 325 +a ansi 8 arial
  
  
  xdid -c %d 321 327 check 25 95 410 20
  xdid -C %d 327 +kb %bg2
  xdid -C %d 327 +t %bg2_
  xdid -f %d 327 +a ansi 8 Tahoma
  xdid -t %d 327 $z.lang(options,excludemsg)
  
  xdid -c %d 321 328 edit 37 120 405 23 autohs
  xdid -f %d 328 +a ansi 8 arial
  
  
    ; creating plugins/games panel
  xdialog -c %d 400 panel 0 55 480 305
    ; setting bg colors
;  xdid -C %d 400 +b %pbg
  xdid -C %d 400 +kt %bg
  xdid -h %d 400
  
        ; tree view
  xdid -c %d 400 401 treeview 10 15 125 242 checkbox hasbuttons haslines showsel
  xdid -x %d 401 +d
  
  xdid -c %d 400 402 text 155 25 350 25
  xdid -t %d 402 $z.lang(options,selectplugin)
;  xdid -C %d 402 +kb %bg2
;  xdid -C %d 402 +t %bg2_
  xdid -f %d 402 +a ansi 8 Tahoma
  
  xdid -c %d 400 403 button 90 262 45 25
  xdid -f %d 403 +a ansi 8 tahoma
  xdid -t %d 403 $z.lang(options,load)
  
  xdid -c %d 400 404 button 10 262 55 25
  xdid -f %d 404 +a ansi 8 tahoma
  xdid -t %d 404 $z.lang(options,unload)
  
  
  xdid -c %d 400 405 link 10 289 128 20 tabstop
  xdid -t %d 405 $z.lang(options,plugsforum)
  xdid -f %d 405 +a ansi 8 Tahoma
  
  
  ; info box
  xdid -c %d 400 410 box 155 50 305 240
  xdid -C %d 410 +b %bg2
;  xdid -C %d 410 +b 0
  xdid -C %d 410 +kt %bg2_
  xdid -f %d 410 +a ansi 8 Tahoma
  xdid -h %d 410
  
  ; info header
  xdid -c %d 410 411 text 7 3 200 20 noprefix
  xdid -C %d 411 +kb %bg2
  xdid -C %d 411 +t %bg2_
  xdid -f %d 411 +ab ansi 7 Tahoma
  xdid -t %d 411 $z.lang(options,info)
  
  ; name
  xdid -c %d 410 412 text 20 65 180 20 noprefix
  xdid -C %d 412 +kb %bg2
  xdid -C %d 412 +t %bg2_
  xdid -f %d 412 +a ansi 8 Tahoma
  xdid -t %d 412 $z.lang(options,fname)
  
  ; file
  xdid -c %d 410 413 text 20 90 275 30 noprefix pathellipsis
  xdid -C %d 413 +kb %bg2
  xdid -C %d 413 +t %bg2_
  xdid -f %d 413 +a ansi 8 Tahoma
  xdid -t %d 413 $z.lang(options,ffile)
  
  ; ver
  xdid -c %d 410 414 text 205 65 90 20 noprefix
  xdid -C %d 414 +kb %bg2
  xdid -C %d 414 +t %bg2_
  xdid -f %d 414 +a ansi 8 Tahoma
  xdid -t %d 414 $z.lang(options,fver)
  
  ; author
  xdid -c %d 410 415 text 20 120 170 20 noprefix
  xdid -C %d 415 +kb %bg2
  xdid -C %d 415 +t %bg2_
  xdid -f %d 415 +a ansi 8 Tahoma
  xdid -t %d 415 $z.lang(options,fauthor)
  
  ; email
  xdid -c %d 410 416 text 20 145 275 20 noprefix
  xdid -C %d 416 +kb %bg2
  xdid -C %d 416 +t %bg2_
  xdid -f %d 416 +a ansi 8 Tahoma
  xdid -t %d 416 $z.lang(options,femail)
  
  ; date
  xdid -c %d 410 417 text 195 120 100 20
  xdid -C %d 417 +kb %bg2
  xdid -C %d 417 +t %bg2_
  xdid -f %d 417 +a ansi 8 Tahoma
  xdid -t %d 417 $z.lang(options,fdate)
  
  ; url
  xdid -c %d 410 418 text 20 170 275 20 noprefix
  xdid -C %d 418 +kb %bg2
  xdid -C %d 418 +t %bg2_
  xdid -f %d 418 +a ansi 8 Tahoma
  xdid -t %d 418 $z.lang(options,furl)
  
  ; info
  xdid -c %d 410 419 text 20 20 280 40 noprefix
  xdid -C %d 419 +kb %bg2
  xdid -C %d 419 +t %bg2_
  xdid -f %d 419 +a ansi 8 Tahoma
  xdid -t %d 419 $z.lang(options,summary)
  
  ; changes
  xdid -c %d 410 420 text 20 195 275 40 noprefix
  xdid -C %d 420 +kb %bg2
  xdid -C %d 420 +t %bg2_
  xdid -f %d 420 +a ansi 8 Tahoma
  xdid -t %d 420 $z.lang(options,changes)
  
  
    ; creating advanced panel
  xdialog -c %d 500 panel 0 55 480 305
    ; setting bg colors
;  xdid -C %d 500 +b %pbg
  xdid -C %d 500 +kt %bg
  xdid -h %d 500
  
  
      ; flood protection
  xdid -c %d 500 510 box 10 115 460 80
  xdid -C %d 510 +b %bg2
  xdid -C %d 510 +kt %bg2_
  xdid -f %d 510 +a ansi 8 Tahoma
  
        ; flood label
  xdid -c %d 510 511 text 7 3 200 20
  xdid -C %d 511 +kb %bg2
  xdid -C %d 511 +t %bg2_
  xdid -f %d 511 +ab ansi 7 Tahoma
  xdid -t %d 511 $z.lang(options,floodprot)
  
        ; text
  xdid -c %d 510 512 text 20 20 350 25
  xdid -C %d 512 +kb %bg2
  xdid -C %d 512 +t %bg2_
  xdid -f %d 512 +a ansi 8 Tahoma
  xdid -t %d 512 $z.lang(options,floodmsg)
  
  xdid -c %d 510 513 check 25 55 280 20
  xdid -f %d 513 +a ansi 8 tahoma
  xdid -C %d 513 +kb %bg2
  xdid -C %d 513 +t %bg2_
  xdid -t %d 513 $z.lang(options,protectme)
  
  
      ; repair
  xdid -c %d 500 520 box 10 15 460 85
  xdid -C %d 520 +b %bg2
  xdid -C %d 520 +kt %bg2_
  xdid -f %d 520 +a ansi 8 Tahoma
  
        ; repair label
  xdid -c %d 520 521 text 7 3 200 20
  xdid -C %d 521 +kb %bg2
  xdid -C %d 521 +t %bg2_
  xdid -f %d 521 +ab ansi 7 Tahoma
  xdid -t %d 521 $z.lang(options,repair)
  
        ; text
  xdid -c %d 520 522 text 20 20 330 55
  xdid -C %d 522 +kb %bg2
  xdid -C %d 522 +t %bg2_
  xdid -f %d 522 +a ansi 8 Tahoma
  xdid -t %d 522 $z.lang(options,repairmsg)
  
  
  xdid -c %d 520 523 button 365 50 73 25
  xdid -f %d 523 +a ansi 8 tahoma
  xdid -t %d 523 $z.lang(options,complete)
  
  xdid -c %d 520 524 button 365 20 73 25
  xdid -f %d 524 +a ansi 8 tahoma
  xdid -t %d 524 $z.lang(options,min)
  
  
      ; connection
  xdid -c %d 500 501 box 10 210 460 50
  xdid -C %d 501 +b %bg2
  xdid -C %d 501 +kt %bg2_
  xdid -f %d 501 +a ansi 8 Tahoma
  
        ; connection label
  xdid -c %d 501 502 text 7 3 200 20
  xdid -C %d 502 +kb %bg2
  xdid -C %d 502 +t %bg2_
  xdid -f %d 502 +ab ansi 7 Tahoma
  xdid -t %d 502 $z.lang(options,connection)
  
        ; text
  xdid -c %d 501 503 text 20 20 250 20
  xdid -C %d 503 +kb %bg2
  xdid -C %d 503 +t %bg2_
  xdid -f %d 503 +a ansi 8 Tahoma
  xdid -t %d 503 $z.lang(options,configuremsg)
  
  xdid -c %d 501 504 button 317 15 120 25
  xdid -f %d 504 +a ansi 8 tahoma
  xdid -t %d 504 $z.lang(options,consettings)
  
  
  
  
  
  _loadsettings %d
  
  ; hide to get default settings during install
  if (%zion.s.opt.para) {
    tokenize 32 %zion.s.opt.para
    if ($1 = -default) {
;      xdialog -a %d +h 0
      z.options_cb z.options sclick 998
    }
    elseif ($1 = -gameoptions) {
      z.options_cb z.options sclick 1 4
      if ($2) .timer 1 0 z.options_cb z.options sclick 401 1 $2
    }
    elseif ($1 = -snooping) {
      z.options_cb z.options sclick 1 3
    }
    elseif ($1 = -plugs) {
      z.options_cb z.options sclick 1 4
    }
  }
}


alias z.options_proxy {
  if ($dialog(z.options_proxy)) return
  if ($1 = -test) %zion.s.proxytest = 1
  dialog -ma z.options_proxy z.options_proxy
}

dialog z.options_proxy {
  title Connection Settings
  size -1 -1 400 210
}

on *:dialog:z.options_proxy:*:*: {
  if ($devent == init) {
    dll_mc SetIcon -w $dialog($dname).hwnd 3 $z.icl
    dcx Mark $dname z.options_proxy_cb
    xdialog -b $dname +ty
    
    ;// Call initilisation alias
    z.options_proxy_init
  }
}

alias -l z.options_proxy_init {
  
  var %d $dname
  var %bg2 $z.options.bg2
  var %bg2_ $z.options.bg2_
  
  ; proxy box
  xdialog -c %d 10 box 10 5 380 160
  xdid -C %d 10 +b %bg2
  xdid -C %d 10 +kt %bg2_
  xdid -f %d 10 +a ansi 8 Tahoma
;      xdid -t %d 11 Channels
  
  xdid -c %d 10 11 text 7 3 350 20
  xdid -C %d 11 +kb %bg2
  xdid -C %d 11 +t %bg2_
  xdid -f %d 11 +ab ansi 7 Tahoma
  xdid -t %d 11 $z.lang(options,proxysv)
  
  xdid -c %d 10 12 radio 15 20 280 20 group
  xdid -f %d 12 +a ansi 8 tahoma
  xdid -C %d 12 +kb %bg2
  xdid -C %d 12 +t %bg2_
  xdid -t %d 12 $z.lang(options,direct)
  
  xdid -c %d 10 13 radio 15 43 280 20
  xdid -f %d 13 +a ansi 8 tahoma
  xdid -C %d 13 +kb %bg2
  xdid -C %d 13 +t %bg2_
  xdid -t %d 13 $z.lang(options,autoie)
  
  xdid -c %d 10 14 radio 15 65 280 20
  xdid -f %d 14 +a ansi 8 tahoma
  xdid -C %d 14 +kb %bg2
  xdid -C %d 14 +t %bg2_
  xdid -t %d 14 $z.lang(options,mansv)
  
  
  xdid -c %d 10 15 text 40 90 70 20
  xdid -C %d 15 +kb %bg2
  xdid -C %d 15 +t %bg2_
  xdid -f %d 15 +ab ansi 8 Tahoma
  xdid -t %d 15 $z.lang(options,httpproxy)
  
  xdid -c %d 10 16 edit 115 87 150 20 autohs
  xdid -f %d 16 +a ansi 8 arial
  
  xdid -c %d 10 17 text 280 90 30 20
  xdid -C %d 17 +kb %bg2
  xdid -C %d 17 +t %bg2_
  xdid -f %d 17 +ab ansi 8 Tahoma
  xdid -t %d 17 $z.lang(options,httpport)
  
  xdid -c %d 10 18 edit 315 87 50 20
  xdid -f %d 18 +a ansi 8 arial
  
  xdid -c %d 10 19 button 120 120 140 25
  xdid -f %d 19 +a ansi 8 tahoma
  xdid -t %d 19 $z.lang(options,testcon)
  
  
  xdialog -c %d 31 button 160 175 70 25
  xdid -f %d 31 +a ansi 8 tahoma
  xdid -t %d 31 $z.lang(options,ok)
  
  xdialog -c %d 32 button 240 175 70 25
  xdid -f %d 32 +a ansi 8 tahoma
  xdid -t %d 32 $z.lang(options,cancel)
  
  xdialog -c %d 33 button 320 175 70 25
  xdid -f %d 33 +a ansi 8 tahoma
  xdid -t %d 33 $z.lang(options,help)
  
  ; loading settings
  var %r $z3.findtog(proxy,sel,n),%r2 $z3.findtog(proxy,addrport)
  if (%r = n) _proxytoggle %d 12
  elseif (%r = i) _proxytoggle %d 13
  elseif (%r = m) _proxytoggle %d 14
  
  if ($numtok(%r2,58) = 2) {
    xdid -ra %d 16 $gettok(%r2,1,58)
    xdid -ra %d 18 $gettok(%r2,2,58)
  }
  
  if (%zion.s.proxytest) z.options_proxy_cb $dname sclick 19
}

alias -l _proxytoggle {
  var %m $iif($2 = 14,-e,-b)
  xdid -c $1 $2
  xdid %m $1 16
  xdid %m $1 18
}
alias -l _proxy.savesettings {
  var %v
  if ($xdid($1,12).state) %v = n
  elseif ($xdid($1,13).state) %v = i
  elseif ($xdid($1,14).state) %v = m
  z3.addtog proxy sel %v
  z3.addtog proxy addrport $+($xdid($1,16).text,:,$xdid($1,18).text)
}
;// Callback alias for wc3ft_create
alias z.options_proxy_cb {
;  if ($2 != mouse) {
;    echo $color(info) -s */ z.options_proxy_cb: $1-
;  }
  
  if ($2 = sclick) {
    ; cancel
    if ($3 = 32) dialog -x $1
    ; OK
    elseif ($3 = 31) {
      _proxy.savesettings $1
      dialog -x $1
    }
    elseif ($3 isnum 12-14) _proxytoggle $1 $3
    elseif ($3 = 33) z.help options.htm#5_1
    elseif ($3 = 19) {
      _proxy.savesettings $1
      z.grabinfo
      xdid -b $1 19
    }
  }
  elseif ($2 = close) unset %zion.s.proxytest
}

on *:signal:zion_proxyfail:if ($dialog(z.options_proxy)) { xdid -e z.options_proxy 19 | var %e = $input($z.lang(options,testfail),oh,$z.lang(options,header_fail)) }
on *:signal:zion_motd:{
  if ($dialog(z.options_proxy)) {
    xdid -e z.options_proxy 19
    if (!%zion.s.proxytest) var %e = $input($z.lang(options,testgood),oi,$z.lang(options,success))
    else { dialog -x z.options_proxy | set -u3 %zion.s.proxygood 1 }
  }
}

alias -l _undocked {
  var %di z.options,%t xdid -s %di
  %t 402
  unset %zion.s.opt.current
  if ($1) {
    var %f $1-, %z = $+(",%f,"),%n $z.fileinfo(%f,Name)
    if (%n) {
      var %v $z.fileinfo(%f,Ver),%a $z.fileinfo(%f,Author),%e $z.fileinfo(%f,Email),%d $z.fileinfo(%f,Date),%u $z.fileinfo(%f,URL),%i $z.fileinfo(%f,Info),%c $z.fileinfo(%f,Changes),%s xdid -t %di
      %s 411 %n Info
      %s 419 %i
      %s 420 $iif(%c,Changes: %c)
      %s 418 $iif(%u,URL: %u)
      %s 417 $iif(%d,Date: %d)
      %s 416 $iif(%e,Email: %e)
      %s 415 $iif(%a,Author: %a)
      %s 414 $iif(%v,Version: %v)
      %s 413 $iif(%f,File: %f)
      %s 412 $iif(%n,Name: %n)
      %t 410
    }
  }
  
}
alias -l _docked {
  xdid -h z.options 402
  xdid -h z.options 410
  if ($timer(z.options.nodock)) .timerz.options.nodock off
}
alias z.options.closeonend %zion.s.opt.closeonend = $addtok(%zion.s.opt.closeonend,$1,44)
alias z.options.dock {
;  window -ahn @z.options 1 1 1 1
;  .timer 1 1 window -a @z.options
  _docked
  
  var %r $r(400,499)
  while ($xdialog(z.options,%r).isid) {
    %r = $r(400,499)
  }
  
  xdid -c z.options 400 %r dialog 140 10 330 300 $1
  
  set $+(%,zion.s.opt.docks.,$1) %r
  
  %zion.s.opt.current = %r
  
  
;  if ($xdialog(z.options,450).isid) xdid -d z.options 400 450
;  xdid -c z.options 400 450 dialog 140 10 330 300 $1
  
  
  dialog -v z.options
;  .timer 1 0 xdialog -c z.options 450 dialog 140 10 330 300 $1
  
;  .timer 1 3 window -c @z.options
  
  z.options.closeonend $1
}
alias z.options.show {
  _docked
  var %r = $eval($+(%,zion.s.opt.docks.,$1),2)
  xdid -s z.options %r
  %zion.s.opt.current = %r
  
}
alias z.options.docked {
  if ($eval($+(%,zion.s.opt.docks.,$1),2)) return $ifmatch
  else return 0
}
/*
alias z.options.add23 {
  var %d
  if ($1 = -g) %d = 1
  elseif ($1 = -p) %d = 2
  else return
  tokenize 124 $2-
  xdid -a z.options 401 $+(%d -1,$chr(9),+c 1 1 0 0 0 $z.options.bg2_ $2,$chr(9),$1)
}
*/
alias z.opt.refreshlist {
  var %d $1,%bg2_ $z.options.bg2_
  ;,%s %zion.s.opt.sel
  xdid -r %d 401
  var %d $1,%bg2_ $z.options.bg2_
  xdid -a %d 401 $+(1,$chr(9),+be 1 1 0 0 0 %bg2_ %bg2_ $z.lang(options,gamesets),$chr(9),-)
  xdid -a %d 401 $+(2,$chr(9),+be 1 1 0 0 0 %bg2_ %bg2_ $z.lang(options,plugins),$chr(9),-)
  xdid -a %d 401 $+(3,$chr(9),+bec 1 1 0 0 0 %bg2_ %bg2_ $z.lang(options,unloaded),$chr(9),-)
  xdid -a %d 401 $+(3 1,$chr(9),+c 1 1 0 0 0 %bg2_ %bg2_ $z.lang(options,gamesets),$chr(9),-)
  xdid -a %d 401 $+(3 2,$chr(9),+c 1 1 0 0 0 %bg2_ %bg2_ $z.lang(options,plugins),$chr(9),-)
  
  z.opt.genlist *.zgs 4 $z.gamefolder
  z.opt.genlist zion_*.mrc 4 $z.pluginfolder
  
  if ($2) {
    if ($left($2,1) = -) %d = $3-
    else %d = $2-
    %d = $_scriptpath($1,%d)
    z.options_cb $1 sclick 401 %d
    xdid -c $1 401 %d
  }
  /*
  else {
    if (%s) {
      if ($script($+(",%s,"))) { xdid -e $1 404 | xdid -b $1 403 }
      else { xdid -b $1 404 | xdid -e $1 403 }
    }
    else {
      xdid -b %d 403
      xdid -b %d 404
    }
  }
  */
  
}
alias z.opt.genlist {
  var %n $findfile($3-,$1,0,$2),%f,%z,%d,%name
  while (%n > 0) {
    %f = $findfile($3-,$1,%n,$2)
    ; skip temps
    if ($nofile(%f) = $+($3-,temp\)) { dec %n | continue }
    %z = $+(",%f,")
    %name = $gettok($read(%z, w, *Name....:*),2-,58)
    if ($3- = $z.pluginfolder) %d = 2
    elseif ($3- = $z.gamefolder) %d = 1
    if (%name) {
      if (!$script(%z)) xdid -a z.options 401 $+(3 %d -1,$chr(9),+c 1 1 0 0 0 $z.options.bg2_ 0 %name,$chr(9),%f)
      else xdid -a z.options 401 $+(%d -1,$chr(9),+c 1 1 0 0 0 $z.options.bg2_ 0 %name,$chr(9),%f)
    }
    dec %n
  }
}

alias -l _loadsettings {
  var %d $dname
  var %bg $z.options.bg
  var %bg2 $z.options.bg2
;    var %bg2 $rgb(200,207,149)
  var %bg2_ $z.options.bg2_
  
  var %d $1
  var %v
    ; now it's time to grab and fill up data
    ; and set defaults if they are not set
  xdid -ra %d 127 $z3.findtog(personal,name,$me)
  
  if ($z3.findtog(personal,inv)) xdid -c %d 145
  if ($z3.findtog(personal,frdprmpt)) xdid -c %d 142
  
  if ($hget(zsession,authed)) xdid -b %d 131
  else xdid -b %d 132
  
    ; sounds settings
  var %s $z.soundmap,%i 1,%c = $numtok(%s,44)
  var %f 2|fx\welcome_cool.mp3,2|fx\firstgame.wav,2|fx\f_online.wav,2|fx\gamelisted.wav,2|fx\gamefound.wav,2|fx\gamefull.mp3,2|fx\gamestarting.wav,2|fx\gamestart.wav,2|fx\mapload.wav,2|fx\leaver.wav,2|fx\cheater.wav,2|fx\reminder.wav
  while (%i <= %c) {
    _soundset %d 162 %i $z3.findtog(personal,$gettok(%s,%i,44),$gettok(%f,%i,44))
    inc %i
  }
  
    ; general
  %c = $z3.findtog(general,server,$z.goodsv)
  xdid -a %d 204 0 0 0 0 0 $gettok(%c,1,32)
  xdid -c %d 204 1
  xdid -a %d 204 0 0 0 0 0  
  
  %v = 1
  while (%v <= $read($z.servers,0)) {
    dll_wfix WhileFix
    xdid -a %d 204 0 0 0 0 0 $read($z.servers,%v)
    inc %v
  }
  
  xdid -ra %d 207 $gettok(%c,2,32)
  
  xdid -ra %d 215 $z.ip
  
    ; language
  
  %c = 1
  %v = $findfile($+(",$z.sysfolder,"),*.lang,0,0)
  while (%c <= %v) {
    dll_wfix WhileFix
    %f = $findfile($+(",$z.sysfolder,"),*.lang,%c,0)
    xdid -a %d 224 0 0 0 0 0 $readini($+(",%f,"),header,name)
    if ($nopath(%f) = $z3.findtog(general,lang,english.lang)) xdid -c %d 224 %c
    inc %c
  }
  
  
  
    ; snooping
  if (!$z3.findtog(perm,data)) z3.addtog perm data $z.defdata
  if (!$z3.findtog(perm,chat)) z3.addtog perm chat $z.defchat
  
  xdid -a %d 312 $+(1,$chr(9),+be 1 1 0 0 0 %bg2_ 0 $z3.findtog(perm,chat,$z.defchat),$chr(9),-)
  xdid -a %d 312 $+(1 1,$chr(9),+c 1 1 0 2 0 %bg2_ 0 $z.lang(options,snooping),$chr(9),-)
  xdid -a %d 312 $+(1 2,$chr(9),+c 1 1 0 2 0 %bg2_ 0 $z.lang(options,spamming),$chr(9),-)
  
  
  xdid -k %d 312 $z3.findtog(snoop,datachan,2) 1 1
  xdid -k %d 312 $z3.findtog(snoop,datachanspam,2) 1 2
  
  var %i 1,%c = $z3.findtog(snoop,totalchan),%t,%t2
  
  while (%i <= %c) {
    %t = %i + 1
    %t2 = $z3.findtog(snoop,%i)
    xdid -a %d 312 $+(-1,$chr(9),+b 1 1 0 0 0 %bg2_ 0 $gettok(%t2,1,124) $+($chr(40),$gettok($gettok($gettok(%t2,2,124),1,58),-2-,46),$chr(41)),$chr(9),-)
    xdid -a %d 312 $+(-1 -1,$chr(9),+i 1 1 0 0 0 %bg2_ 0 $iif($gettok(%t2,2,124) !isnum,$ifmatch,$replace($z3.findtog(general,server),$chr(32),:)),$chr(9),-)
    xdid -a %d 312 $+(-1 -1,$chr(9),+c 1 1 0 $gettok(%t2,3,124) 0 %bg2_ 0 $z.lang(options,snooping),$chr(9),-)
    xdid -a %d 312 $+(-1 -1,$chr(9),+c 1 1 0 $gettok(%t2,4,124) 0 %bg2_ 0 $z.lang(options,spamming),$chr(9),-)
    xdid -a %d 312 $+(-1 -1,$chr(9),+c 1 1 0 $gettok(%t2,5,124) 0 %bg2_ 0 $z.lang(options,visibility),$chr(9),-)
    inc %i
  }
  
  %v = $z3.findtog(snoop,notify,0|1)
  if (%v) {
    tokenize 124 %v
    if ($1) xdid -c %d 323
    else {
      xdid -b %d 324
      xdid -b %d 325
    }
    xdid -c %d 324 $2
    xdid -ra %d 325 $3-
  }
  
  %v = $z3.findtog(snoop,exclude,0|)
  if (%v) {
    tokenize 124 %v
    if ($1) xdid -c %d 327
    else xdid -b %d 328
    xdid -ra %d 328 $2-
  }
  
  ; gamesets plugins
  z.opt.refreshlist %d
  
  ;advanced
  if ($z3.findtog(advanced,floodprot,1)) xdid -c %d 513
  
  
}




alias _soundset {
  if ($4) {
    %v = $4
    xdid -k $1 $2 $gettok(%v,1,124) $3
    if ($gettok(%v,2,124)) xdid -v $1 $2 $3 1 $ifmatch
  }
}
alias z.soundmap return snd_welcome,snd_firstgame,snd_fonline,snd_gamelisted,snd_gamefound,snd_gamefull,snd_gamestarting,snd_gamestart,snd_mapload,snd_leaver,snd_cheater,snd_reminder
alias -l _savesettings {
  z3.addtog -skipnull personal name $remove($xdid($1,127).text,$chr(36))
  
  if ($isalias(z.reg.friends)) z.reg.friends
  if ($isalias(z.reg.sound)) z.reg.sound
  
    ; general
  if ($z.network isin $xdid($1,204,0).text) z3.addtog general server $xdid($1,204,0).text $xdid($1, 207).text
  
  
; ipaddress control
  ; ip
  if ($xdid($1,215).ip) %zion.s.ip = $xdid($1,215).ip
;  if ($xdid($1,215).text) %zion.s.ip = $xdid($1,215).text
  
    ; snooping
  z3.addtog snoop datachan $xdid($1,312,1 1).state
  z3.addtog snoop datachanspam $xdid($1,312,1 2).state
  %s = $xdid($1, 312,root).num - 2
  
    ; if changes results in lesser channels, let's remove dead data
  %c = $z3.findtog(snoop,totalchan) - %s
  while (%c > 0) {
    z3.addtog snoop $calc($z3.findtog(snoop,totalchan) - %c +1) 0
    dec %c
  }
  
  z3.addtog snoop totalchan %s
  if (%s) {
    %c = 2
    while (%s > 0) {
      z3.addtog snoop $calc(%c -1) $+($gettok($xdid($1,312,%c).text,1,32),|,$xdid($1,312,%c 1).text,|,$xdid($1,312,%c 2).state,|,$xdid($1,312,%c 3).state,|,$xdid($1,312,%c 4).state)
      inc %c
      dec %s
    }
  }
  
  z3.addtog snoop notify $+($xdid($1,323).state,|,$xdid($1,324).sel,|,$xdid($1,325).text)
  z3.addtog snoop exclude $+($xdid($1,327).state,|,$replace($xdid($1,328).text,$chr(44),$chr(32)))
  
  ; advanced
  z3.addtog advanced floodprot $xdid($1,513).state
  
}
alias zion.donateremind var %c = $ctime, %d = $z3.findtog(info,donateremind,$calc($ctime + 7 * 86400)) | if (%c >= %d) z.donate
alias z.donate {
  z.splay snd_reminder
  dialog -ma zion_donate zion_donate_table
}

dialog zion_donate_table {
  title $z.lang(options,header_donate)
  size -1 -1 488 346
}

on *:dialog:zion_donate:*:*: {
  if ($devent == init) {
    dcx Mark $dname zion_donate_cb
    xdialog -b $dname +yt
    
    ;// Call initilisation alias
    zion_donate_init_dcx
  }
}

alias -l zion_donate_init_dcx {
  
  var %d $dname
  var %bg2 $z.options.bg2
  var %bg2_ $z.options.bg2_
  xdialog -g %d +b %bg2
  
  xdialog -c $dname 7 text 5 25 480 20 center
  xdid -C %d 7 +kb %bg2
  xdid -C %d 7 +t $rgb(180,0,0)
  xdid -f %d 7 +ab ansi 10 Tahoma
  xdid -t $dname 7 $z.lang(options,youplayed) $z3.findtog(info,games) $z.lang(options,youplayed2)
  
  xdialog -c $dname 8 text 255 5 225 20 right
  xdid -C %d 8 +kb %bg2
  xdid -C %d 8 +t %bg2_
  xdid -f %d 8 +ab ansi 7 Tahoma
  xdid -t $dname 8 $z.lang(options,playtime) $duration($z3.findtog(info,playtime),2)
  
  xdialog -c $dname 5 button 403 320 75 20 tabstop
  xdid -t $dname 5 Ok
  
  xdialog -c $dname 1 webctrl 4 50 480 200 tabstop
  xdid -n $dname 1 $+(http://,$z.host,/donate/msg.html)
  
  xdialog -c $dname 6 text 5 5 200 20
  xdid -C %d 6 +kb %bg2
  xdid -C %d 6 +t %bg2_
  xdid -f %d 6 +ab ansi 7 Tahoma
  xdid -t $dname 6 $z.lang(options,online) $duration($calc($z3.findtog(info,onlinetime) + $ctime - $z.h.getvar(connected_ctime)),2)
  
  xdialog -c $dname 2 radio 95 260 265 20 tabstop group
  xdid -f %d 2 +a ansi 8 tahoma
  xdid -C %d 2 +kb %bg2
  xdid -C %d 2 +t %bg2_
  xdid -t $dname 2 $z.lang(options,wantdonate)
  
  xdialog -c $dname 3 radio 95 280 160 20 tabstop
  xdid -f %d 3 +a ansi 8 tahoma
  xdid -C %d 3 +kb %bg2
  xdid -C %d 3 +t %bg2_
  xdid -t $dname 3 $z.lang(options,nodonate)
  
  xdialog -c $dname 4 radio 95 300 230 20 tabstop
  xdid -f %d 4 +a ansi 8 tahoma
  xdid -C %d 4 +kb %bg2
  xdid -C %d 4 +t %bg2_
  xdid -t $dname 4 $z.lang(options,trymore)
  
  xdialog -c $dname 9 radio 95 320 135 20 tabstop
  xdid -f %d 9 +a ansi 8 tahoma
  xdid -C %d 9 +kb %bg2
  xdid -C %d 9 +t %bg2_
  xdid -t $dname 9 $z.lang(options,donated)
  
  
  xdid -c %d 2
  
}

alias zion_donate_cb {
  if (($2 = sclick) && ($3 = 5)) {
    var %e 86400,%f z3.addtog info donateremind
    if ($xdid($1,2).state) { run $+(http://,$z.host,/donate/donate.html) | %f $calc($ctime + 3 * %e) }
    if ($xdid($1,3).state) %f $calc($ctime + 3 * %e)
    if ($xdid($1,4).state) %f $calc($ctime + 7 * %e)
    elseif ($xdid($1,9).state) { %f $calc($ctime + 10 * %e) | .timer 1 0 _thankyou }
    xdialog -x $1
  }
}
alias -l _thankyou var %e = $input($z.lang(options,thankyou),o,$z.lang(options,header_thankyou))


alias z.options_addchan {
  dialog -ma z.options_addchan z.options_addchan_table
}

dialog z.options_addchan_table {
  title $z.lang(options,addchantitle)
  size -1 -1 362 200
}

on *:dialog:z.options_addchan:*:*: {
  if ($devent == init) {
    dll_mc SetIcon -w $dialog($dname).hwnd 3 $z.icl
    dcx Mark $dname z.options_addchan_cb
    xdialog -b $dname +yzt
    
    ;// Call initilisation alias
    z.options_addchan_init_dcx
  }
}

alias -l z.options_addchan_init_dcx {
  
  var %d $dname
  var %bg2 $z.options.bg2
  var %bg2_ $z.options.bg2_
  
  ;// Initialising control: (Box 1)
  xdialog -c $dname 1 box 5 5 350 150
  xdid -C %d 1 +b %bg2
  xdid -C %d 1 +kt %bg2_
  xdid -f %d 1 +a ansi 8 Tahoma
  xdid -l $dname 1 root $chr(9) +pl 0 1 0 0
  
  xdid -c %d 1 11 text 7 3 200 20
  xdid -C %d 11 +kb %bg2
  xdid -C %d 11 +t %bg2_
  xdid -f %d 11 +ab ansi 7 Tahoma
  xdid -t %d 11 $z.lang(options,chanconfig)
  
  
  ;// Initialising control: (ComboEx 5)
  xdid -c $dname 1 15 comboex 180 36 150 300 dropdown tabstop
  xdid -f %d 15 +a ansi 8 arial
  
  
  ;// Initialising control: Edit (Edit 3)
  xdid -c $dname 1 13 edit 10 38 150 20 autohs autovs tabstop
  xdid -f %d 13 +a ansi 8 arial
  
  ;// Initialising control: Advertise games (Spamming) (Check 9)
  xdid -c $dname 1 19 check 10 85 160 20 tabstop
  xdid -f %d 19 +a ansi 8 tahoma
  xdid -C %d 19 +kb %bg2
  xdid -C %d 19 +t %bg2_
  xdid -t $dname 19 $z.lang(options,chanspamming)
  xdid -c %d 19
  
  ;// Initialising control: Network (Text 4)
  xdid -c $dname 1 14 text 180 20 100 12
  xdid -f %d 14 +ab ansi 8 tahoma
  xdid -C %d 14 +kb %bg2
  xdid -C %d 14 +t %bg2_
  xdid -t $dname 14 $z.lang(options,channetwork)
  
  ;// Initialising control: Custom Server (Text 7)
  xdid -c $dname 1 17 text 180 65 150 15
  xdid -f %d 17 +ab ansi 8 tahoma
  xdid -C %d 17 +kb %bg2
  xdid -C %d 17 +t %bg2_
  xdid -t $dname 17 $z.lang(options,chansvport)
  
  ;// Initialising control: Channel (Text 2)
  xdid -c $dname 1 12 text 10 20 100 15
  xdid -f %d 12 +ab ansi 8 tahoma
  xdid -C %d 12 +kb %bg2
  xdid -C %d 12 +t %bg2_
  xdid -t $dname 12 $z.lang(options,channel)
  
  ;// Initialising control: Grab games (Snooping) (Check 8)
  xdid -c $dname 1 18 check 10 60 150 20 tabstop
  xdid -f %d 18 +a ansi 8 tahoma
  xdid -C %d 18 +kb %bg2
  xdid -C %d 18 +t %bg2_
  xdid -t $dname 18 $z.lang(options,chansnooping)
  xdid -c %d 18
  
  ;// Initialising control: Show channel (Visibility) (Check 10)
  xdid -c $dname 1 10 check 10 110 150 20 tabstop
  xdid -f %d 10 +a ansi 8 tahoma
  xdid -C %d 10 +kb %bg2
  xdid -C %d 10 +t %bg2_
  xdid -t $dname 10 $z.lang(options,chanvisibility)
  
  ;// Initialising control: Edit (Edit 6)
  xdid -c $dname 1 16 edit 180 83 150 20 autohs autovs tabstop
  xdid -f %d 16 +a ansi 8 arial
  xdid -a %d 16 $replace($z3.findtog(general,server),$chr(32),:)
  
  ;// Initialising control: OK (Button 11)
  xdialog -c $dname 21 button 115 165 70 25 tabstop
  xdid -f %d 21 +a ansi 8 tahoma
  xdid -t %d 21 $z.lang(options,ok)
  
  ;// Initialising control: Cancel (Button 12)
  xdialog -c $dname 22 button 195 165 70 25 tabstop
  xdid -f %d 22 +a ansi 8 tahoma
  xdid -t %d 22 $z.lang(options,cancel)
  
  ;// Initialising control: Help (Button 13)
  xdialog -c $dname 23 button 275 165 70 25 tabstop
  xdid -f %d 23 +a ansi 8 tahoma
  xdid -t %d 23 $z.lang(options,help)
  
  
  
  xdid -a %d 15 0 0 0 0 0 $z.network
  xdid -c %d 15 1
  xdid -a %d 15 0 0 0 0 0 GalaxyNet.org
  xdid -a %d 15 0 0 0 0 0 $z.lang(options,chancustom)
  
}

;// Callback alias for z.options_addchan
alias z.options_addchan_cb {
  if ($2 = sclick) {
    if ($3 = 15) {
      if ($4 = 3) { xdid -r $1 16 | xdid -F $1 16 }
      else {
        var %v
        if ($4 = 1) %v = $replace($z3.findtog(general,server),$chr(32),:)
        else %v = $addchandef($xdid(z.options_addchan,15).seltext)
        xdid -ra $1 16 %v
        xdid -c $1 15 3
        xdid -F $1 16
      }
    }
    elseif ($3 = 22) dialog -x $1
    elseif ($3 = 21) {
      var %v,%e,%i
      %e = $xdid($1,16).text
      if ($numtok(%e,58) != 2) %e = %e $+ :6667
      %i = $gettok($gettok(%e,1,58),-2-,46)
      
      if ((!%i) || (!$xdid($1,13).text) || ((($xdid($1,15).sel = 3) && (!$xdid($1,16).text)))) {
        %v = $input($z.lang(options,chandetailsprompt),wo,$z.lang(err,oops))
        return
      }
      %v = $xdid($1,13).text
      if ($left(%v,1) != $chr(35)) %v = $chr(35) $+ %v
      
      if ($xdid(z.options,312,$chr(9) %v $+($chr(40),%i,$chr(41)) $chr(9),W,1).find) {
        xdid -c z.options 312 $ifmatch
        dialog -x $1
      }
      
      xdid -a z.options 312 $+(-1,$chr(9),+b 1 1 0 0 0 $z.options.bg2_ 0 %v $+($chr(40),%i,$chr(41)),$chr(9),-)
      xdid -a z.options 312 $+(-1 -1,$chr(9),+i 1 1 0 0 0 $z.options.bg2_ 0 %e,$chr(9),-)
      xdid -a z.options 312 $+(-1 -1,$chr(9),+c 1 1 0 $calc($xdid($1,18).state +1) 0 $z.options.bg2_ 0 $z.lang(options,snooping),$chr(9),-)
      xdid -a z.options 312 $+(-1 -1,$chr(9),+c 1 1 0 $calc($xdid($1,19).state +1) 0 $z.options.bg2_ 0 $z.lang(options,spamming),$chr(9),-)
      xdid -a z.options 312 $+(-1 -1,$chr(9),+c 1 1 0 $calc($xdid($1,10).state +1) 0 $z.options.bg2_ 0 $z.lang(options,visibility),$chr(9),-)
      dialog -x $1
    }
  }
  elseif ($2 = edit) {
    if (($3 = 16) && ($xdid($1,16).text)) {
      xdid -c $1 15 3
    }
  }
}


alias -l addchandef {
  if ($1 = GalaxyNet.org) return Singnet.SG.GalaxyNet.org
}
;dcxtools, copy after dcx alias from file.
alias dcx {
  if ($isid) return $dll($scriptdirsystem\dcx\dcx.dll,$1,$2-)
  else dll " $+ $scriptdirsystem\dcx\dcx.dll" $1 $2-
}

alias udcx {
  if ($dcx(IsUnloadSafe)) $iif($menu, .timer 1 0) dll -u dcx.dll
  else echo 4 -qmlbfti2 [DCX] Unable to Unload Dll.
}

alias xdid {
  if ( $isid ) return $dcx( _xdid, $1 $2 $prop $3- )
  dcx xdid $2 $3 $1 $4-
}

alias xdialog {
  if ( $isid ) return $dcx( _xdialog, $1 $prop $2- )
  dcx xdialog $2 $1 $3-
}

alias xpop {
  if ( $isid ) return $dcx( _xpop, $1 $prop $2- )
  dcx xpop $2 $1 $3-
}

alias xpopup {
  if ( $isid ) return $dcx( _xpopup, $1 $prop $2- )
  dcx xpopup $2 $1 $3-
}

alias mpopup {
  dcx mpopup $1 $2
}

alias xdock {
  if ($isid) return $dcx( _xdock, $1 $prop )
  dcx xdock $1-
}

alias xtray {
  if ($isid) return $dcx(TrayIcon, $1 $prop $2-)
  dcx TrayIcon $1-
}

alias tab {
  var %i = 1, %tab
  while (%i <= $0) {
    if ($eval($+($,%i),2) != $null) {
      %tab = $instok(%tab,$eval($+($,%i),2),$calc($numtok(%tab,9) + 1),9)
    }
    inc %i
  }
  return %tab
}