mIRC Home    About    Download    Register    News    Help

Print Thread
W
Wikked
Wikked
W
Hello I would like to suggest a new identifier that will help some scripters to handle if the initalization warning option is on or off.

$initwarn = will return $true/$false if the mIRC has the 'Initalization Warning' option on/off inthe settings.

Joined: Dec 2008
Posts: 1,483
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,483
Good idea, +1

Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
Note that you can work around this currently with:

Code:
; Usage: //echo -a $initwarn
alias initwarn {
  tokenize 44 $readini($mircini,options,n5)
  return $iif($27 == 1, $true, $false)
}


Details taken from mIRC.ini Unleashed.

FWIW a generalized $options(<optname>) type identifier would make more sense than a one-off $initwarn. I'm also curious what the use case is here... the script couldn't do anything about the warning in its own initialization, nor do you know what the user pressed-- so what would the purpose be?

Joined: Dec 2008
Posts: 1,483
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,483
The usage is not the big deal here as the point of handle any mIRC option via an main head identifier as $options(N/Name) you suggested, and the 'mIRC ini Unleashed' is a bit outdated anyway.

Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
I do think the usage is relevant. The work required to maintain the identifier (and the documentation, which would basically be re-documenting the entire set of mIRC's options, not a small undertaking) would likely be weighed against how common its usage is. I'd bet most users would never need to programmatically read $options() as a whole, let alone the init warning setting. And it's all currently scriptable on an individual basis fairly easily.

As for the Unleashed article being outdated; it wouldn't be difficult to update it. In fact, $options() could be scripted entirely (and shared), and then nobody would need the site in the first place.

edit: for example, here's a partial implementation of $options():

Code:
alias -l options.load {
  if ($hget(mirc.options)) return

  hmake mirc.options 100
  if ($exists($scriptdirmirc.options.ini)) {
    hload mirc.options $scriptdirmirc.options.ini
    return
  }

  ; TODO: n3, n4, n5, n6, n7
  ; see: https://web.archive.org/web/20071116220323/http://www.mishscript.de/help/mircini/index.htm
  ; run "/options -c" whenever this list is updated
  ; Add the ":*" suffix to any code whose value is numeric (non-boolean).
  options.build n0 conn-start,show-user-addr,chan-beep,show-ident-req,highlight,notify,dde-delay:*,kick-rejoin,esc-cancel-away,list-type-active,fill-switchbar,_,list-type-op,list-type-protect,dcc-send-req-action:*,dcc-get-req-minimize,dcc-beep,dcc-chat-req-action:*,connect-perform,dcc-chat-req-minimize,dcc-packet-size:*,single-msg-win,prefix-own-msg,_,dcc-get-beep,dcc-chat-beep,ident-only-conn,chan-list-sort,strip-codes,strip-codes-max:*,hide-ping-pong,line-marker,ident-warn,file-type-ignore-warn,confirm-disconn
  options.build n1 event-beep-times:*,event-beep-delay:*,online-timer,online-timer-reset-conn,online-timer-hrs:*,online-timer-mins:*,online-timer-secs:*,multi-line-edit,_,event-disconn-beep:*,skip-motd,conn-localhost,log-chan,log-msg,event-query-beep:*,event-notice-beep:*,dual-monitor,icon-query,whois-query,listen-get-req,buffer-beep,event-invite-beep:*,send-req-msg,auto-arrange,max-get-user,event-flash-beep:*,minimize-tray,default-dirs,default-nicklist,line-spacing:*,titlebar-shift,internal-beep,pc-speaker,nav-clicks,confirm-paste,confirm-paste-max:*
  options.build n2 dcc-complete-close,startup-dialog,dcc-get-minimize,event-dcc-send-beep:*,host-lookup:*,listen-raw,listen-ctcp,default-level:*,auto-cascade,dcc-req-timeout:*,dcc-transfer-timeout:*,listen-events,links-listbox,notifies-window,event-highlight-beep:*,finger-req,short-joins,fserve-timeout:*,fserve-req-max:*,fserve-max:*,auto-tile,next-server,highlight-nicks,whois-active,conn-rejoin,confirm-save,always-on-top,show-mode-prefix,notify-display,switchbar-ctrl-tab,editbox-tab,window-on-top,active-alt-z,reload-logs
  hsave mirc.options $scriptdirmirc.options.ini
}

alias -l options.build {
  var %i = 1, %max = $numtok($2,44)
  while (%i < %max) {
    var %tok = $gettok($2,%i,44)
    var %name = $gettok(%tok,1,58)
    hadd -m mirc.options %name $1 %i
    if ($numtok(%tok,58) > 1) hadd -m mirc.options __numeric. $+ %name $true
    inc %i
  }
}

; Usage: $options(NAME)
; Example: //echo -a $options(fill-switchbar) $options(dcc-packet-size)
alias options {
  if (!$isid && $1 == -c) { hfree mirc.options | .remove $scriptdirmirc.options.ini | return }
  options.load
  var %v = $hget(mirc.options,$1)
  if (%v == $null || $1 == _) { echo -ac info * $!options: invalid option $1 | halt }
  var %l = $gettok(%v,1,32), %n = $gettok(%v,2,32)
  var %result = $gettok($readini($mircini,options,%l),%n,44)
  if ($hget(mirc.options,__numeric. $+ $1)) return %result
  return $iif(%result == 1, $true, $false)
}


You'll notice that the hard part isn't writing the script, but (a) naming the options, and (b) understanding what the options do. In order for anybody else to actually use this, they would have to know what each of those cryptic code names (almost as cryptic as the n5/27 values they resolve to) mean. I would need the equivalent documentation of "mIRC.ini Unleashed" in order to fully explain what the full set of code names refer to. Similarly, mIRC's help file would need exactly the same. I'm not sure it's worth the effort just to add official support for checking the script editor's initialization warning setting, when the use for that is questionable in itself-- and when one-off user scripts like the $initwarn above work just fine.

It would actually be interesting to know why the original poster is looking for this functionality. It's possible that reading the setting might still not even solve the user's root problem, and there might be a more effective feature that could be useful here.

Last edited by argv0; 06/06/16 08:16 PM.

Link Copied to Clipboard