mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 2,812
Raccoon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
I would like to request a /set switch -i to indicate that the variable should be initialized with this value if the variable does not already exist. The code I am using to do this currently looks like:
Code:
  ; Initialize Variables
  if (%__IdleHide.On          == $null)  set %__IdleHide.On           $true
  if (%__IdleHide.Timer       == $null)  set %__IdleHide.Timer        10
  if (%__IdleHide.Never       == $null)  set %__IdleHide.Never        #IRCHelp
  if (%__IdleHide.IdleMessage == $null)  set %__IdleHide.IdleMessage  120
  if (%__IdleHide.IdleEvent   == $null)  set %__IdleHide.IdleEvent    30
  if (%__IdleHide.IdleRead    == $null)  set %__IdleHide.IdleRead     10
  if (%__IdleHide.IdleTyped   == $null)  set %__IdleHide.IdleTyped    60
  if (%__IdleHide.DebugWin    == $null)  set %__IdleHide.DebugWin     $true

It could look like this:
Code:
  ; Initialize Variables
  set -i %__IdleHide.On           $true
  set -i %__IdleHide.Timer        10
  set -i %__IdleHide.Never        #IRCHelp
  set -i %__IdleHide.IdleMessage  120
  set -i %__IdleHide.IdleEvent    30
  set -i %__IdleHide.IdleRead     10
  set -i %__IdleHide.IdleTyped    60
  set -i %__IdleHide.DebugWin     $true

Consideration, the new -i switch should also work in combination with the -e switch, for session-only variables, and really all other switches should be compatible as well.

I understand that some people might initialize variables within On Load or On Start, but my intent here is to avoid destroying old settings from a previous initialization of the script when updating to a newer version with added variables. Some users tend to just copy-paste new code over old code, which inhibits an On Load event from even happening.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Aug 2003
Posts: 319
P
Pan-dimensional mouse
Offline
Pan-dimensional mouse
P
Joined: Aug 2003
Posts: 319
+1 from me for this.


Link Copied to Clipboard