mIRC Home    About    Download    Register    News    Help

Print Thread
Message host #161502 08/10/06 09:16 AM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
I have the following problem.

I want my bot to message me, when it receives a private message.

Code:
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?

Re: Message host #161503 08/10/06 09:47 AM
Joined: Feb 2006
Posts: 38
N
NineTails Offline
Ameglian cow
Offline
Ameglian cow
N
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.

Re: Message host #161504 08/10/06 10:03 AM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Hmm, yeah that will work.
Neat idea. Thx a lot!

Re: Message host #161505 08/10/06 04:04 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
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
Re: Message host #161506 08/10/06 04:29 PM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
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.

Re: Message host #161507 08/10/06 08:55 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
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


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Message host #161508 08/10/06 09:06 PM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Hmm yeah you're right.
But it's almost always like that, not always, always... smile

I'm gonna settle for the current solution. It seems waterproof to me. But also thx for thinking along laugh

Re: Message host #161509 08/10/06 09:53 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You could use your original code, just replacing mynick with $me

Re: Message host #161510 08/10/06 09:55 PM
Joined: Apr 2006
Posts: 464
O
OrionsBelt Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Then it would message itself (the bot) instead of me laugh

Re: Message host #161511 08/10/06 10:09 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
right..sorry..wasn't thinking straight.

Re: Message host #161512 09/10/06 03:59 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
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

Re: Message host #161513 09/10/06 04:05 AM
Joined: Jun 2006
Posts: 508
D
deegee Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
If both clients are on the same PC he could use DDE and never have to worry about nicks wink
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.
Code:
; 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

Code:
; 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. :)

Re: Message host #161514 09/10/06 04:39 AM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
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 }


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Message host #161515 10/10/06 08:06 AM
Joined: Jun 2004
Posts: 65
S
sdamon Offline
Babel fish
Offline
Babel fish
S
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
Code:
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
Code:
alias botmsg {
  if !$window(@bot) { window -azk0 @Bot }
  echo -itlbfmr @Bot $1-
}

Last edited by sdamon; 10/10/06 08:09 AM.