mIRC Home    About    Download    Register    News    Help

Print Thread
TXT File Question #205966
04/11/08 08:49 PM
04/11/08 08:49 PM
Joined: Oct 2007
Posts: 214
B
Buggs2008 Offline OP
Fjord artisan
Buggs2008  Offline OP
Fjord artisan
B

Joined: Oct 2007
Posts: 214
Hello,

Due to the complexity of data that I wish to store, I have gone ahead and chose to use a txt file database.

What I would like to do is come up with an alias to read the text file database and return certain attributes about a piece of data.

Example of what's in the txt file (userinfo.txt):

nickname1 48203948230948023890 123.124.125.123
nickname2 2378912@430923423448 123.125.123.698
nickname3 4324923@312484324447 125.125.125.132

Request #1

Lets say for example I would like to get information related to nickname2 $getinfo(nickname2) would return: "nickname2's address is: 2378912@430923423448 and their IP is: 123.125.123.698

Request #2
Let's say I would like to get information based on solely the address: $getinfo(2378912@430923423448) would return " Address: 2378912@430923423448 belongs to: Nickname2, and their IP is: 123.125.123.698

Request #3

Let's say I would like to get information based solely on the ip address: $getinfo(123.125.123.698) would return: the ip address: 123.125.123.698 belongs to Nickname and their address: is 2378912@430923423448

How in the world would I come up with this type of complex code?

I appreciate all your help and support.

Thanks a bunch in advance,

Cheers,

Jay

Re: TXT File Question [Re: Buggs2008] #205968
04/11/08 09:05 PM
04/11/08 09:05 PM
Joined: Jul 2006
Posts: 3,515
France
W
Wims Offline
Hoopy frood
Wims  Offline
Hoopy frood
W

Joined: Jul 2006
Posts: 3,515
France
Generally, you would have to use another parameter to know which info you're requesting, but here, you know that if the params has a '@', it's an address, if there is a '.', it's an ip, else, its a nickname :
Code:
alias getinfo {
noop $read(userinfo.txt,w,$+(*,$$1*))
noop $regex($read(userinfo.txt,$$readn),/(.+) (.+) (.+)/)
if (. isin $1) return nick : $regml(1) address : $regml(2)
elseif (@ isin $1) return nick : $regml(1) Ip : $regml(3)
else return address : $regml(2) Ip : $regml(3)
}


I've not tested, but it should work

Last edited by Wims; 04/11/08 09:06 PM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net