mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2005
Posts: 2
B
Bowl of petunias
OP Offline
Bowl of petunias
B
Joined: Aug 2005
Posts: 2
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

Joined: Jun 2005
Posts: 44
B
BNX Offline
Ameglian cow
Offline
Ameglian cow
B
Joined: Jun 2005
Posts: 44
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

Last edited by BNX; 30/08/05 10:56 PM.
Joined: Aug 2005
Posts: 2
B
Bowl of petunias
OP Offline
Bowl of petunias
B
Joined: Aug 2005
Posts: 2
what does parsing mean and what does it do? thx...

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
//set -u5 %q t | set %t 5 | echo -a $($+(%,%q),2)

-Andy

Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
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.

Joined: Jun 2005
Posts: 44
B
BNX Offline
Ameglian cow
Offline
Ameglian cow
B
Joined: Jun 2005
Posts: 44
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


Link Copied to Clipboard