mIRC Home    About    Download    Register    News    Help

Print Thread
/!$command inside if-else/while statements #167206 21/12/06 09:50 AM
Joined: Feb 2003
Posts: 810
C
cold Offline OP
Hoopy frood
OP Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
I don't know if this was reported before, since it's difficult to search for this subject by entering anything other than short keywords.


In the past, people used "!" as a shortcut for /halt in events (especially RAW events). This was deprecated and doesn't seem to work anymore.
Other than that, "!" is used as a /command prefix to tell mIRC not to process the command as an alias, and also as a NOT modifier for most if-else/while operators.

That said, I guess mIRC isn't consistent with "!" inside an if-else/while statement in a single line. Try the test aliases below:
Code:
alias some_alias_here { return echo -ag * This $1 be echoed }
alias test1 { if (1) !$some_alias_here(WON'T) }
alias test2 { if (1) ! $+ $some_alias_here(WON'T) }
alias test3 { !$some_alias_here(WILL) }
alias test4 {
  if (1) {
    !$some_alias_here(WILL)
  }
}


Only /test3 and /test4 will work, and /test1 will also try to send "$some_alias_here(WON'T)" to the IRC server, forgetting to evaluate the identifier.
The behaviour above will be reproduced if you use /else or /while instead of /if.

It'll also work if you replace "! $+ $some_alias_here" by "$+(!,$some_alias_here)", but that's not really the point, since I'm talking about an inconsistence. That's not something urgent to fix, though.

Last edited by cold; 21/12/06 10:45 AM.

* cold edits his posts 24/7
Re: "! $+ $command" and if/else/while statements [Re: cold] #167208 21/12/06 10:18 AM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Another quirk to cherish and nurture :P
Doesnt seem to be ! related but rather $+ related
Code:
//noop $regex(lol,,//) | if (1) { . $+ noop $regex(lol,a,/(a)/) | echo -a $regml(lol,1) <-- ? } 

and
Code:
//noop $regex(lol,,) | if (1 == 1) { . $+ noop $regex(lol,a,/(a)/) | echo -a $regml(lol,1) <-- ? } 


Both dont work. however
Code:
//noop $regex(lol,,) | if (1 == 1) { .noop $regex(lol,a,/(a)/) | echo -a $regml(lol,1) <-- ? } 


Does smirk


$maybe
Re: "! $+ $command" and if/else/while statements [Re: Mpdreamz] #167209 21/12/06 10:27 AM
Joined: Feb 2003
Posts: 810
C
cold Offline OP
Hoopy frood
OP Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
I see you've replied to an "old" version of my post (I need to stop editing my posts like crazy, lol). Check it out and you'll see in the examples it's not really about the $+.

Edit(lol)
However, it seems you've spotted something between $+ and /noop. Even $+(!,noop) or $+(.,noop) won't work:
Code:
//$+(!,noop) $regex(a,(.)) | echo -ag $regml(1)


Sorry, that didn't work because I was trying the code from the editbox (which doesn't allow that anymore).
Yeah, I guess there's something between if-else/while and $+ as well.

Last edited by cold; 21/12/06 10:46 AM.

* cold edits his posts 24/7
Re: "! $+ $command" and if/else/while statements [Re: cold] #167213 21/12/06 11:20 AM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Yes that does seem peculiar what strikes me though is that
alias test1 { !$some_alias_here(WILL) } works. ! and . are (as you stated) command prefixes and are expected not to work in this case since the special meanings ! and . are not carried down to the the procedure $some_alias_here calls.

IMO it should not work to begin with :P

I guess this is $.somemircident and $/somemircident ugly sibling.

Bug still stands though if !$someident works so should ! $+ $someident in those cases you mentioned.

Some other !. weirdness smile
Code:
alias myalias { inc %someglobalvar | return %someglobalvar }
alias test6 { 
  !! echo -a this doesn't trigger $myalias 
  ! echo -a trigger $myalias 
  !. echo -a trigger $myalias 
}

will !! be the new "elitist" comment style? :P


$maybe