mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2004
Posts: 66
C
Cyrex Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Apr 2004
Posts: 66
Is it possible to make an alias of a built in mIRC command that will do everything the built in mIRC command is supposed to do, but will also do some custom routines? I don't want to have to do an entire rewrite of the command itself.


Let's say I want to add a routine to mIRC's /sockopen command, but the routine is only to check to see if a value is set, if it is, the command will execute normally. Is it possible to do this without having to write a custom sockopen alias that will do everything mIRC's /sockopen command does?


Code Example:

Code:
alias sockopen {
if ($hget(Lock,sockopen) == 0) {  Let mIRC handle its [color:blue]/sockopen[/color] command. }
else { 
echo -a * Error: /sockopen command locked
 halt 
}
}



Understand what I am trying to do?

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
alias sockopen {
if ($hget(Lock,sockopen) == 0) {  sockopen $1- }
else { echo -a * Error: /sockopen command locked halt }
}


/!sockopen will override your alias and use the default one though.


New username: hixxy
Joined: Apr 2004
Posts: 66
C
Cyrex Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Apr 2004
Posts: 66
I tried that before I posted, but if the user doesn't enter anything else after the /sockopen command, mIRC returns:

-
* /sockopen: insufficient parameters (line 159, script2.mrc)
-

I don't want mIRC returning the ' (line 159, script2.mrc)' part. I want the command to work as if it was built into mIRC. I rather it return just:

-
* /sockopen: insufficient parameters
-


This goes for other errors the command might return. I just want to leave off the script and line number of the error.

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
alias sockopen {
  if ($hget(Lock,sockopen) == 0) { sockopen $1- }
  else { echo -a * Error: /sockopen command locked halt }
  return
  :error
  if (? /sockopen: * parameters iswm $gettok($error,1-4,32)) { echo -ac Info $gettok($error,1-4,32) }
  reseterror
}


New username: hixxy

Link Copied to Clipboard