mIRC Home    About    Download    Register    News    Help

Print Thread
#106714 03/01/05 12:33 AM
Joined: Jan 2005
Posts: 3
B
Self-satisified door
OP Offline
Self-satisified door
B
Joined: Jan 2005
Posts: 3
I'm trying to keep variables for various users, for example, the number of times they post. To keep a new variable for each $nick I write:

/set % $+ $nick $+ Counter 0

Which creates the variable %baseuserCounter with the value 0.

But when I try to call this up:

/describe $chan % $+ $nick $+ Counter

The output just says:

%baseuserCounter

Instead of its value, 0.

Any help?

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
on *:Text:*:#channel: {
inc %BaseCounter. [ $+ [ $nick ] ]
}

Joined: Jan 2005
Posts: 3
B
Self-satisified door
OP Offline
Self-satisified door
B
Joined: Jan 2005
Posts: 3
Thank you but that was just an example; what I'm actually doing is trying to keep a huge number of variables for each user, about 60, so instead of assigning each user who enters a number and then corresponding the individual variable to the number like:

on *:TEXT:newgame*:#chan: {

if ($nick = %user1) {
set %user1HP 10
set %user1Def 1
}

if ($nick = %user2) {
etc...
}
}

instead I want to write it:

on *:TEXT:newgame*:#chan: {
set % $+ $nick $+ HP 10
set % $+ $nick $+ Def 1
}

But this doesn't work. I need to be able to write a script where each time it calls the script up the VARIABLE that it's checking changes based on the $nick of the user who typed it.

Sorry for not being more clear.

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Mmmm why don't you use /writeini for that kind of script where you can have..

$readini(game.ini,HP,$nick)
$readini(game.ini,Def,$nick)
$read(game.ini,Att,$nick)

[HP]
User1=Bob

[Def]
Bob=50

[Att]
Bob=20

etc..

Just a suggestion mate.

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
To retrieve the value, use
% [ $+ [ $nick ] $+ Counter ]
or
$eval($+(%,$nick,Counter),2)
or
$($+(%,$nick,Counter),2)

Your /set's are fine.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Jan 2005
Posts: 3
B
Self-satisified door
OP Offline
Self-satisified door
B
Joined: Jan 2005
Posts: 3
Thank you qwerty; everything works perfectly now.


Link Copied to Clipboard