mIRC Home    About    Download    Register    News    Help

Print Thread
Is there any good way to do this? #137647 16/12/05 08:14 PM
Joined: Mar 2005
Posts: 20
E
Erebus Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Mar 2005
Posts: 20
Hello,

mIRC can generally have a lot of on text: events without problems, even if they are regular expressions, wildcards etc. The problem is, I would like to be able to have a dynamic command system on my bot, rather than having to create the commands myself.

These commands may vary in format, so they would probably need to be in the regular expression form.

My question is, is there any good way to do this? What I am guessing I would need to do is load into memory all the different regular expressions for commands, and what to do if they are called. However, would running regular expression on every single line of text in a number of busy channels cause some problems within scripting? Would it be any worse than having them manually defined? Is there any good way to go about this?

Thanks smile

Re: Is there any good way to do this? #137648 17/12/05 01:58 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I know very little about regualar expressions, but from what i have seen, they dont normally cause any significant delay, but could cause huge delays depending on the regex.

You could reduce significantly your overhead by maybe using ON *:TEXT:!*:#: and having all of your commands begin with !, a simple wild match well then only allow !<text> to be compared to the regex's of the actual commands.

Re: Is there any good way to do this? #137649 17/12/05 02:25 AM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
The easiest way to handle this is by giving all commands some specific prefix, such as !. That way you can just match !* in a single on text event and very easily do whatever's necessary from there. It's simple to work with and efficient because you're using a straightforward match which will filter out 99.9% of all regular IRC chat without having to process the entire line.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: Is there any good way to do this? #137650 17/12/05 12:51 PM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
if you want to make the commands variable why not just use : variables ? :tongue:
on *:TEXT:%trigger:%channel:/msg $nick you triggered %trigger on %channel


$maybe