mIRC Home    About    Download    Register    News    Help

Print Thread
Bar bot problems. #187963 15/10/07 09:19 PM
Joined: Oct 2007
Posts: 6
D
Dionysus Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Oct 2007
Posts: 6

You might remember I had a drink script I was having trouble with a while back, well, said drink script somehow spiraled out of control towards full on bot-ness. However there's one feature I can't seem to get right.

I want him to respond every time his name is said.

Now it started as

Code:
if ($1 == Drinkslinger) { $read(Reply.txt) }


And about twelve different lines, each time increasing $1 up to $2, $3,$4, ect. However this works, but is messy and I'm sure there's a better way to do it. I would also like him to reply when the name is used in actions. /help was. . .less than useful, so I was hoping I might gather a bit of help here.

Re: Bar bot problems. [Re: Dionysus] #187978 15/10/07 10:20 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
The difficulty will be getting all matches including when punctuation is attached to the nick. If you just wanted to match when an entire "word" is the nick and not including punctuation, you can use $istok.

Code:
  if ($istok($1-,$me,32)) { do this }


That will match whole words for the entire line (no need to match against $1, $2, $3, etc). It will not match when punctuation is attached to the nick. The best way to do that kind of match would be regex, I think. If you didn't want to use regex, then you could always $remove all punctuation before the $istok...

Code:
  var %text = $remove($1-,.,!,$chr(44),",',;,:)
  if ($istok(%text,$me,32)) { do this }


$chr(44) is a comma. You can add more punctuation to remove as well. Certain characters need to be in $chr() format because mIRC will think they are part of the command rather than something you're trying to remove, such as the comma.

I'll let someone else show a regex pattern to use. I'm just figuring regex out, so it would take too much effort right now for me to get a valid regex pattern for this myself.


Invision Support
#Invision on irc.irchighway.net
Re: Bar bot problems. [Re: Riamus2] #187987 15/10/07 10:46 PM
Joined: Oct 2007
Posts: 6
D
Dionysus Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Oct 2007
Posts: 6
Oh I'm not worried about punctuation cancelling it out, It's just a little thing for people to play with during bouts of boredum, however I'll give this a whirl and will be back in a bit to tell you how it works out.


[Edit:] Works fine when people are talking to him, but still doesn't work when he's in an action. Like when I go:

/me punts Drinkslinger

and it shows up:

*Dion punts DrinkSlinger

he still doesn't reply. Any ideas?

Last edited by Dionysus; 15/10/07 10:57 PM.
Re: Bar bot problems. [Re: Dionysus] #188000 16/10/07 12:34 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
/help on action

You'll need to either duplicate it in an on action event or use an alias from both that will know which event to respond to.


Invision Support
#Invision on irc.irchighway.net
Re: Bar bot problems. [Re: Riamus2] #188056 16/10/07 10:23 PM
Joined: Oct 2007
Posts: 6
D
Dionysus Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Oct 2007
Posts: 6
Ha Ha! Of course. What a fool I be. Totally spaced the on action thing. Ha, I feel like an idiot.