mIRC Home    About    Download    Register    News    Help

Print Thread
7.05 Scid behaviour not working right #222318 16/06/10 03:42 PM
Joined: Jun 2009
Posts: 48
StrawberryKitty Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Jun 2009
Posts: 48
Basically in one of my scripts I am doing this:

Code:
//scid 1 if ($window(Status Window).state != maximized) { echo 4 -a yes }


And it's showing a yes on $cid 2 problem is the window on $cid 1 is actually maximised so nothing should happen.

Last edited by StrawberryKitty; 16/06/10 03:43 PM.
Re: 7.05 Scid behaviour not working right [Re: StrawberryKitty] #222319 16/06/10 04:06 PM
Joined: Jul 2006
Posts: 3,558
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,558
You seem to misunderstand /scid and /scon, /scon N use the Nth connexion, /scon 1 use the first connexion, /scon 2 the second etc.
For /scid it's completely different, each connexion has an associated number called connexion id, it can be anything, you should never assume the first connexion has a connexion id of 1.

Also, note that /scon and /scid double evaluate their parameters, in your case it's working because you only have one command, when mirc see the condition, it just see :
Code:
if ($window(Status Window).state != maximized) echo 4 -a yes
because the { and } has been evaluated
Code:
//scid 1 if ($window(Status Window).state != maximized) { echo 4 -a yes | echo -a yeah }
would not work as expected

Last edited by Wims; 16/06/10 04:07 PM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: 7.05 Scid behaviour not working right [Re: Wims] #222320 16/06/10 04:24 PM
Joined: Dec 2002
Posts: 339
D
drum Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Dec 2002
Posts: 339
Just to expand on what Wims has said, I'd suggest that when using the /scon or /scid, you should use it in one of two ways:

1.) Use "/scid N somealias" then make an alias "/somealias" to do what you want. This will avoid a few of the problems that are harder to anticipate.

2.) Use "/scid N", then on the next line do your if statement. (If you want to return to the original cid after that, you need to use "/scid -r".)

Re: 7.05 Scid behaviour not working right [Re: Wims] #222328 16/06/10 10:22 PM
Joined: Jun 2009
Posts: 48
StrawberryKitty Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Jun 2009
Posts: 48
Code:
//scon 1 if ($window(Status Window).state != maximized) echo 4 -a yes


This code does the same thing as /scid, so is this a bug?

Re: 7.05 Scid behaviour not working right [Re: StrawberryKitty] #222329 16/06/10 10:41 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Is this issue specific to 7.05? Does this not happen in 6.35? or 7.04?


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: 7.05 Scid behaviour not working right [Re: StrawberryKitty] #222332 16/06/10 11:47 PM
Joined: Jul 2006
Posts: 3,558
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,558
Ah, I see your problem now, the value of $window(status window).state is "normal" while you expect "maximized".
It is a bug for me, I can reproduce this on 6.35.

Last edited by Khaled; 17/06/10 09:22 AM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: 7.05 Scid behaviour not working right [Re: Wims] #222336 17/06/10 09:47 AM
Joined: Dec 2002
Posts: 4,521
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,521
It looks like this issue is related to the $window().state property, not /scid or /scon.

mIRC is actually reporting the window state correctly in this case. This is due to the way MDI windows work. When an MDI window is maximized, all other windows in the MDI container are changed to a non-maximized state by Windows. Only when the window becomes active is it set back to a maximized state.

I could make mIRC return a fake state value for a window if 1) the top, active window is maximized, and 2) the window you are checking is in a visible, restored state. That would resolve the issue, however it would not be returning the actual window state.

Re: 7.05 Scid behaviour not working right [Re: Khaled] #222343 17/06/10 01:19 PM
Joined: Jun 2009
Posts: 48
StrawberryKitty Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Jun 2009
Posts: 48
Yay Khaled, basically I was trying to fix odd behaviour in mIRC, I get some race condition that is breaking my script that I try very hard to work around. Anyway this should help...

I have mIRC set to startup with windows and when it does I get this.



Code:
Script:
on *:START: {
  scon 1 echo 4 @console Debug (active):2 $active
  scon 1 echo 4 @console Debug (network):2 $network
  scon 1 echo 4 @console Debug (cid):2 $cid
  scon 1 echo 4 @console Debug (server):2 $server
}

Output:
Debug (active):
Debug (network): Quakenet
Debug (cid): 1
Debug (server):


If I close mIRC and I restart it. It shows up normally with the first connection window as displaying. Here's what it's like when I restart it once my PC has booted.



Code:
Script:
on *:START: {
  scon 1 echo 4 @console Debug (active):2 $active
  scon 1 echo 4 @console Debug (network):2 $network
  scon 1 echo 4 @console Debug (cid):2 $cid
  scon 1 echo 4 @console Debug (server):2 $server
}

Output:
Debug (active): Status Window
Debug (network): Quakenet
Debug (cid): 1
Debug (server):


I don't know what this is but it drives me nuts, but I'm close to making a script to make mIRC behave it's just taking lots of messing around so hoping you can fix it ._.

Last edited by Khaled; 18/06/10 02:19 PM.