mIRC Home    About    Download    Register    News    Help

Print Thread
Variable variables :D #120333 16/05/05 11:21 PM
Joined: May 2005
Posts: 2
L
LaCN Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
L
Joined: May 2005
Posts: 2
Hi, I'm making a counting script, which counts words...

so, here's what I did:

- make variable or add 1 to it
set %temp $1
inc $+(%,%temp) 1

but I also could just do: inc $+(%,$1) 1

That's fine, and it works....

now I want it to show to peeps...
so, if they type !show word

it should do something like /msg $chan $2 has been used: %word times

So... I have this:
/msg $chan $2 has been used: $+(%,$2) times

but it outputs %word, in stead of a number frown


In php, I would use: $$word

what can I do ?

Re: Variable variables :D #120334 16/05/05 11:33 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
I'm not going to write any samples for this, but you will want to use a hash table
type /help hash table in mIRC

Re: Variable variables :D #120335 17/05/05 01:43 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Try formatting it like:

% [ $+ [ $2 ] ]

That said, a hash table would make more sense.


Invision Support
#Invision on irc.irchighway.net
Re: Variable variables :D #120336 17/05/05 07:44 AM
Joined: May 2005
Posts: 2
L
LaCN Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
L
Joined: May 2005
Posts: 2
Thank you both very much, it works now, and when I have time, I'll check abt those hashtables smile

Re: Variable variables :D #120337 17/05/05 12:09 PM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
$($+(%,$2),2) should work too have it be evaluated a 2nd time


$maybe