mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2014
Posts: 2
T
Tempo Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
T
Joined: Mar 2014
Posts: 2
Hi,

I wanted to give my bot a new feature, where a user could, say

Code:
!msg SomeGuy24 Don't forget to check the thing!

and then later on, when SomeGuy24 first says something again in the channel, the bot spits out the message.

[I would just have each username and message written to a txt file and then erased after being sent. Whether this is a good idea or not I'm not sure, and feel free to suggest something better, but this isn't the issue.]

The problem is, I'm not sure how to go about checking if SomeGuy24 has said something, short of scanning every single text input in the channel, like

Code:
on *:TEXT:*:#: {
  if ($read(msglist.txt,s,$nick) != $null) { /msg #channel $read(msglist.txt,s,$nick) | /write -ds $+ $nick msglist.txt }
}

and while this does work, it disables every other on-text command my bot has, due to what I'm guessing is some kind of priority issue I don't understand, where I assume the vague on-text is being triggered first and ignoring every other possible command. [I even tried shifting it to the bottom of the script, but that didn't help, ha.]

Any help would be greatly appreciated, whether it be a fix for my silly problem, or a small explanation on how priority works..

Joined: Dec 2010
Posts: 89
D
Babel fish
Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
I done a similar thing for my script, but it checked when the user joined a channel rather than saying something. It'd probably be slightly more efficient because people don't join the channel as much as people say stuff in the channel, and it may stop the interference with your other text scripts then. Although to be honest I have no idea why it's stopping the other text events shocked weird
oh, and also I made it check if the user was on the channel when the command is first typed, so that it doesn't have to wait for the user to come online before message is sent. smile

Last edited by dominic_eddy; 03/03/14 07:29 PM.
Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55
How about something like this?

!msg nickname message - E.g. !msg JayStew Can we have a meeting today at 1:00?

Place in remotes - Anyone can use this script at the moment. (can be changed to ops only etc)

Once you add a message when that person speaks in the room it will give them the message and then delete it, also if you leave a message and they are not in the room it will give them the message on joining the room then will delete it.

Be Aware: If you leave a message for someone who isn't online and someone else joins the room with there nickname it will show them the message (Its been done my nickname not hostmark but this can be done)


Code:

on *:Text:*!msg*:#: {
  if ($1 == !msg) {
    if ($2 == $null) { .notice $nick Please enter a nickname. Syntax: !msg <nickname> <message> | halt }
    if ($2 !== $null) {
      if ($3- == $null) { .notice $nick Please enter a message for $2. Syntax: !msg <nickname> <message>  | halt }
      if ($3- !== $null) {
        if ($2 == $me) { .notice $nick I will not leave myself a message.  | halt }
          else { 
          .writeini -n messages.ini $2 Message $3-
          .writeini -n messages.ini $2 From $nick
        }
      }
    }
  }
}
on *:TEXT:*:#: {
  if ($readini(messages.ini, $nick, Message)) { .notice $nick Message from:  $readini(messages.ini,$nick, From) - $readini(messages.ini,$nick, Message) | .remini messages.ini $nick   | halt }
}
on *:JOIN:#: {
  if ($readini(messages.ini, $nick, Message)) { .notice $nick Message from:  $readini(messages.ini,$nick, From) - $readini(messages.ini,$nick, Message) | .remini messages.ini $nick   | halt }
}



Regards

JayStew
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
That's a pretty clever idea I must say! Thanks a bunch, I'll be using it as well. I added a channel specific code though so that when the person enters/says something in the channel you wrote the message in, only then will it work. smile


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Mar 2014
Posts: 2
T
Tempo Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
T
Joined: Mar 2014
Posts: 2
Thanks a ton, jaystew; It works perfectly for my intentions.

I had no idea you could do that with .inis, seems extremely useful. Looking forward to trying them out for some other things now. :P Greatly appreciated.

Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55

Wicked, Glad I could help you both out smile


Regards

JayStew

Link Copied to Clipboard