mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2005
Posts: 15
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Nov 2005
Posts: 15
Ok ive got a few things i need helping with here. First of all

Code:
on *:JOIN:#mychannel: { if ($chan = #mychannel ) { 
//notice $nick Welcome to #mychannel Im the channels bot. For our latest deals type !deals.  To get me 

to idle in your channel type !idle #yourchan! } }


Why does that code work? nothing happens frown (ive obv changed the mychannel bit)

2nd question - I have a peice of code that gets my bot to idle in peoples channels.

Code:
on *:TEXT:!idle *:#: {
//msg $chan 2Im now idling in $2
//join $2


Works fine BUT when its in other peoples channels it also responds to !idle #channel. How do i get it to only accept idle commands from my channel?

3rd question

Ive got a peice of code:

Code:
on *:TEXT:!broadcast *:#:{ if ($nick isop $chan) { //amsg < $nick > $2- < #mychan > } }


How do i get the >'s right next to nick?

it appears as "< nickname >" i dont want any spaces, bur i move them next to it i nthe script, it wont show the nick, it just says <$nick> asif im asking it to display $nick>

hope some people can help, thanks smile

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
In your first code, the if statement is irrelevant, since you specify the channel in the ON JOIN event. Aside from that, I see nothing wrong with that section of the code, however, here's the re-write
Code:
on !*:join:#mychannel:{
  notice $nick Welcome to $chan $+ .  I'm the channels bot. For our latest deals type !deals. To get me to idle in your channel type !idle #yourchannel
} 


Regarding #2, you just need to specify the full channel name in the ON TEXT event, rather than using # (which will match whatever channel the bot is on). You already specify the specific channel in the ON JOIN event (reference question #1)

A recommendation for an altered code reads as follows
Code:
on *:text:!idle*:#mychan:{
  if !$2 { .msg $nick You have to specify a channel }
  elseif $2 ischan { .msg $nick I'm already in $2 }
  else {
    set %chan $2
    join $2
  }
}
on me:*:join:%chan:{
  msg $chan,#mychan I'm now idling in $chan
} 


Regarding query #3, try this instead
Code:
 on *:TEXT:!broadcast *:#:{
  if ($nick isop $chan) {
    amsg $+(&lt;,$nick,&gt;) $2- &lt;#mychan&gt;
  }
} 

Joined: Jul 2006
Posts: 242
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
RE the first script, isnt there on = missing?
"on *:JOIN:#mychannel: { if ($chan = #mychannel )"
shouldnt it be " ($chan == #mychannel )?


Newbie
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If the comparison was necessary, then you would be correct, although some people have been known to get correct results using the single = rather than the double ==. However, as I noted, since the channel name is specified in the ON JOIN event, that if statement is irrelevant.

Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
Quote:
RE the first script, isnt there on = missing?
"on *:JOIN:#mychannel: { if ($chan = #mychannel )"
shouldnt it be " ($chan == #mychannel )?

no, if ($chan == #mychannel) is correct, but, I don't know why it's needed, it's already in the original script, so, it will only activate in the channel given, so, It's there for no reason.


-Kurdish_Assass1n
Joined: Jul 2006
Posts: 242
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
The if statment is not needed but it would have worked!!
mark asked why his peace of code wasnt working so it was just something i noticed that i wanted to point out.


Newbie
Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
lol HaleyJ, I thought u were talking about the 'if' not being there, didn't notice it had just one = sign, lol, sry.


-Kurdish_Assass1n
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Kurdish_Assassin: I just double checked the original post, and the IF command for the comparison is present (either that or I'm seeing things)

Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
This original post?


-Kurdish_Assass1n
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Yes
Quote:
{ if ($chan = #mychannel ) {

Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
lol, I know, I was talking about this one though, he said "shouldn't it be..."
Quote:

RE the first script, isnt there on = missing?
"on *:JOIN:#mychannel: { if ($chan = #mychannel )"
shouldnt it be " ($chan == #mychannel )?

Last edited by Kurdish_Assass1n; 21/07/06 01:04 AM.

-Kurdish_Assass1n

Link Copied to Clipboard