|
|
Joined: Jun 2004
Posts: 139
Vogon poet
|
OP
Vogon poet
Joined: Jun 2004
Posts: 139 |
Hi all, How do you use $nick to make up a variable name?
Thanks
Ninko
|
|
|
|
Joined: Dec 2002
Posts: 2,033
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,033 |
Give an example of how you want to use it.
|
|
|
|
Joined: Jun 2004
Posts: 139
Vogon poet
|
OP
Vogon poet
Joined: Jun 2004
Posts: 139 |
Hi RoCk, So I can store info against a certain user, eg if say 'user123' started a command I would like to create a variable called say, %test_user123
Thanks
Ninko
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
on *:text:!*:#:{
set $+(%,$nick) $1-
}
When a nick issues a command starting with the ! character, then the command and the parameters for the command are stored in a variable name for the person that issued the command. To reference the value of the variable, you would use something like on *:text:!view*:?:{
if $nick == my_nick {
.msg $nick $$2 $iif(!$($+(%,$$2),2),has not issued a command,has issued command $v1)
}
}
|
|
|
|
Joined: Jun 2004
Posts: 139
Vogon poet
|
OP
Vogon poet
Joined: Jun 2004
Posts: 139 |
Hi RusselB, Thanks for your help, thats what I wanted. I was close to how I was trying to get it to work. The way I was doing it would have made...
on *:text:!*:#:{
set $+(%,$nick) $1-
}
Become...
on *:text:!*:#:{
$+(%,$nick) = $1-
}
Which returned an error for me, not actually sure why, I'm sure you lot know why though lol. Thanks Ninko
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Error is probably due to the fact that there's no set command in the line, so mIRC doesn't know that you want to set the variable.
Please note that with this type of variable, you can not use the /var command to make them local variables.
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
Please note that with this type of variable, you can not use the /var command to make them local variables. You can, just not with $+(); plain old $+ works: //var -s % $+ $me 42 That said, it makes little sense to create dynamic local variables.
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Jul 2006
Posts: 4,193
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,193 |
Can also with $+() form using set -l
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
Yeah, I just avoided using an undocumented feature as an example.
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
|
|