mIRC Homepage
Posted By: SuperMappy Notice and variables - 21/01/04 03:16 AM
Hello All

Is there anyway to get a received notice into a variable so you can check it for words or strings?

Thank You
Posted By: Cheech Re: Notice and variables - 21/01/04 03:20 AM
/help on notice

on 1:NOTICE:*:?:/msg $nick I'm AFK, back in a moment!

This listens for any private notice and responds with the message that you're away from the keyboard.

For more flexibility, you can also use Variables in place of both the matchtext and the channel parameters.

Posted By: SuperMappy Re: Notice and variables - 21/01/04 03:30 AM
that's not quite what I meant smile

let's say I receive a notice that says "Hello are you there" for example.

Is there a way I can get this string into a variable so I can check it for specific words or text
Posted By: Iori Re: Notice and variables - 21/01/04 03:34 AM
Code:
on *:notice:*matchtext*:*:{
  ; commands
}
on *:notice:*:*{
  if Hello * there iswm $1- {
    ; commands
  }
}
on *:notice:*:*{
  if Hello == $1 {
    ; commands
  }
}
For more info type /help if then else
Posted By: SuperMappy Re: Notice and variables - 21/01/04 04:31 AM
Thank you that worked beautifully.

One more little thing though smile

Here's my setup.

I'm using another computer for serving and this computer for chatting.

this line of code is in Popups on this computer:

bot speak:/notice (bot's name) $?="Enter bot speak for $chan "

this line of code is on the bot's computer:

on 1:notice:*:?:/msg $chan $1-

the obvious problem here is the bot has no idea what channel to message to from the $chan identifier. Is there a way I can send that identifier to the bot's computer?

I do plan on adding a $nick check for obvious reasons also smile
Posted By: Cheech Re: Notice and variables - 21/01/04 04:43 AM
perhaps send 2 seperate notices
on 1:notice:*:?:{
if ($1 == channel) { set %chan $2 }
else {
msg %chan $1-
}
}

then notice the bot with /notice botname channel #channelname this isnt tested you might need to add a halt to the if line
Posted By: Iori Re: Notice and variables - 21/01/04 10:43 AM
Assuming this is the nicklist popups:
bot speak:.notice (bot's name) $chan $$input(Enter bot speak for $chan,eq,Bot Speak)
(The dot in front of .notice makes it "quiet" so you don't see "-> -botname- mu moo mu")

Here we check nick and if the bot is on the channel
on *:notice:*:?:if $nick == Yournick && $1 ischan { msg $1 $$2- }

You can make a more secure check than nick with $address, $site, $wildsite or with userlevels/protect.
Posted By: SuperMappy Re: Notice and variables - 21/01/04 03:18 PM
Thank you lori, that works perfectly. laugh

Thanks to all
© mIRC Discussion Forums