|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
I have the following problem. I want my bot to message me, when it receives a private message. on *:TEXT:*:?:{
.msg mynick 05PRIVATE MESSAGE from $nick $+ : $1-
} That works fine, but not when I change my nick. To mynick|afk or whatever.... Is this also possible to do on hostmask or something? Or does anyone have a solution for this?
|
|
|
|
Joined: Feb 2006
Posts: 38
Ameglian cow
|
Ameglian cow
Joined: Feb 2006
Posts: 38 |
Make it simple: message your bot your new nickname when you change it and let him store it in some variable and then use it. That will work in all cases.
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Hmm, yeah that will work. Neat idea. Thx a lot!
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
You can also use an on nick event on your bot to watch for when you change your nick and then change the variable based on that. Of course, when you join the channel, it will still have your last-used nick, which could be different from the one you're currently using, and that can make it not work until you change your nick to the last-used nick or reset the variable in the bot.
Perhaps the best method would be to give the bot all possible nicks you'll use and then have it check if (nick ison #) with each nick. If it's on the channel, it will message you. This also makes it so the bot doesn't get an error if you aren't connected.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Thx for that Riamus. I indead used the on Nick event for it. I've been testing it a little, and it seems to be working fine.
Regarding the joining of a channel. I already have my main nick always returning to default using a scripted on start and on exit. So I just added a line, to also reset the variable back to my default nick. This way it should always match.
And, I will always be online if my bot is online. It's just a copy of mIRC, it will never run without my main client being connected as well.
Thx for the advices though.
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
Actually, if your nick is always static like your showing me like the mynick and mynick|AFK this is easily fixable if you never change part of the nick
on *:TEXT:*:?:if mynick isin $nick msg $nick msghere
the isin will check that if mynick isin the nick that messages you then it will message because because it found a match
:P
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Hmm yeah you're right. But it's almost always like that, not always, always...  I'm gonna settle for the current solution. It seems waterproof to me. But also thx for thinking along 
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
You could use your original code, just replacing mynick with $me
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Then it would message itself (the bot) instead of me 
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
right..sorry..wasn't thinking straight.
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
you could at some point set a var in the bot with your nick you could then have an on:nick event that checks if $nick == %thevar set %thevar $newnick
|
|
|
|
Joined: Jun 2006
Posts: 508
Fjord artisan
|
Fjord artisan
Joined: Jun 2006
Posts: 508 |
If both clients are on the same PC he could use DDE and never have to worry about nicks  No need for levels, nicks, hosts, vars, servers. All it requires is for DDEserver to be turned on on the main client only. The bot doesnt even need it's DDE server on for ex. ; For the bot
on ^*:open:?:{
dde [color:green]mIRC[/color] command "" /botmsg 05PRIVATE MESSAGE from $nick $+ : $1-
halt
}
;Swap "[color:green]mIRC[/color]" for your actual DDEserver name, on the main client ; For the Main client
alias botmsg {
var %a = [color:blue]botnick[/color]
if !$query(%a) { query -n %a }
echo -itlbfmr %a $+(<,%a,>) $1-
}
Swap "[color:blue]botnick[/color]" for the bots nick. :)
|
|
|
|
Joined: Aug 2005
Posts: 1,052
Hoopy frood
|
Hoopy frood
Joined: Aug 2005
Posts: 1,052 |
even a specific user leve that if your host = user level 30 and you set the
ON 30:TEXT:*:?:{ stuff }
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
|
|
|
|
Joined: Jun 2004
Posts: 65
Babel fish
|
Babel fish
Joined: Jun 2004
Posts: 65 |
this seams to work a little better, and with some modification, this can be used to run multiple bots, should you have more than 1. (simply add $me to message someware) Bot side on *:text:*:?:{
dde mIRC command "" /botmsg $+ $color(normal) $+ $network $+ $chr(58) $+ $nick $+ $chr(58) $1-
halt
}
on *:action:*:?:{
dde mIRC command "" /botmsg $+ $color(action) $+ $network $+ $chr(58) $+ $nick $+ $chr(58) $1-
halt
} Main client side alias botmsg {
if !$window(@bot) { window -azk0 @Bot }
echo -itlbfmr @Bot $1-
}
Last edited by sdamon; 10/10/06 08:09 AM.
|
|
|
|
|