mIRC Home    About    Download    Register    News    Help

Print Thread
mIRC bot - copy/paste lines in 2 channels #237525
12/05/12 03:07 PM
12/05/12 03:07 PM
Joined: May 2012
Posts: 2
N
nomics Offline OP
Bowl of petunias
nomics  Offline OP
Bowl of petunias
N

Joined: May 2012
Posts: 2
I am a noob in mirc scripting, and I need some help.
1. there is 2 irc channels. lets call then #channel1 and #channel2;
2. There are 2 bots. One is mine, lets call him mybot (my bot is in both channels). The other bot is from a third person, lets call him otherBot;
What I need is let me make an example to better explain.

a) in #channel1 some user type:
Code:
[14:38:48] <@someuser> !user xpto

At this time, mybot is in both channels. he reads the command !user* and copy/paste it in #channel2, where the otherBot will recognize the command !user* and will paste some information about this command.

b) so, in #channel2 it will append something like:
Code:
[14:38:50] <@ mybot > !user xpto
[14:38:52] <@ otherBot > User name is xpto and he likes popatos.

Now I want that mybot reads the information provided by the otherBot and then paste it on #channel1

c) so, in #channel1:
Code:
[14:38:54] <@ mybot > User name is xpto and he likes popatos.


So far I have the fowling code in my remote:
Code:
on *:TEXT:!user*:# channel1 {
  /msg # channel2 $1-
}

on *:TEXT:User name*:#channel2 {
  if $address($nick,2) == *!*@otherBot.users.gameea {
    /msg # channel1 $1-
  }
}


This works fine, but have a problem: if someone else ( not mybot ) type !user kakaka in #channel2, mybot will also copy/paste the information provided by the otherBot and then paste it on #channel1. And I only want that mybot copy/paste only the information that mybot ask to otherBot.

Any suggestion?
Thanks!

Re: mIRC bot - copy/paste lines in 2 channels [Re: nomics] #237527
12/05/12 05:33 PM
12/05/12 05:33 PM
Joined: Jan 2004
Posts: 1,271
L
Loki12583 Offline
Hoopy frood
Loki12583  Offline
Hoopy frood
L

Joined: Jan 2004
Posts: 1,271
You could set a global variable used to indicate you're waiting for a response, and depending on the complexity or variety of these commands you could verify you're receiving the correct response.

The following tries to verify you're receiving a response for the correct user (based on the text in your example). Also I find it cleaner to add addresses to the user list instead of checking addresses in the events explicitly. You can add the other bot to group "otherbot" manually in the User tab, or with the command /auser otherbot *!*@otherBot.users.gameea

Code:
on *:text:!user *:#channel1:{
  set -u5 %waiting $2
  msg #channel2 $1-
}

on otherbot:text:user name*:#channel2:{
  var %user = $4
  if (%waiting == %user) {
    unset %waiting
    msg #channel1 $1-
  }
}


Re: mIRC bot - copy/paste lines in 2 channels [Re: Loki12583] #237528
12/05/12 06:45 PM
12/05/12 06:45 PM
Joined: May 2012
Posts: 2
N
nomics Offline OP
Bowl of petunias
nomics  Offline OP
Bowl of petunias
N

Joined: May 2012
Posts: 2
Thanks Loki12583.

I tried your code, but the second part of the code is not working: mybot is not retrieving the information to #channel1 . frown

I'm just a beginner in mirc scripting ... and I cannot detect what is wrong. frown

Last edited by nomics; 12/05/12 06:46 PM.
Re: mIRC bot - copy/paste lines in 2 channels [Re: nomics] #237536
13/05/12 11:10 PM
13/05/12 11:10 PM
Joined: Aug 2006
Posts: 167
P
pishposh Offline
Vogon poet
pishposh  Offline
Vogon poet
P

Joined: Aug 2006
Posts: 167
I believe this:
on otherbot:text:user name*:#channel2:{
Needs to be:
on @otherbot:text:user name*:#channel2:{

Re: mIRC bot - copy/paste lines in 2 channels [Re: pishposh] #237537
13/05/12 11:42 PM
13/05/12 11:42 PM
Joined: Oct 2004
Posts: 8,327
MA, USA
Riamus2 Offline
Planetary brain
Riamus2  Offline
Planetary brain

Joined: Oct 2004
Posts: 8,327
MA, USA
Why? @ makes it trigger only if you're an op. Nothing in that code requires that you're an op.


Invision Support
#Invision on irc.irchighway.net
Re: mIRC bot - copy/paste lines in 2 channels [Re: Riamus2] #237538
14/05/12 04:18 AM
14/05/12 04:18 AM
Joined: Aug 2006
Posts: 167
P
pishposh Offline
Vogon poet
pishposh  Offline
Vogon poet
P

Joined: Aug 2006
Posts: 167
Ugh, you're correct. I glanced at the help file too quickly:

Quote:
Named Levels

You can also used named levels which work the same way as a specific level but are easier to understand and read than a number.

friend:goat!khaled@mirc.com

on @friend:JOIN:#mIRC:/mode $chan +o $nick

This treats the word friend as a specific access level and matches the user with the event, and because the user is your friend, you give him ops.

And mistook @ as a named level prefix.

Sorry. Disregard my post, nomics.