mIRC Home    About    Download    Register    News    Help

Print Thread
#116432 04/04/05 08:50 PM
Joined: Apr 2005
Posts: 31
V
Valo Offline OP
Ameglian cow
OP Offline
Ameglian cow
V
Joined: Apr 2005
Posts: 31
i need script like this... when someone joins with nick "nick1242" (i count all numbers) i want that in publick chat i write "please change your nick, write /nick YOURNICK" can you help me guys? plz? i really need this script

#116433 04/04/05 09:16 PM
Joined: Oct 2004
Posts: 31
B
Ameglian cow
Offline
Ameglian cow
B
Joined: Oct 2004
Posts: 31
Code:
on *:join:#YOURCHANNEL: {
if ($left($nick,4) == nick) && ($len($nick) > 4) {
/msg # Please change your name $nick $+ . Type /nick YOURNICK
}
}


The reason I used $left and $len is I dont want someone with the name "mynameisnick" or just "nick" to be bugged


Bear

#116434 04/04/05 09:27 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Code:
on !*:JOIN:[color:red]#[/color]:{
  if $regex($nick,/^nick\d+$/i) {
    msg # $nick $+ : please change your nickname, write /nick YOURNICK 
  }
}

I'd suggest you change the red # to the channels where you want this to trigger, because if you msg this on channels where you are not allowed to do that, you can get in trouble.

Right now the regex matches on any nickname that starts with "nick" (case insensitive) followed by 1 or more digits. If you want it to be 4 or more digits then change the regex to:

$regex($nick,/^nick(?:\d{4,})$/i)


Gone.
#116435 05/04/05 05:27 AM
Joined: Apr 2005
Posts: 31
V
Valo Offline OP
Ameglian cow
OP Offline
Ameglian cow
V
Joined: Apr 2005
Posts: 31
and how exactly should i write if i want that this msg shows 3 secs after the guy with that nick joined? smirk

#116436 05/04/05 05:43 AM
Joined: Feb 2005
Posts: 194
A
Vogon poet
Offline
Vogon poet
A
Joined: Feb 2005
Posts: 194
Code:
on !*:JOIN:#your_channel:{
  if $regex($nick,/^nick\d+$/i) {
   [color:blue]timer 1 3[/color] msg # $nick $+ : please change your nickname, write /nick YOURNICK 
  }
}


I used FiberOPtics' code. By the way, you could avoid using the specific channel in the code (#your_channel) by adding a @ which will make the command only trigger if you are an op at the time the user joins. For example:

Code:
on [color:blue]@[/color]!*:JOIN:#:{
  if $regex($nick,/^nick\d+$/i) {
   timer 1 3 msg # $nick $+ : please change your nickname, write /nick YOURNICK 
  }
}


smile

Last edited by alhammer; 05/04/05 05:49 AM.

"God sometimes puts us in the dark for us to see the light"
#116437 05/04/05 08:51 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
That's good, just three little things:

1. In an on join event, if you specify the @ event prefix that requires you to be oped, the ! becomes obsolete. That's because you cannot be an op and a joining nick at the same time, therefore @ replaces ! with an extra condition: being opped.

2. I'd silence the timer by prefixing it with a . so that you're not annoyed with the display of the starting/halting of the timer.

3. I'd put in an if check to see if you are still on that channel before trying to message to it. Yes, I know it's only 3 seconds, but it doesn't hurt trying to cover all cases. It is possible that sometimes when you leave one of the channels that is being monitored by this script, one of the timers is running. The result would be an error saying you're not on the channel.

Code:
on [color:red]@[/color]*:JOIN:#:{
  if $regex($nick,/^nick\d+$/i) {
   [color:red].[/color]timer 1 3 [color:red]if ( # ischan)[/color] msg # $nick $+ : please change your nickname, write /nick YOURNICK 
  }
}

The space in the if condition is intended, and should not be altered. It is there to let the # evaluate now. (# wouldn't evaluate to the channel name.


Gone.
#116438 05/04/05 09:59 AM
Joined: Apr 2005
Posts: 31
V
Valo Offline OP
Ameglian cow
OP Offline
Ameglian cow
V
Joined: Apr 2005
Posts: 31
thx guys smile

#116439 05/04/05 10:18 AM
Joined: Apr 2005
Posts: 31
V
Valo Offline OP
Ameglian cow
OP Offline
Ameglian cow
V
Joined: Apr 2005
Posts: 31
1 more stupid question from me smile what i should write when someone joins i say /msg nick : hi well to say hello to guy who just joined?

#116440 05/04/05 11:34 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
With the code Dieter posted above your post.

Just put .msg $nick Hi $nick welcome above the if ($regex(..)) statement.

So..

Code:
on @*:JOIN:#:{
  .msg $nick Welcome to $chan ...
  if $regex($nick,/^nick\d+$/i) {   
    .timer 1 3 if ( # ischan) msg # $nick $+ : please change your nickname, write /nick YOURNICK   
  }
}

Last edited by SladeKraven; 05/04/05 11:39 AM.
#116441 05/04/05 11:47 AM
Joined: Apr 2005
Posts: 31
V
Valo Offline OP
Ameglian cow
OP Offline
Ameglian cow
V
Joined: Apr 2005
Posts: 31
it looks like this now

on !*:JOIN:#popular:{

timer 1 1 msg # 9,1 $nick hi:)

if $regex($nick,/^nick\d+$/i) {

timer 2 3 msg # $nick $+ : change your nick, write /nick YOURNICK
}



but the second msg sends 2 messeges and i dont know why

#116442 05/04/05 11:52 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
on !*:JOIN:#popular:{
  timer 1 1 msg # 9,1 $nick hi:) 
  if $regex($nick,/^nick\d+$/i) {
    timer [color:red]1[/color] 3 msg # $nick $+ : change your nick, write /nick YOURNICK
  }
[color:red]}[/color]


You had timer 2 3 which would repeat 2 times every 3 seconds. So change it to 1. smile

Also, I've added a close } brace as you missed it at the bottom.

-Andy

#116443 05/04/05 11:55 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Ah, I forgot to add an if check to see if the $nick is still on the channel after the timer triggers, otherwise it's useless to msg anyways.

The result would be: if ( # ischan) && ( $nick ison # ) msg # $nick $+ : ...

Greets


Gone.
#116444 05/04/05 12:00 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
* Andy slaps himself for not noticing you didn't put that check.

Notice what?

* Andy slaps again.

#116445 05/04/05 12:08 PM
Joined: Apr 2005
Posts: 31
V
Valo Offline OP
Ameglian cow
OP Offline
Ameglian cow
V
Joined: Apr 2005
Posts: 31
thx guys smile im not that smart at scripts just started to use them smile

#116446 05/04/05 12:12 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I'm not smart either. smile

#116447 05/04/05 12:36 PM
Joined: Apr 2005
Posts: 31
V
Valo Offline OP
Ameglian cow
OP Offline
Ameglian cow
V
Joined: Apr 2005
Posts: 31
oh btw is it possible that if im using away, then the first msg (text that greets) wont send but other would send, and if im not away it send both texts?

#116448 05/04/05 12:44 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
on !*:JOIN:#popular: { 
  if (!$away) .timer 1 1 msg # 9,1 $nick hi  
  if $regex($nick,/^nick\d+$/i) { 
    .timer 1 3 msg # $nick $+ : change your nick, write /nick YOURNICK 
  }
} 

#116449 07/04/05 06:40 PM
Joined: Apr 2005
Posts: 31
V
Valo Offline OP
Ameglian cow
OP Offline
Ameglian cow
V
Joined: Apr 2005
Posts: 31
script looks like this now


on @*:JOIN:#popular:{
.timer 1 2 /.notice # my text
if $regex($nick,/^nick\d+$/i) {
.timer 1 5 if ( # ischan) /.notice # $nick $+ : change nick write /nick yournick
}
}

what should i change if i want that it shows only to that guy who comes in not to all in chat??


Link Copied to Clipboard