mIRC Homepage
Posted By: ToRmEnTeD On-Join msg - 28/10/08 10:25 AM
Hey, Needing a small script that will simply say Hello to all the users as they join the channel and also ask age. A feature to add them to a list of approved people would be fantastic but also not required

So basicly on join would get a reply like

Hello USER , Welcome to #CHAN . May we have your age Please ?

Would like to add users to the list and maybe even be able to setup custom welcome messages for Known users?
And if all possible...all the commands in a pop window including the part involving custom messages maybe??

Take your time . Hope to get some good results on this
Posted By: sparta Re: On-Join msg - 28/10/08 01:44 PM
Code:
on ^*:join:#channel: {
.msg $nick Hello $nick $+ , Welcome to #channel . May we have your age Please ?
}

Change #channel to your channel name, and place it in remote in your mirc. ALT + R will open up the script editor/remote.

you can also use:
Code:
on ^*:join:#channel: {
if ($nick == moo) .msg moo Hello $nick $+ , you are moo.
elseif ($nick == foo) .msg $nick hello $nick $+ , you aren't moo.
elseif ($nick == baa) .msg $nick hello $nick $+ , you aren't foo or moo.
else {
 .msg $nick Hello $nick $+ , Welcome to #channel . May we have your age Please ?
}
}


the . hide the message from you, not fun watch all messages sent if you are on active channel.
Posted By: ToRmEnTeD Re: On-Join msg - 28/10/08 02:34 PM
Hey thanks for the reply. I am having issues. I use 2 scripts. I use invision to chat with and i use PNP as my bot sort of speak. This code you gave me works well with invision but i cant get it to work on PNP ....Thats where i am wanting it...any ideas as to why it wouldnt work ?

This is the code as its sitting on my script at the moment
Code:
 


on ^*:join:#chat18+: {
.msg $nick Hello $nick $+ , Welcome to #chat18+ . May we have your age Please ?
}

Posted By: sparta Re: On-Join msg - 28/10/08 03:11 PM
Code:
on *@:join:#: {
  if ($chan == #chat18+) {
    if ($nick == moo) { .msg moo Hello $nick $+ , you are moo. }
    elseif ($nick == foo) { .msg $nick hello $nick $+ , you aren't moo. }
    elseif ($nick == boo) { .msg $nick hello $nick $+ , you aren't foo or moo. }
    else {
      .msg $nick Hello $nick $+ , Welcome to $chan $+ . May we have your age Please ?
    }
  }
}

try this one then, tested and working for me, make sure you don't have any other on *:join: abow this code.
Posted By: ToRmEnTeD Re: On-Join msg - 28/10/08 04:44 PM
Thanks still dont work on PNP but im thinking that maybe its because i already have an onjoin event being used on that script..I have it set to auto whois on join ..not on the same files ,the 2 scripts but they are both onjoin events from the same bot/script. I am just going to host it on the Invision client. However i have another smaller problem. I dont see anything on Invision when it sends the greet to a user that just joined....How would i go about see it?
Posted By: Tomao Re: On-Join msg - 28/10/08 05:58 PM
You could put sparta's code in a new remote file or combine it with another onjoin event you already have.
Posted By: ToRmEnTeD Re: On-Join msg - 28/10/08 06:04 PM
I am ok with the code...Just having to use it on antother script than i had planed...but all im wanting to know now is how do i change that script so i can see when my script greets someone that enters.....I dont see anything the way it is. everyone else sees it but me . I know it might be nice to know how to have it the way it is right now but for right now i would like to see it saying it
Posted By: Horstl Re: On-Join msg - 28/10/08 06:42 PM
To see the messages in the sending client itself, remove all the dots in front of the "msg" commands (msg <something> instead of .msg <something>).
Posted By: ToRmEnTeD Re: On-Join msg - 28/10/08 07:43 PM
Ahh ok ...and I think that was already kinda told to me but i didnt get it .Thanks for clearing that up. Works fine. Still cant figure out why its not working on PNP...I have other Onjoin scripts running like a whois onjoin and a peak users script...But they are all seperate scripts frown

Anyways thanks to all of you. Another good script smile
Posted By: ToRmEnTeD Re: On-Join msg - 28/10/08 08:11 PM
been sitting here messing with this trying to get the text it sends to channel to be ACTION/ME text. ..Cant seem to get anything to work trying it. Any thing i need to do other than change the MSG to ME or ACTION ? I even tried /ME and it didnt do anything.
Still works fine using msg tho
Posted By: Tomao Re: On-Join msg - 28/10/08 08:34 PM
You can try /describe

/describe <nick|channel> <message>
Posted By: ToRmEnTeD Re: On-Join msg - 28/10/08 09:50 PM
Yup that worked perfect smile Thanks a million
Posted By: ToRmEnTeD Re: On-Join msg - 31/10/08 10:12 AM
Ahh im back again...Ok this script is working great for the most part... I basicly just have 2 msgs...the one asking for age and then one i have for known people that i have added. So my code is this...

Code:



on *@:join:#: {
  if ($chan == #chat18+) {
    if ($nick == AnTiSoCiaL) { /describe $chan Hey $nick $+ , Welcome Back :) }
    elseif ($nick == Zule) { /describe $Chan Hey $nick $+ , Welcome Back. :)    }
    elseif ($nick == Bad_Idea) { /describe $nick Hey $nick $+ , Welcome back :) }
    elseif ($nick == SloFlyer) { /describe $nick Hey $nick $+ , Welcome back :) }
    elseif ($nick == Merkin_Man) { /describe $nick Hey $nick $+ , Welcome back :) }
    elseif ($nick == AKASHA) { /describe $nick Hey $nick $+ , Welcome back :) }
    else {
      /describe $chan Hello $nick $+ , Welcome to $chan $+ . May we have your age Please ?
    }
  }
}



 


My problem is that when "at least" the users Bad_idea joins my script sends her a /msg instead of a /describe msg
Noone wants a PM everytime you join. It dont do it to my client "Antisocial" It seems to work fine. Anything wrong with the code that would cause this? Also a HUGE question...Could somone make this into a pop-up so i could just right click on someones nick and add them to the known list so the would get the welcome back msg and not the age question? right now im adding them by hand ...ok but kinda pain
Posted By: sparta Re: On-Join msg - 31/10/08 12:20 PM
How do you store the nick? in a text file or variable ?

PS
/ aren't needed in a remote script, so you don't need /describe smile
Posted By: DJ_Sol Re: On-Join msg - 31/10/08 12:23 PM
Look at your code. Once you get to 'Bad Idea' you switch to /describe $nick instead of describe $chan.

Also, look u have the same command over and over.

What you want to do is create a list of nicks then if the nick is in the list, welcome them back. Otherwise ask for age.

I have to leave for work otherwise I'd write something for you. If it isn't done when I get home I'll do it, but most likely this will be taken care of.

A text file is easy for this sort of thing, but I don't like using them. I'd probably make this an ini file seperating the nicks by channel or something.




Posted By: mOX Re: On-Join msg - 31/10/08 12:36 PM
Code:
on *@:join:#chat18+: {
 if $istok(AnTiSoCiaL Zule Bad_Idea SloFlyer Merkin_Man AKASHA,$nick,32) { describe $chan Hey $nick $+ , Welcome Back :) }
 else { describe $chan Hello $nick $+ , Welcome to $chan $+ . May we have your age Please ? }
}

Sorry for my short explanation, but not mastered the English blush
Posted By: sparta Re: On-Join msg - 31/10/08 01:00 PM
I made this for you, if i understand right you want to ask any new user there age, and if they have been on the channel 1 time before, then you just want to great them with a welcome message? here we go:
Code:
on *:join:#: {
  if ($nick != $me) && ($chan == #chat18+) {
    if (!$isfile($+(join.txt))) { write join.txt }
    if ($nick isin $read(join.txt, w, $+(*,$nick,*))) { describe $Chan Hey $nick $+ , Welcome Back. :)    }
    else {
      describe $chan Hello $nick $+ , Welcome to $chan $+ . May we have your age Please ?
      write join.txt $nick
    }
  }
}

This will create the file join.txt first time someone join the channel, then it will add the nick to the txt file, and after that it will scan the file, if a nick is in the text file. then it will just great the user, if a user are new, then it will add the user and ask for the age, and next time he join it will be a great with welcome. hope this is what you looking for.
Posted By: ToRmEnTeD Re: On-Join msg - 31/10/08 02:17 PM
Almost i am wanting a script that i can kinda just add them as we get to know them. 1 time visit could be tricked by just a quick join and part... Its really important that we be able to add them only after we are trusting of them.lots of idiots on our server
Posted By: sparta Re: On-Join msg - 31/10/08 02:23 PM
Then remove the "write join.txt $nick" part from the script, then use this one to manual adding:
Code:
menu nicklist {
Add user:{ write join.txt $1 }
}
Posted By: ToRmEnTeD Re: On-Join msg - 31/10/08 07:22 PM
Hi and thanks for your help. I am still very new. I think i did what you said? I removed the line and replaced it with the second bit you gave me ...Code looks like
such but i am pretty sure its my fault lol

Do you see what i did?

Code:
 


on *:join:#: {
  if ($nick != $me) && ($chan == #chat18+) {
    if (!$isfile($+(join.txt))) { write join.txt }
    if ($nick isin $read(join.txt, w, $+(*,$nick,*))) { describe $Chan Hey $nick $+ , Welcome Back. :)    }
    else {
      describe $chan Hello $nick $+ , Welcome to $chan $+ . May we have your age Please ?
      menu nicklist {
Add user:{ write join.txt $1 }
}

    }
  }
}





This is what i get in my status window...


Code:
 


[3:13pm] gazer3 (ewcflash@ewc-0f0ecf17.dsl.as9105.com) has joined. «10 people»
[3:13pm] * @ToRmEnTeD Hello gazer3, Welcome to #chat18+. May we have your age Please ?
[3:13pm] ERROR > 421: Unknown command: MENU
[3:13pm] ERROR > 421: Unknown command: ADD
[3:13pm] <@KrazyKitty> yea
[3:13pm] gazer3 (ewcflash@ewc-0f0ecf17.dsl.as9105.com) has parted. «9 people»
Posted By: sparta Re: On-Join msg - 31/10/08 07:25 PM
Code:
on *:join:#: {
  if ($nick != $me) && ($chan == #chat18+) {
    if (!$isfile($+(join.txt))) { write join.txt }
    if ($nick isin $read(join.txt, w, $+(*,$nick,*))) { describe $Chan Hey $nick $+ , Welcome Back. :)    }
    else {
      describe $chan Hello $nick $+ , Welcome to $chan $+ . May we have your age Please ?
      ;write join.txt $nick
    }
  }
}
menu nicklist {
  Add user:{ write join.txt $1 }
}

Just copy and paste, don't change anything and see if it working as you want it to smile

right click in the nick list and you should see the menu there, the nick you have highlighted will be the one you add to the list..
Posted By: ToRmEnTeD Re: On-Join msg - 31/10/08 07:45 PM
ha, Works perfect! Thanks very much smile
Posted By: sparta Re: On-Join msg - 31/10/08 07:48 PM
If you want it to auto add in the future, just remove the ; in the end of the code: ;write join.txt $nick

and you can edit the adding thing too.
Code:
menu nicklist {
  Add user:{ write join.txt $1 | echo -a Added $1 to the list. }
}
Posted By: ToRmEnTeD Re: On-Join msg - 31/10/08 07:53 PM
wow man i was just messing with it and you even fixed my first problem...your code works with my PNP so i dont need to run it on my chat script anymore laugh Very nice man . Greatly apprecate your services!
Posted By: Tomao Re: On-Join msg - 01/11/08 06:49 AM
This one uses variables for nick storage and does the same thing instead of the text file:

Code:
on *:JOIN:#: {
  if ($nick != $me) && ($chan == #chat18+) { 
    if ($istok(%Users,$nick,44)) { describe # Hey $nick $+ , welcome back. :) }
    else { describe # Hello $nick $+ , welcome to $chan $+ . May we have your age please? }
  }
}
menu nicklist {
  Add user: {
    if ($1 isin %Users) { echo 4 -a * User $1 has already been added. } 
    else { set %Users $addtok(%Users,$1,44) | echo 2 -a * $1 added to the list. }
  }
  Delete user: { 
    if ($1 !isin %Users) { echo 4 -a * User $1 does not exist. } 
    else { 
      set %Users $remtok(%Users,$1,1,44) | echo 2 -a * User $1 has been removed from the list. 
    }
  }
}


Also a delete feature is added so you can remove nicknames stored that you don't want anymore.
Posted By: Kol Re: On-Join msg - 01/11/08 08:05 AM
Wouldn't this be a perfect situation for user levels? o.O
Posted By: RusselB Re: On-Join msg - 01/11/08 09:48 AM
One problem that I can foresee using variables for this, is if you are running the code on multiple channels and/or multiple networks, especially if there is a large number of users per channel and/or a network that allows very long nicks.

Eg: 5 networks @ 10 channels/network, 100 nicks/channel & 50 characters/nick. Some quick math gives me a total of 255,000 characters, which, if all stored in the one variable, would exceed (or at least push) the current limits for the number of characters allowed in a variable.
Posted By: Tomao Re: On-Join msg - 01/11/08 04:50 PM
So what is your recommendation on such matter? Using a hash table perhaps?
Posted By: RusselB Re: On-Join msg - 01/11/08 06:47 PM
While hash tables are one way of handling this, Kol's suggestion makes a lot of sense.
© mIRC Discussion Forums