mIRC Home    About    Download    Register    News    Help

Print Thread
one-time notice on join #238951 10/09/12 11:34 PM
Joined: Apr 2012
Posts: 5
C
ChickyChan Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2012
Posts: 5
I want to /notice someone who joined my channel if he's joining with his nick for the first time.
So if he joins my channel a second time the /notice would not occur.
I thought about using a text file and make my script check whether the name is in the file or not.
If the name is written in the textfile nothing would happen.
If the name is not in the textfile the script would execute and add the one who's triggered the script to the textfile so the script wouldn't be triggered again if he joined.

I've got this so far but it doesn't work at all.

Code:
on *:JOIN:#mychannel:{
var %person = $read(people.ini)
  if ($readn == 0) 
  {
    /notice $nick Good day! 
    /write people.ini $nick
  }
}


Any help would be appreciated.

Last edited by ChickyChan; 10/09/12 11:45 PM.
Re: one-time notice on join [Re: ChickyChan] #238954 11/09/12 01:16 AM
Joined: Feb 2011
Posts: 323
K
KindOne Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Feb 2011
Posts: 323
Code:
  if ($readn == 0) 
  {

The opening brace '{' can't begin a line. This was causing the script to fail.


You don't need '/' inside of scripts, you can have them if you like, but they are not needed.

Corrected script.
Code:
on ^*:JOIN:#mychannel:{
  var %person = $read(people.ini)
  if ($readn == 0) {
    notice $nick Good day! 
    write people.ini $nick
  }
}


irc.swiftirc.net #msl (mIRC Scripting Language)
Re: one-time notice on join [Re: KindOne] #238955 11/09/12 02:55 AM
Joined: Apr 2012
Posts: 5
C
ChickyChan Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2012
Posts: 5
Thanks, at least the error message doesn't appear anymore.
But the script still does nothing.
I figured that
Code:
var %person = $read(people.ini)

nor
Code:
set %person $read(people.ini)

do anything.

Then I simply tried
Code:
  if ($nick != $read(people.ini,s,$nick)) {
    notice $nick Good day! 
    write people.ini $nick
  }

However, even if the person who triggered the script is in the .ini file it would still reply with "Good day!".
I suspect that I can't use $read in that situation.
Is there any other solution?

Re: one-time notice on join [Re: ChickyChan] #238956 11/09/12 03:49 AM
Joined: Jan 2004
Posts: 1,276
L
Loki12583 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,276
The s switch will return the rest of the line (excluding the first word). Use the w switch instead, and always use the n switch to prevent evaluation of the line unless you specifically need to. Prepend the $read alias with ! to negate its return value, so that the statements inside the block are run if the name is not found.

Also, .ini files have a specific formatting you aren't using. Just use .txt.

Code:
if (!$read(people.txt,nw,$nick)) {

Re: one-time notice on join [Re: Loki12583] #238958 11/09/12 08:46 AM
Joined: Apr 2012
Posts: 5
C
ChickyChan Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
C
Joined: Apr 2012
Posts: 5
Thanks, it's working fine.