mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2009
Posts: 295
P
pball Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
I'm not sure if you'd call this a bug, but two similar commands do not function the same.

A variable set with -uN then incremented with /inc will still unset after N seconds.
A hash item set with -uN then incremented with /hinc will not unset after N seconds.

example
Code:
//set -u2 %test 1 | echo -a %test | /inc %test | echo -a %test | .timer 1 3 echo -a %!test
//hadd -mu2 test test 1 | echo -a $hget(test,test) | hinc test test | echo -a $hget(test,test) | .timer 1 3 echo -a $!hget(test,test) | .timer 1 4 hfree test

the //set example echos 1, 2, * /echo: insufficient parameters
the //hadd exmaple echos 1, 2, 2

The first output is expected, but the second shows a different behavior.


http://scripting.pball.win
My personal site with some scripts I've released.
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
in case you haven't realized yet, %!test does not evaluate to produce plaintext %test but rather the value of a variable named %!test since '!' is a valid part of a variable name. $!identifier does evaluate to produce $identifier but that's simply because a leading '!' is part of identifier syntax.

as you observed, modifying the variable or hash table item cancels the effect of any switches used previously.


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Nov 2009
Posts: 295
P
pball Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
@jaytea
Ok sorry then I just messed that up a little bit, to get around that use $!($+(%,test),2) which evaluates to value of %test when the timer goes off

Also you said modifying the variable or hash table item cancels the effect, that is wrong variables don't lose the unset time. That should be shown by how the two examples behave differently

corrected example (still produces the same output)
Code:
//set -u2 %test 1 | echo -a %test | /inc %test | echo -a %test | .timer 1 3 echo -a $!($+(%,test),2)


So would anyone else consider this a bug or is it just two similar commands behaving differently?


http://scripting.pball.win
My personal site with some scripts I've released.
Joined: Dec 2002
Posts: 5,424
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,424
Thanks, it would probably make sense for hinc/hdec to behave the same way as inc/dec. Unless someone thinks there might be a backwards-compatibiliy issue, the behavior will be changed for the next version.

Joined: Nov 2009
Posts: 295
P
pball Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
Thanks for the reply Khaled, I'll be looking forward to the next version and all future versions of mirc.


http://scripting.pball.win
My personal site with some scripts I've released.
Joined: Apr 2003
Posts: 342
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
It's not just /hinc... /hadd -u0 doesn't function the same way /set -u0 does... /hadd -u0 does not unset the added data. It has to be a number greater than 1 (/hadd -u1).


Beware of MeStinkBAD! He knows more than he actually does!
Joined: Dec 2002
Posts: 5,424
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,424
Thanks, this will be changed in the next version as well.


Link Copied to Clipboard