mIRC Home    About    Download    Register    News    Help

Print Thread
Help Needed with Dynamic %Variables #84583 30/05/04 07:37 AM
Joined: Dec 2002
Posts: 99
M
MDA Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Dec 2002
Posts: 99
Greetings and Well Met,

I'm stumped how to dynamically script a %variable.
The task at the moment is to create a addon which writes a single log for each of the various kicks, spectator list, porn list, ban list etc. for each of our hosting staff based upon that hosts nicname ($nicname.txt), this section was easy and already done.

I want to expand upon this report to include the dynamics of frequency of useage (time) and a counter for each of our removal tool based upon each of our hosting staff's nicnames. My problem however is assigning a dynamic variable which relates to a hosts name without previously and manually handcoding each one seperately.

I'm trying to code and use something like this:

set %host($nick) %whatever

which would then permit me to setup the useage counters and then seperately time frequencys for each of our removal tools per specific host without first having to go thru and manually setup a %variable for each host beforehand,

example %hostMysticalSilkie


Thanks for your time and consideration,
MDA

Re: Help Needed with Dynamic %Variables #84584 30/05/04 10:19 AM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
To set a dynamic variable:
set $+(%, host, $nick) %whatever

The important part to notice here is that the '%' and the word 'host' should be separated, otherwise mIRC will try to evaluate the variable '%host' and try to use it's value as part of the dynamic variable name.

To get a dynamic variable's value:
echo -a [color:red]$eval($+(%, host, $nick),2)[/color]
The bit in red is to show what's changed between the two. $eval() makes something evaluate however many times you want, so we make it evaluate the contents twice - once to get the dynamic variable name (ie. %hostMysticalSilkie), and then once more to get the value of that variable.

Hope that helps, or at least didn't make things more confusing.


Spelling mistakes, grammatical errors, and stupid comments are intentional.