Code:
if ($($+(%,usergiveawaytoken,$nick),2) >= 4) { }


Basically, this will evaluate the variable %usergiveawaytokennick and if it's >= 4, then you'll do something with it, such as add it to your list. The "nick" on the variable is whatever $nick returns.

That being said, if you're storing tokens for many people, you'll probably be better off using a hash table. Then you won't have a lot of variables. A hash table is usually better than variables any time you need to store a lot of data of the same type and want easy access to it. In this case, you're storing the same type of data (tokens) for many users and want to quickly access how many tokens each user has, so it is a good option for you. It's also very easy to add and remove users as needed and you can easily store their $ctime if you want it to remove after X amount of time.

If you're interested in hash tables, check into the following and see where you get from there.

/help hash tables

A hash table has items and data. For example, item1=data1 and item2=data2. If you store your tokens like this: nick=#tokens, then using the data is as easy as:

Code:
// Check if it's $nick has >= 4 tokens
if ($hget(tablename,$nick) >= 4) { }

// Increment the tokens for $nick
hinc tablename $nick

// Remove the nick
hdel tablename $nick


Just remember that hash tables are not automatically saved to disk. If you close mIRC, any data in a hash table will be lost. If you want the data to be persistent, you'll need to save the data yourself using /hsave. You can do this every time you add/update the data, or on a timer.


Invision Support
#Invision on irc.irchighway.net