mIRC Home    About    Download    Register    News    Help

Print Thread
#152940 08/07/06 06:47 PM
Joined: Jul 2006
Posts: 3
M
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Jul 2006
Posts: 3
Hi all,

Having trouble getting this code to work:

Code:
 on 1:text:!help*:#: if ($2- isin helpbot.txt) { notice $nick $read(helpbot.txt, s, $2-) } else { notice $nick No match found. } 


I've tried some variations on the code, none of which work frown Any help greatly appreciated! The problem appears to be with the isin part, as without it the code works fine.

Cheers,

Mike.

#152941 08/07/06 07:04 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
The isin operator only compares a direct text string, it doesnt read a txt file, and then read all the strings in that text file.

Like: if (www isin http://www.mirc.net) { ...
Returns true.

You will need to read all the lines that you have in the text files, compare with wildmatch operators, and return when there is a match.

#152942 08/07/06 08:00 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
on 1:text:!help *:#: if ($read(helpbot.txt,s,$2-) && $readn) { notice $nick $read(helpbot.txt,n,$v1) } else { notice $nick No match found. }

Try that

#152943 08/07/06 08:42 PM
Joined: Jul 2006
Posts: 3
M
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Jul 2006
Posts: 3
Quote:
on 1:text:!help *:#: if ($read(helpbot.txt,s,$2-) && $readn) { notice $nick $read(helpbot.txt,n,$v1) } else { notice $nick No match found. }

Try that


Hey, firstly thanks for your help! (both of you)

DaveC, I've tried that code, oddly if I try !help lfo (lfo being in the file) I get the following:

[9:34:15p] helpbot\LFO - Low Frequency Oscillator, commonly used as a modulation source. (the notice sends fine on the other end, too)
[9:34:15p] Invalid command: Unknown command.

Then when I try !help [something which isn't in the file] nothing happens confused

No idea why...

Once again many thanks!

#152944 08/07/06 09:48 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
on 1:text:!help *:#: if ($read(helpbot.txt,s,$2-) && $readn) { notice $nick $read(helpbot.txt,n,$v1) } | else { notice $nick No match found. }

I copied your code with out really thinking about it, and just fixed the isin to work, the problem existed becuase for mirc to be able to phrase the IF ELSE correctly it needs to see the ELSE as a command so it either has to be on a new line or u need to put a command seperator in front of it, as i have done now.

#152945 08/07/06 09:54 PM
Joined: Jul 2006
Posts: 3
M
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Jul 2006
Posts: 3
Quote:
on 1:text:!help *:#: if ($read(helpbot.txt,s,$2-) && $readn) { notice $nick $read(helpbot.txt,n,$v1) } | else { notice $nick No match found. }

I copied your code with out really thinking about it, and just fixed the isin to work, the problem existed becuase for mirc to be able to phrase the IF ELSE correctly it needs to see the ELSE as a command so it either has to be on a new line or u need to put a command seperator in front of it, as i have done now.


Ahh! Works perfectly! Thank you very much!!! cool smile

I hadn't realised the else needed to be on a different line. I have had trouble with it before so the advice comes in very useful.

Once again many thanks!! *goes to fill text file with definitions* smile


Link Copied to Clipboard