mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2014
Posts: 4
Z
Self-satisified door
OP Offline
Self-satisified door
Z
Joined: May 2014
Posts: 4
Hey guys I'm new here and new to scripting, I don't really know a lot but I'm learning and want to improve, any guides/tips would be appreciated.

I want to make a script that returns specific PM information; So say I type in a channel !new and that bot will then PM another bot a certain command via pm, how do I make my bot return in channel chat what the other bot then PM's back?

Example:
Me to Chan <Me> !new
Bot to OtherBot <Bot> new
OtherBot to Bot <OtherBot> information here
Bot to Chan <Bot> New information

on *:text:.new*:#chan: {
if ((%flood) || ($($+(%,flood.,$nick),2))) { return }
set -u10 %flood On
set -u10 %flood. $+ $nick On
msg Bot new $+
}

on *:text:new*:?: { .timer 1 3 msg #chan $1- $+
}

I sorta got it working by using this, but I don't know how I'd merge those two into just the one command, or how I can make it respond said "new" text from certain PMS only (As in a specified nickname only)

Last edited by Zoidberg; 08/05/14 08:21 AM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
You have to make 2 scripts. One for <bot> and other for <otherbot>.
For <bot>, scripts must be able to catch text in the channel (catching your !command text) and private msg (catching <otherbot> reply text).
For <otherbot>, you have to provide script that can catch your <bot> text in private msg.

Idk how your <otherbot> proccess the input text from <bot>, so basically, script for <bot> should be like:

For catching text in channel.
Code:
on *:TEXT:!new:#:{
  if ((%flood) || ($($+(%,flood.,$nick),2))) { return }
  set -u10 %flood On
  set -u10 %flood. $+ $nick On
  ; Note: it would be good if you send all info including channelname 
  ; and nick that triggered this event and get reply from <otherbot> 
  ; with all info that you already sent. 
  msg <otherbot> # $nick $1 
}

Now waiting for <otherbot> private msg <bot>
For catching text in private, you use:
Code:
on *:TEXT:*:?:{
  ;do checking if msg is from <otherbot> 
  if $nick == <otherbot> {
    ; do stuff here
    ; Note: $1 is your channelname, $2 is nick and $3- is info text from <otherbot>
    ; make sure that <otherbot> sent you with all info you need.
    msg $1 $3- 
  }
}

Joined: May 2014
Posts: 4
Z
Self-satisified door
OP Offline
Self-satisified door
Z
Joined: May 2014
Posts: 4
Thank you so much for the help! It works perfectly! laugh

I did have one last question though, is there a way to make this do the exact same thing, but instead of the output being from a private message, could it be from a notice of multiple lines? (Specifically 5)

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
You can use on *:NOTICE:*:?:{ do stuff } event?

Im not sure understand you clearly about notice of multiple lines? can you give example?

Joined: May 2014
Posts: 4
Z
Self-satisified door
OP Offline
Self-satisified door
Z
Joined: May 2014
Posts: 4
Hmm, well; You PM Bot2 a command of !new and it returns the newest results to you via /notice. Example below.

Me to #chan <Me> .new
Bot1 to Bot2 <Bot1> !new
Bot2 to Bot1 -Bot2- Added: 2014-05-08 07:23 1432 * Result 1
-Bot2- Added: 2014-05-08 02:52 1431 * Result 2
-Bot2- Added: 2014-05-08 01:47 1430 * Result 3
-Bot2- Added: 2014-05-08 01:26 1429 * Result 4
-Bot2- Added: 2014-05-08 01:04 1428 * Result 5

And then Bot1 would take the /notice results that Bot2 sent, then return those to the channel/nick which used initial .new command.

It'd be exactly like the initial PM one you helped me with, but with multiple lines of /notice text instead of PM.

I hope that clears it up a little.

Last edited by Zoidberg; 08/05/14 11:15 AM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
It would be same as on TEXT event.
Code:
on *:NOTICE:*:?:{
  if $nick == <otherbot> {
    ; do stuff here
    msg $1 $3- 
  }
}

Joined: May 2014
Posts: 4
Z
Self-satisified door
OP Offline
Self-satisified door
Z
Joined: May 2014
Posts: 4
Thank you for all of your awesome help, blessing!


Link Copied to Clipboard