mIRC Homepage
Posted By: state save nicks to text file(nick was also newnick) - 21/06/09 05:08 PM
Sorry about title, tryed to get the best explanation.

basically when a user joins a channel i want it to write to a text file(or something better if u suggest)

nick address

then next time if a nick joins under a different name it saves it as

newnick address was also nick

make sense?
the best way i can think of is to save to an ini file

address=nick
and
nick=address
then you can have the script perform differant lookups

by looking up the address if the nick is differant result = newnick used to be oldnick

by looking up the nick if the nick exists and the address is differant then result = nick is connecting on a differant ip address
i have no idea how to do any of that grin
Alternatives include using a hash table and using an ini file.

For the hash table you would use something like
Code:
on *:join:#:{
.hadd -m Nicks $address $addtok($hget(Nicks,$address),$nick,32)
}
on *:nick:{
.hadd -m Nicks $address $addtok($hget(Nicks,$address),$newnick,32)
}

Now this will only store the information into the hash table, which is stored in RAM, thus, if you want to preserve the information between sessions, you will also need to save the information using the /hsave command, as well as load the information when the script starts using /hload

Recommended reading /help hash tables.

If you want the information to be displayed, you'll need to use $hget and/or $hfind, depending on just what information you actually want displayed.

The big advantage to using a hash table rather than a text or ini file, is that it is extremely fast, thus if you have a lot of people join the channel in a short period of time (such as after a netsplit), a hash table will be able to keep up with the modifications necessary, but a text or ini file might not, due to the speed limitation of having to access the hard drive.
© mIRC Discussion Forums