mIRC Homepage
Posted By: raycomp Help with on join script - 24/09/18 08:28 PM
I want to welcome users according to their modes in mirc some work others dont.

Quote:
on *:JOIN:#:{
if (Sybian iswm $nick) msg $chan $nick is a bot so be careful | return
if ($nick isreg $chan) msg $chan - Welcome, $nick Thank you for registering your nick! | return
if ($nick isop $chan) msg $chan - Welcome $nick our friendly channel ops | return
if ($nick ishop $chan) msg $chan - Welcome $nick our channel half op | return
if ($nick isvoice $chan) msg $chan - Welcome $nick - lovely lady..... | return
msg $chan - Welcome $nick - to our channel.....
}


Any ideas how to fix this. maybe because on join they are not opped or voiced yet?
Posted By: maroon Re: Help with on join script - 24/09/18 09:16 PM
Yes, it's a problem that nobody has status during the JOIN event. You could trap the :OP: event when someone is given that status, or have a timer wait a few seconds, passing parameters to it only if they can't be evaluated, such as not passing $1-
/timer 1 2 my_alias $chan $nick

You also have a problem in that the 'return' at the end of the Sybian line is not part of the conditional command, so it executes regardless whether the if() is $true or not. To have it part of the conditional command, you must enclose all the conditionals inside curly braces

if ($rand(1,2) == 1) echo -a displays only if rand is 1 | echo -a always displays
if ($rand(1,2) == 1) { echo -a displays only if rand is 1 | echo -a also displays only when if() is true }
Posted By: Raccoon Re: Help with on join script - 24/09/18 09:22 PM
You want to use the events On Op, On Help, and On Voice to give commentary about somebody's mode status when they receive it.

Also
Originally Posted By: raycomp
if ($nick isreg $chan) msg $chan - Welcome, $nick Thank you for registering your nick!
This does not mean they are a registered user. It means they are a REGULAR user without any status at the moment. All users Join as "isreg" until you op, halfop, or voice them.
Posted By: landonsandor Re: Help with on join script - 25/09/18 04:02 AM
Something I used to use ages ago was the internal auto-op and autovoice lists. An example of my coding, which I don't even know if it works anymore (as I have not used mirc for chatting in a VERY long time):

Code:
on *:join:#channel-name: {
if (Sybian iswm $nick) { msg $chan $nick is a bot so be careful | halt }
elseif ($address($nick,"masknumber") isaop #) { msg $chan - Welcome $nick our friendly channel ops | halt }
elseif ($address($nick,"masknumber") ishop #) { msg $chan - Welcome $nick our channel half op | halt }
elseif ($address($nick,"masknumber") isavoice #) { msg $chan - Welcome $nick - lovely lady | halt }
else { msg $chan - Welcome $nick - to our channel | halt }
}


My coding is really rusty, but I think you get the idea, and I BELIEVE this would work. The "isreg" is unneeded since not only is EVERYBODY a regular user upon joining, isaop, and isavoice would take care of all modes (not to mention isprotect if you decide to use that). Anybody NOT on one of those lists is a "regular" person in that channel. Then, if people change nicknames a lot, but you want to recognize them, you would do:

Code:
if (($address($newnick,"masknumber") isaop) && ($mask($fulladdress,"masknumber") !isaop)) { //aop $mask($fulladdress,"masknumber") $aop($address($newnick,"masknumber")).type }
if (($address($newnick,"masknumber") isavoice) && ($mask($fulladdress,"masknumber") !isavoice)) { //avoice $mask($fulladdress,"masknumber") $avoice($address($newnick,"masknumber")).type }


I couldnt find a hop identifier or command in mirc altho I'm using 7.45, so not quite the latest. What these lines will do is if the person is in your address book as an auto-op or autovoice, and they change nicknames, it will automatically add the new nickname to the proper list for the proper channel. That option is really your choice, but when I used it in a script ages ago, it worked REALLY well and fast too. You COULD use the protect list as your Half-op list as well. The lists dont even need to be active, the person just needs to be ON the list. Any instance of "masknumber" means you can use your preferred mask type. I used 9 as it seemed the best combo for my needs, but you may have another one.

If I have misunderstood what you're trying to do, or due to my lack of usage of the program am way off the mark, then I apologize. I rarely come to these forums anymore, but this type of thing spoke to me as the codes in this post were ripped right out of one of my own scripts. I was in the small percentage of mirc scripters who used the Address book this way. I hope this helps.
Posted By: Noblesse Re: Help with on join script - 20/10/18 05:08 PM
something like this? [example]
Quote:
On *:join:#greetchannel: { inc -u1 %j | if (%j < 5) { .timerwelcome $+ $nick 1 2 welcome $chan $nick } }

alias -l welcome {
if ($nick($1,$2,o)) { msg $1 welcome $2 our $1 ops | halt }
if ($nick($1,$2,h)) { msg $1 welcome $2 our $1 half ops | halt }
if ($nick($1,$2,v)) { msg $1 welcome $2 our $1 Voices | halt }
if ($nick($1,$2,r)) { msg $1 - Welcome $2 - to our channel..... | halt }
}
Posted By: maroon Re: Help with on join script - 20/10/18 06:50 PM
a couple comments.

1. The :#: should be modified to list the name of your channel, so it doesn't activate in #help or every other channel you're in.

2. The user should understand this isn't going to greet 100%. The %j is an anti-flood method to avoid yourself flooding if many people join at the same time, but it also means that if 2 ops join at the same time, only 1 gets greeted.

3. This should not be forcing the timer to be named after the nick. It risks replacing a legitimate timer like timerDaily or timerHourly if someone happens to join with that nick. If someone knows what scripts you're running, and knows if one of them depends on a timer that repeats after long intervals, they can use this to disable your script. Either maliciously or for the lolz.
© mIRC Discussion Forums