mIRC Home    About    Download    Register    News    Help

Print Thread
/unset not accepting forced evaluation of variable #142642 18/02/06 07:12 PM
Joined: Feb 2004
Posts: 8
B
BlueGhost Offline OP
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 ?

Re: /unset not accepting forced evaluation of vari #142643 18/02/06 07:17 PM
Joined: Oct 2003
Posts: 18
L
Limerick Offline
Pikka bird
Offline
Pikka bird
L
Joined: Oct 2003
Posts: 18
Confirmed, sorry, I don't have a solution for you however ;p

Re: /unset not accepting forced evaluation of vari #142644 18/02/06 07:18 PM
Joined: Feb 2004
Posts: 8
B
BlueGhost Offline OP
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...

Re: /unset not accepting forced evaluation of variable #142645 18/02/06 07:22 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
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
Re: /unset not accepting forced evaluation of vari #142646 18/02/06 07:31 PM
Joined: Oct 2003
Posts: 18
L
Limerick Offline
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.

Re: /unset not accepting forced evaluation of vari #142647 18/02/06 07:33 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
$(...) outside of a matchtext section is basically $eval(...)

Re: /unset not accepting forced evaluation of vari #142648 18/02/06 07:33 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
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
Re: /unset not accepting forced evaluation of vari #142649 18/02/06 07:33 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
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.
Re: /unset not accepting forced evaluation of vari #142650 18/02/06 07:37 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
I win cool

Re: /unset not accepting forced evaluation of vari #142651 18/02/06 07:38 PM
Joined: Oct 2003
Posts: 18
L
Limerick Offline
Pikka bird
Offline
Pikka bird
L
Joined: Oct 2003
Posts: 18
Well, each preceding post added more detail, so it's all good ;p

Re: /unset not accepting forced evaluation of variable #142652 18/02/06 11:03 PM
Joined: Feb 2006
Posts: 3
S
ScreeM Offline
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 ] ]

Re: /unset not accepting forced evaluation of vari #142653 18/02/06 11:30 PM
Joined: Feb 2004
Posts: 8
B
BlueGhost Offline OP
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.

Re: /unset not accepting forced evaluation of vari #142654 19/02/06 05:57 AM
Joined: Jul 2005
Posts: 7
F
FTLNewsFeed Offline
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.
Re: /unset not accepting forced evaluation of vari #142655 19/02/06 07:18 AM
Joined: Jun 2004
Posts: 20
C
Cork Offline
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.
Re: /unset not accepting forced evaluation of vari #142656 19/02/06 09:45 PM
Joined: Jul 2005
Posts: 7
F
FTLNewsFeed Offline
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.