mIRC Home    About    Download    Register    News    Help

Print Thread
#256969 05/03/16 07:16 PM
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
As far as I know, there's no way to determine if a command/identifier exists regardless of it being native or scripted. This makes it hard to polyfill newly added features for older client versions(yes, people should update but lets be honest: they don't).

I suggest adding a .AsNative property to the $isalias() identifier which would return $true if the specified command/identifer is supported natively regardless if there is a scripted override.

Last edited by FroggieDaFrog; 05/03/16 07:18 PM.

I am SReject
My Stuff
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
A use-case would be poly-filling the up-and-coming $unsafe identifier:
Code:
alias myUnsafe {

  ;; if mIRC supports the 'unsafe' identifier
  if ($isalias(unsafe).AsNative) {
    return $unsafe($1-)
  }

  ;; otherwise, use a scripted equivalent. 
  elseif (!$lock(encode)) {
    return $!decode( $+ $encode($1-,m) $+ ,m)
  }
  elseif ($~prop == undo) {
    !return $~regsubex($~1-, /\\([\da-f]{2})/gi, $~chr($~base(\t, 16, 10)))
  }
  else {
    var %regex = /((?:[#,()\\])|(?:(?<= |^)[%$])|(?:(?<= |^)[\Q{}[]|\E](?= |$)))/g
    if ($regsubex($1,%regex,\ $+ $~base($~asc(\t),10,16,2)) !=== $~1) {
      return $!myUnsafe( $+ $v1 $+ ).undo
    }
    !return $~1-
  }
}

Last edited by FroggieDaFrog; 06/03/16 10:30 AM.

I am SReject
My Stuff

Link Copied to Clipboard