mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2012
Posts: 2
N
nomics Offline OP
Bowl of petunias
OP Offline
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!

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
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-
  }
}


Joined: May 2012
Posts: 2
N
nomics Offline OP
Bowl of petunias
OP Offline
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.
Joined: Aug 2006
Posts: 167
P
Vogon poet
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:{

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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
Joined: Aug 2006
Posts: 167
P
Vogon poet
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.


Link Copied to Clipboard