mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 509
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
alias seen {
%nick = $1
set -u30 %readn $+ %nick 0
$read() stuff
set -u30 %readn $+ %nick $readn
echo -a %readn $+ %nick
echo -a $readn
}

At the end of the alias.

%readn $+ %nick always says 0, different than $readn

I've tried

echo -a $+(%readn,%nick)
echo -a $+(%,readn,%nick)
echo -a $+($eval(%readn,%nick),2)
echo -a $+($eval(%,readn,%nick),2)

None luck.

Since %nick = $1, in the alias, I also used $1 too.

alias seen {
%nick = $1
set -u30 %readn $+ $1 0
$read() stuff
set -u30 %readn $+ $1 $readn
echo -a %readn $+ $1
echo -a $readn
}

%readn $+ $1 also always says 0, different than $readn

I've tried

echo -a $+(%readn,$1)
echo -a $+(%,readn,$1)
echo -a $+($eval(%readn,$1),2)
echo -a $+($eval(%,readn,$1),2)

Still none like $readn.

Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
You're doing the $eval() backwards:

Code:
echo -a Value: $eval($+(%,readn,%nick),2)

In this, there are about 3 things you need to be aware of:

- String concatenation : $+()
- Separation of variable componants : %, readn, %nick
- Double-evaluation : $eval(<string>,2)

The first part is making up your full variable name '%readnLostShadow'.

The second part is the breaking up of '%' and 'readn'. As you're double-evaluating next, you don't wand '%readn' to be evaluated yet, thus the splitting up.

The third part is the two-pass evaluation. The first pass does this (where '%nick = LostShadow'):

Code:
$+(%, readn, %nick) -> %readnLostShadow

The second pass then evaluates the resultant string.

Throughout this, you can use either %nick or $1. Using $1 will probably make it easier/faster however.

Here's a question for you however.. You're using 'set -u30'. As you are zeroing out the %readn<nick> variable every time you execute it, is there really any reason for the variable to stick around for 30 seconds? I'd suggest you use '/var' instead, a localized variable which unsets once complete.

Joined: Jan 2004
Posts: 509
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
Alright, thank you so much. Everything works great now. Althought I needed to use the %variable instead of $1.


Link Copied to Clipboard