mIRC Homepage
Posted By: bahblahblahbah Pointer of a sort...doesn't work - 30/08/05 10:48 PM
I have kind of a pointer variable but I can't seem to use it.

The "pointer variable" is %q. It holds the name of another variable. However I can't seem to get the value of the variable it points to.
For example.

%q = t
/set %t 5

So How would i get the value of %t using %q?
I've tried $+(%,%q), but it treats returns %t instead of the value of %t.
Thx in advance grin
Posted By: BNX Re: Pointer of a sort...doesn't work - 30/08/05 10:55 PM
you need call t as a variable AND parse it first.. for example try this:

%q = [ %t ]
/set %t 5

depending on how this is used, you may have to define %t before this or else it will assign null for %q
Posted By: bahblahblahbah Re: Pointer of a sort...doesn't work - 30/08/05 10:57 PM
what does parsing mean and what does it do? thx...
Posted By: SladeKraven Re: Pointer of a sort...doesn't work - 30/08/05 10:59 PM
//set -u5 %q t | set %t 5 | echo -a $($+(%,%q),2)

-Andy
Posted By: Kelder Re: Pointer of a sort...doesn't work - 30/08/05 11:29 PM
var %t = 5
var %q = % $+ t
; OR var %q = $+(%,t)
echo -s t= %t ; q= %q ; *%q= [ [ %q ] ] or $eval(%q,2) or $(%q,2)

If you want another level of indirection:
var %s = % $+ q
echo -s s= %s ; *%s= [ [ %s ] ] or $eval(%q,2) ; **%s = [ [ [ %s ] ] ] or $eval(%q,3)

Mind that /set keeps the %var from evaluating, since otherwise you can never set a var:
/set %t 5 -> %t is NOT evaluated, or it would be /set 5 which has no meaning crazy
So, /set [ [ %q ] ] 1 is the same as /set %t 1, and /set $(%q) 1 too.

Just experiment with it, mind that you need // before all stuff when you test it in a channel or status window (only then, in scripts everything is presumed to be a command and start with //)
/set %h blah
/set %t %h -> t has the value %h (percent h)
//set %t %h -> t has the value blah

In a script set %t %h, /set %t %h and //set %t %h all give %t the value blah.
Posted By: BNX Re: Pointer of a sort...doesn't work - 31/08/05 12:09 AM
Quote:
what does parsing mean and what does it do? thx...


Parsing is what your computer does when it "works" on code. When it decodes, analysis or whatever.

If I was to parse a "eat(donut);" ... when parsing time comes, I would eat the donut...

Get it? :P
© mIRC Discussion Forums