mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2004
Posts: 8
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Feb 2004
Posts: 8
It's an old problem that I'd hoped had been fixed by now, but it's still here:

ex.:
/set %test %test2
/set %test2 proof-of-concept
Here %test2 will return "proof-of-concept"

Now I can reset %test2 by forcing an evaluation in a script:
/set [ [ %test ] ] success
And from now on %test2 will return "success"

HOWEVER:
Should I want to delete %test2 this way it will fail:
/unset [ [ %test ] ] will not unset %test2, it will ignore the forced evaluation and unset %test instead.

The bug is reproducible and has been encountered by me frequently.
Is it a known problem ?

Joined: Oct 2003
Posts: 18
L
Pikka bird
Offline
Pikka bird
L
Joined: Oct 2003
Posts: 18
Confirmed, sorry, I don't have a solution for you however ;p

Joined: Feb 2004
Posts: 8
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Feb 2004
Posts: 8
Oh well, I usually make due with setting the variable to another value (such as "unset", "no", etc...) depending on the situation.

Just thought I'd let you guys know just in case...

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
If you need a workaround, just use //unset $(%test)


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Oct 2003
Posts: 18
L
Pikka bird
Offline
Pikka bird
L
Joined: Oct 2003
Posts: 18
Interesting, from the help file:

$(...)
This identifier can only be used in the text match section of an event definition.

So I would have assumed it wouldn't work in an /unset.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
$(...) outside of a matchtext section is basically $eval(...)

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
$() is actually a shorter equivalent of $eval(), when used outside the <matchtext> field.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
$() is a shortcut for $eval, although in an event matchtext/location part you can only use the shortcut (and without specifying a level of evaluation). In all other uses $() and $eval() are identical.

EDIT: Drat, cursed with qwerty's old habit again, ironically losing to him! Oh yea and hixxy too ROFL. All posted in the same minute grin


Gone.
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
I win cool

Joined: Oct 2003
Posts: 18
L
Pikka bird
Offline
Pikka bird
L
Joined: Oct 2003
Posts: 18
Well, each preceding post added more detail, so it's all good ;p

Joined: Feb 2006
Posts: 3
S
Self-satisified door
Offline
Self-satisified door
S
Joined: Feb 2006
Posts: 3
/set [ [ %test ] ] success
; bad set value


the set is;

set % [ $+ [ test ] ] success
unset % [ $+ [ test ] ]

Joined: Feb 2004
Posts: 8
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Feb 2004
Posts: 8
Quote:
/set [ [ %test ] ] success
; bad set value


the set is;

set % [ $+ [ test ] ] success
unset % [ $+ [ test ] ]


What are you talking about ?
I took the liberty of testing those -just to make sure- and as I expected, neither of them work.

Joined: Jul 2005
Posts: 7
F
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
F
Joined: Jul 2005
Posts: 7
BlueGhost, what ScreeM is talking about is dynamic variables...

lets say you have a while loop

while (%i <= %number) {

and you want to create variables as the loop runs, then you can use evaluation brackets to force new variables to be created:

var %var. [ $+ [ %i ] ] what-you-want-it-set-to

everytime that loop runs a set of vars will be created with whatever the loop pulled up.
These can also be unset in the loop by having:

unset %var. [ $+ [ %i ] ]

if we didn't use the evaluation brackets the loop would create one var: %var.%i (literally %i) which is what we don't want... hoped this helped...

P.S. the equal sign is not used when creating this local variable b/c the variable would include it in whatever was set (quirky, I know)

Last edited by FTLNewsFeed; 19/02/06 06:00 AM.
Joined: Jun 2004
Posts: 20
C
Ameglian cow
Offline
Ameglian cow
C
Joined: Jun 2004
Posts: 20
FTLNewsFeed, what BlueGhost is looking for seems to be a pointer.
And hes right it dosnt work for unset, but you can use eval in stead to get the right behaviour.
Code:
alias test {
  set %test % $+ test2
  set %test2 proof-of-concept
  echo -a %test2 will return "proof-of-concept"

  set [ [ %test ] ] success
  echo -a %test2 will return "success"

  ; unsets %test2
  unset $eval(%test, 1)
  ; unsets %test
  unset [ [ %test ] ]
}

Last edited by Cork; 19/02/06 07:19 AM.
Joined: Jul 2005
Posts: 7
F
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
F
Joined: Jul 2005
Posts: 7
Cork, when I tried your code I got:

* Set %test to %test2
* Set %test2 to proof-of-concept
proof-of-concept will return "proof-of-concept"
* Set %test2 to success
success will return "success"
* Unset %test2
* /unset: insufficient parameters (line 62, aliases.ini)

(I added the -s switches and tried it in Aliases without the 'alias' and Remotes with it just to be sure)

but... when I chaged the last line to:

unset % [ $+ [ test ] ]

it worked like a charm and I got:

* Set %test to %test2
* Set %test2 to proof-of-concept
proof-of-concept will return "proof-of-concept"
* Set %test2 to success
success will return "success"
* Unset %test2
* Unset %test

but I get what BlueGhost is saying, I was trying to explain where ScreeM was coming from and why BG wasn't getting the same results.


Link Copied to Clipboard