mIRC Homepage

Funny quirk with /server command

Posted By: TheArkive

Funny quirk with /server command - 03/11/06 01:59 AM

It seems that the /server command can be used as a remote event as well as a command.

I have a seperate script file set up for the server command and all the modifications that I plan to do to it to suit the needs of my script. Here is what I have :


server {
.timerCID.NETWORKS.RELIST -i 0 0 cid.networks.relist

server $1-

The "cid.networks.relist" alias basically checks all open CIDs for an active connection. All active CIDs are listed by network name in the variable named %cid.connected. All inactive CIDs are listed in the variable %cid.disconnected.

I use the timer to execute the alias after the /server command is complete so that the new CID can be added in the variable list. I knew that opening a new server connection would do this.

I figured out that when I click the [X] to close a server connection, or use the command:

/window -c "Status Window"

that my variables get updated! So it seems that closing a server connection by any method passes the /server command through the mIRC shell or command line?

My main question is, is that supposed to happen? This is perfect for my scripting needs. That saves me the trouble of needing DLLs to record Status window opens and closes. However if this "feature" is not available in future versions of mIRC then my script will be completely useless.

I'm using mIRC v6.2.
I have no 3rd Party DLLs loaded.
Very few scripts loaded. I just started a whole re-write of my script. Nothing else uses the /server command this way in my script.

If you create a custom window @test, and replace the .timer command with:

echo @test weird quirk

the only time you see "weird quirk" is when you use the /server command. However despite that, my alias is still passed through the command line when a window is closed...
Posted By: Riamus2

Re: Funny quirk with /server command - 03/11/06 02:07 AM

Not sure about the rest of it, but you aren't supposed to call an alias name from inside an alias. You can create an alias called server and make it do something instead of the normal server command, but you shouldn't be calling it from inside the alias.
Posted By: TheArkive

Re: Funny quirk with /server command - 03/11/06 02:13 AM

I know what you mean, but I only use that one instance to modify the action of the /server command, and then I put:

server $1-

so that the /server command still executes as needed in the original manner.

It works perfectly as an event, and maybe could be used as a remote in the future for events of OPEN and CLOSE of a status window???

I have had trouble in the past of using the OPEN and CLOSE remotes to record status windows. I can't remember the exact details on my troubles though...

Is there any telling what kind of problems I should expect (according to history?) from calling alias named X from inside command named X? So far this one instance seems to be perfect.

Is there any other way to record "Status Window" events that is not against how mIRC scripting is supposed to be used? Maybe I used OPEN and CLOSE events incorrectly? I recall that OPEN and CLOSE is only for querries, dcc chats, fserves, and custom windows mostly. There is also *, and it can support Status windows, but seems to be inconsistent...
Posted By: TheArkive

Re: Funny quirk with /server command - 03/11/06 02:38 AM

... sorry for the false alarm... i'm an idiot.

That timer command created an infinite timer that re-executed every 1ms, so that is why my variables were always up to date...

Any other advice on how to record Status Window events accurately with multipul connections (just open and close)???
Posted By: genius_at_work

Re: Funny quirk with /server command - 03/11/06 03:08 AM

If you call a built-in command from within an alias of the same name, mIRC automatically defaults to using the command (not the alias) since mIRC doesn't allow recursion. It may be 'safer' to use !server within the alias to ensure the command is used (not the alias) if Khaled decides to allow recursion in the future.

Posted By: DaveC

Re: Funny quirk with /server command - 03/11/06 03:49 AM

Ignoring the recursion issue, I beleive there is actually a statment in the help file somewhere saying that if u replace a command, you can call the orginal command from within it. (dont quote me on that, but im pretty sure that was the meaning at least)
Posted By: DaveC

Re: Funny quirk with /server command - 03/11/06 03:58 AM

Ignoring the timer error you have spotted, can I suggest you do this with your script

#TheArkive.Scriptnamehere.Server.Alias.Group on
server {
  .timerCID.NETWORKS.RELIST -i 0 0 cid.networks.relist
  .disable #TheArkive.Scriptnamehere.Server.Alias.Group
  server $1-
  .enable #TheArkive.Scriptnamehere.Server.Alias.Group
#TheArkive.Scriptnamehere.Server.Alias.Group end

This well allow any other /SERVER alias to also handle any action it needs to do in customizing mirc.
While the help file says if u call a command from within an alias of the same name it well run the orginal command, that isnt strictly true, it well not run the SAME alias, and as there can be only one functional alias of any command at any one time, it then jumps to the orginal command. However If u disable the group your alias is in, and a NEW alias becomes active then that alias well be run.

#davec.example1.join.alias.group on
alias join {
  echo -s join alias1 starts
  join $1-
  echo -s join alias1 ends
#davec.example1.join.alias.group end
#davec.example2.join.alias.group on
alias join {
  echo -s join alias2 starts
  join $1-
  echo -s join alias2 ends
#davec.example2.join.alias.group end

now if u join a channel you well see
join alias1 starts
join alias2 starts
(channel is joined in here)
join alias2 ends
join alias1 ends
© 2020 mIRC Discussion Forums