mIRC Home    About    Download    Register    News    Help

Print Thread
#133745 24/10/05 05:04 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline OP
Hoopy frood
OP Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I think it'd be nice it we could change the scope an identifier is called in to the calling script, for example:

Code:
alias im return $::ifmatch
//if (x == y) echo -a $im


$im would be the same as $ifmatch, rather than $null because $ifmatch was called in the scope of the calling script, not the $im identifier.

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
In case of $ifmatch/$ifmatch2/$v1/$v2 it already works:

alias im return $ifmatch

//if (5 isnum) echo -a $im

($ifmatch is a sort of global variable, much like &binvars)

In fact I can't think of any case where this cannot be done the above way, except for $1, $2, $1- etc but who would want to make a replacement for them? They are as short as they can be already. Can you think of any other example where this would be useful?


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline OP
Hoopy frood
OP Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Your post made me look at my code again. It was a stupid mistake on my part:

Code:
alias im return $ifmatch
alias test {
  if ([color:red]![/color]$1) echo -a $im
}


The ! shouldn't have been there.

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Now I'm thoroughly confused. I never saw any "!" in any of your posts and I'm not sure how it fits in here. The code in your 2nd post works fine, but I don't see how it is an example of the usefulness of the proposed feature.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
I'm thinking perhaps hixxy realised that we're able to "return $ifmatch" hehe.. and just realised the code that he/she originally used, was the reason it didn't work. That's just my guess though..

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Heh that does make perfect sense. Funny how sometimes you miss the obvious...


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline OP
Hoopy frood
OP Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Spot on smile


Link Copied to Clipboard