mIRC Home    About    Download    Register    News    Help

Topic Options
#137681 - 17/12/05 12:52 PM || find the correct id ||
SkyD Offline
Babel fish

Registered: 04/02/05
Posts: 74
Loc: Latvia
I can't find solution for that:

Now i make a bot, and one of his command is: !weapon

I have a directory: /weapons/
Those content:

knife.txt - ID 1
pistol.txt - ID 2
fork.txt - ID 3

The ID is on the line 15

If someone writes !weapon 2 need to check all files in the /weapons/ directory..
And if find the ID then set %find_id 2 set %murder pistol

And then i will check
if ($1 == %find_id) { msg $nick the murder is: %murder and the murder's id is %find_id
} else { msg $nick can't find murder..
}
_________________________
[color:red]m[color:blue]IRC[color:green] for EvEr


Top
#137682 - 17/12/05 01:05 PM Re: || find the correct id ||
SkyD Offline
Babel fish

Registered: 04/02/05
Posts: 74
Loc: Latvia
hmm. I think its right:
set %i 1
set %i_id $1
while (%i <= %i_id) {
set %i_id $+($read($findfile(weapons/,*.txt,%i),15))
set %find $+($read($findfile(weapons/,*.txt,%i),14))
inc %i
}
if ($1 == %i_id) {
msg $nick %i_id = %find
}
_________________________
[color:red]m[color:blue]IRC[color:green] for EvEr


Top