mIRC Home    About    Download    Register    News    Help

Print Thread
Couple of script questions/problems #153636 19/07/06 08:54 PM
Joined: Nov 2005
Posts: 15
M
markspec87 Offline OP
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

Re: Couple of script questions/problems #153637 19/07/06 09:21 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
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;
  }
} 

Re: Couple of script questions/problems #153638 20/07/06 11:35 PM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline
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
Re: Couple of script questions/problems #153639 20/07/06 11:47 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
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.

Re: Couple of script questions/problems #153640 20/07/06 11:48 PM
Joined: Apr 2006
Posts: 400
K
Kurdish_Assass1n Offline
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
Re: Couple of script questions/problems #153641 21/07/06 12:23 AM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline
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
Re: Couple of script questions/problems #153642 21/07/06 12:30 AM
Joined: Apr 2006
Posts: 400
K
Kurdish_Assass1n Offline
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
Re: Couple of script questions/problems #153643 21/07/06 12:37 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
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)

Re: Couple of script questions/problems #153644 21/07/06 12:53 AM
Joined: Apr 2006
Posts: 400
K
Kurdish_Assass1n Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
This original post?


-Kurdish_Assass1n
Re: Couple of script questions/problems #153645 21/07/06 12:59 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Yes
Quote:
{ if ($chan = #mychannel ) {

Re: Couple of script questions/problems #153646 21/07/06 01:03 AM
Joined: Apr 2006
Posts: 400
K
Kurdish_Assass1n Offline
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