mIRC Home    About    Download    Register    News    Help

Print Thread
#58367 30/10/03 02:34 AM
Joined: Jul 2003
Posts: 733
M
MTec89 Offline OP
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Jul 2003
Posts: 733
mirc needs global away!

#58368 30/10/03 02:54 AM
Joined: Dec 2002
Posts: 1,518
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,518
thats what /scon is for

#58369 30/10/03 02:58 AM
Joined: Jul 2003
Posts: 733
M
MTec89 Offline OP
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Jul 2003
Posts: 733
how would i do that?
i still say mirc needs /away -g

#58370 30/10/03 03:30 AM
Joined: Dec 2002
Posts: 1,518
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,518
$scon(0) give the network connection count $scon(1) returns name of 1st network using a while loop u can then loop thru all netorks and set yourself away. its simple scripting and if u cant do it im sure someone could give u a lesson in its uses, if u want to learn type /help $scon and for while loops /help while loops

#58371 30/10/03 03:36 AM
Joined: Dec 2002
Posts: 3,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
Or you could just use /scon -at1 away Pokemon smile

#58372 30/10/03 04:17 AM
Joined: Dec 2002
Posts: 1,518
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,518
yeah again i forget about that -a being there for all networks ty for the reminder again

#58373 30/10/03 12:20 PM
P
pheonix
pheonix
P
alias away {
if ($1 != -g) { !away $1- }
elseif ($1 == -g) { scon -a !away $2- }
else { !away }
}

#58374 30/10/03 04:29 PM
Joined: Feb 2003
Posts: 806
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 806
You don't need that last else statement (picky, lol :tongue:)

#58375 30/10/03 04:41 PM
P
pheonix
pheonix
P
without the else { }
i would need:

alias away {
if ($1 != -g) { !away $1- | return }
elseif ($1 == -g) { scon -a !away $2- | return }
!away
}

because if i just had:

alias away {
if ($1 != -g) { !away $1- }
elseif ($1 == -g) { scon -a !away $2- }
!away
}
that would set me as away then set me as back, or just set me as back crazy.


#58376 30/10/03 04:47 PM
E
EVH
EVH
E
or ...
Code:
alias away $iif($1 == -g,scon -at1 !away $2-,!away $1-)


/away -g this is my multi-net away smile

Last edited by EVH; 30/10/03 04:51 PM.
#58377 30/10/03 04:53 PM
Joined: Feb 2003
Posts: 806
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 806
But I didn't say you'd need that last !away either. I mentioned the else statement (meaning, the whole line).
Code:
alias away {
  if ($1 != -g) { !away $1- }
  elseif ($1 == -g) { scon -a !away $2- }
}

Your last else statement would cover $1 being $null, however the if statement already covers this ($null != -g). That's what I was talking about.. smile

#58378 30/10/03 04:58 PM
P
pheonix
pheonix
P
oh:
if ($1 != -g) works even if $1 doesn't exist?

#58379 30/10/03 05:01 PM
Joined: Feb 2003
Posts: 806
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 806
Yup.. you might want to optimize some of your code if you didn't know about this one.
BTW, take a look at EVH's alternative, that would be a better one in similar cases.

Last edited by cold; 30/10/03 05:03 PM.
#58380 30/10/03 05:05 PM
P
pheonix
pheonix
P
i thought: if ($1 != -g) { /this would only work if $1 existed }
i never use stuff like that, i just use /return.
i don't have a single else { } in my script.

#58381 30/10/03 05:14 PM
Joined: Feb 2003
Posts: 806
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 806
That /return method is not always as efficiently applicable, so I'd rather use /else(if), but it's ok doing the job anyway I think, as long as it's some personal stuff and/or code readability and speed aren't needed for everyone to use. If the latter is the case, however, I'd say give a chance to /else(if) and $iif() :tongue:

PS: my signature doesn't lie..

#58382 30/10/03 05:25 PM
P
pheonix
pheonix
P
i use $iif at least 60 times in my picwin project =d

#58383 30/10/03 07:20 PM
Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
I'd use this:
Code:
alias away {
  if $1 == -g { 
    var %a = $2-
    scon -at1 !away % $+ a 
  }
  else away $1-
}
1) I can't stress this enough... using $1-, $2-, $did(), $input() and generally variables/identifiers of unknown content in /scon -a is not a good idea. /scon adds an extra evaluation level. This can lead to unwanted evaluations which, in the worst case, can even be dangerous. For example, if one typed //away $!me is away, one would expect the away message to be "$me is away" but in fact it will be "cold is away". Now imagine that with something as nasty as $findfile()...
I used % $+ a, so that the command executed across networks will be "!away %a" and not "!away <evaluated $2->".

2) The -t1 switch is necessary if you don't want mirc to halt with an error if one of the sessions isn't connected.

3) Minor detail, but you don't need the exclamation mark for the first /away, as it is a fact that an alias cannot call itself directly. So any /away command within the alias will be treated as the default mirc command. This is not the case with /scon though, so the ! is necessary there.

#58384 30/10/03 09:26 PM
Joined: Feb 2003
Posts: 806
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 806
Thanks, I was aware of the extra evaluation thing. I forgot to warn them because I was talking only about the else statement thing, not really looking at anything else (i.e. the -t1 switch, which was already mentioned above). Good for everyone to read this though.. smile
Personally, I wouldn't use a -g switch anyway crazy


Link Copied to Clipboard