mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2007
Posts: 75
T
Babel fish
OP Offline
Babel fish
T
Joined: Feb 2007
Posts: 75
I am trying to write an Smart AI for my IRC bot, only trouble is that I have no idea how to make the bot match per WORD rather than scan the whole text for nearest match. I also want to scan all the words in a sentance for matches.

Like 'hi' in the word high triggers the script and I don't want that. Even a exact matching method would help smile

Any help would be appechiated smile


GigIRC Network Admin
irc.gigirc.com
Joined: Mar 2007
Posts: 139
S
Vogon poet
Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
I dont really script but looking at the help file i thought maybe $istok would help.
example.

Code:
on *:text:*:#: if ($istok($1-,hi,32)) { ....


and what about on *:text:*hi*:#: if you are only looking for one word and dont have to parse alot of if statements that maybe an option

Joined: Feb 2007
Posts: 75
T
Babel fish
OP Offline
Babel fish
T
Joined: Feb 2007
Posts: 75
I tried the 'on *:text:*word*:#:' method once, but it gets bulky and slow and stops working correctly after you add a certian amount.

Was planning something a little more than one word, but yeah I'll try out the $istok method and see with what I can come up with.

edit -- On some reflection, I think maybe a hybred of the two methods could be used to reach my goal, but expect to hear from me again if it fails :P

Last edited by Trixar_za; 15/03/07 02:29 AM.

GigIRC Network Admin
irc.gigirc.com
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
As a note, AI scripts for mIRC have been suggested and attempted before, but (to my knowledge) no one has ever written one that is complete, due to various limitations of the mIRC program.

Joined: Feb 2007
Posts: 75
T
Babel fish
OP Offline
Babel fish
T
Joined: Feb 2007
Posts: 75
I know, hence the appeal of the challenge smile


GigIRC Network Admin
irc.gigirc.com
Joined: Jan 2007
Posts: 259
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
You could use:
Code:
$regex(name,a few words,/\b(word|otherword|anotherword)\b/)

\b in regex is a word boundary if I'm correct (will match 'nothing' in: "there is nothing!", where $istok wouldn't).
Also, you can use $regml(name,1) to get the word matched (to save some CPU cycles), and $regml(name,1).pos to get the position of the match.


Those who can, cannot. Those who cannot, can.
Joined: Feb 2007
Posts: 75
T
Babel fish
OP Offline
Babel fish
T
Joined: Feb 2007
Posts: 75
That is what I was looking for, thanks Kardafol smile


GigIRC Network Admin
irc.gigirc.com

Link Copied to Clipboard