mIRC Home    About    Download    Register    News    Help

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


http://MTec89Net.com
irc.freenode.net #MTec89Net
#58368 30/10/03 02:54 AM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
thats what /scon is for


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


http://MTec89Net.com
irc.freenode.net #MTec89Net
#58370 30/10/03 03:30 AM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
$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


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

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


D3m0nnet.com
#58373 30/10/03 12:20 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
alias away {
if ($1 != -g) { !away $1- }
elseif ($1 == -g) { scon -a !away $2- }
else { !away }
}


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


* cold edits his posts 24/7
#58375 30/10/03 04:41 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
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.



new username: tidy_trax
#58376 30/10/03 04:47 PM
Joined: Oct 2003
Posts: 273
E
EVH Offline
Fjord artisan
Offline
Fjord artisan
E
Joined: Oct 2003
Posts: 273
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: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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


* cold edits his posts 24/7
#58378 30/10/03 04:58 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
oh:
if ($1 != -g) works even if $1 doesn't exist?


new username: tidy_trax
#58379 30/10/03 05:01 PM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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.

* cold edits his posts 24/7
#58380 30/10/03 05:05 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
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.


new username: tidy_trax
#58381 30/10/03 05:14 PM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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..


* cold edits his posts 24/7
#58382 30/10/03 05:25 PM
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
i use $iif at least 60 times in my picwin project =d


new username: tidy_trax
#58383 30/10/03 07:20 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#58384 30/10/03 09:26 PM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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


* cold edits his posts 24/7

Link Copied to Clipboard