mIRC Home    About    Download    Register    News    Help

Topic Options
#237777 - 02/06/12 06:14 PM Notices
TheRandomDog Offline
Pikka bird

Registered: 15/05/12
Posts: 12
I have a question about if-then-else statements.

I have this:

Code:
if %nick isnotify && %nick ison #channelname goto done
elseif %nick ison #channelname /notice $nick Welcome to the Channel Name! The Public Saturday announcments have been enabled. If you are an op/staff member, you can disable them by typing !ATTGhalt. Have a nice day!
:done
else echo This toon has already recieved this message.


The elseif statement is good, whenever someone joins, it sends them the notice. But whenever someone joins that is on my notice list, it gives them the same notice instead of skipping that and going to :done. Help?

Top
#237780 - 02/06/12 08:53 PM Re: Notices [Re: TheRandomDog]
Loki12583 Offline
Hoopy frood

Registered: 22/01/04
Posts: 1271
Your control flow just doesn't make sense. And since I don't know when or where this is being called (combined with your mixing $nick and %nick), it's not easy to guess the best way to fix it or exactly how you want it to behave.

If you're calling this from a join event, I don't know why you're checking if they're on the channel - unless you're delaying the message with a timer.

It would be best to know the context you're using this in, but I believe the following may be what you want:

Code:
if (%nick ison #channelname) {
  if (%nick !isnotify) {
    notice %nick ...
  }
  else {
    echo This toon has already recieved this message.
  }
}

Top
#237781 - 02/06/12 09:55 PM Re: Notices [Re: Loki12583]
TheRandomDog Offline
Pikka bird

Registered: 15/05/12
Posts: 12
Okay. I'm kind of new to this, so I'm all over the place, aren't I?

Anyways, I took your suggestion and made a few modifications to it. I don't exactly know why I was checking if they were on either, but...

Code:
on 1:JOIN:#channelname:{
  if ($nick !isnotify) {
    echo This toon has already recieved this message.
  }
  else {
    notice $nick ...
  }
}


I changed the %s to $s, because I'm looking for them, not the variable (I think.) I also want it to echo IF they are on my notify list, not if they are not on my notify list.

Now, no matter if they are on my notify list or not, it will keep echoing the same message, "This toon has already recieved this message."

It will not go to else and notice the nick the message I put in there.

Top
#237784 - 02/06/12 11:26 PM Re: Notices [Re: TheRandomDog]
argv0 Offline
Planetary brain

Registered: 13/10/03
Posts: 3918
Loc: Montreal, QC, Canada
You can test isnotify outside your script so you don't need a JOIN event to trigger it. Type the following in your editbox (replace NICKNAME with the nick):

Code:
//echo -a $iif(NICKNAME isnotify,$true,$false)


Use the nickname that is joining to test it. If you're getting $false, it's because mIRC isn't recognizing the nick in the notify list (it could be a network specific listing and you're on the wrong network, for instance).

My hunch is you're going to get $false. Your script logic is actually well written, so it's likely an environment issue (settings) that is causing the logic to fail.
_________________________
- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Top
#237785 - 03/06/12 03:36 AM Re: Notices [Re: argv0]
TheRandomDog Offline
Pikka bird

Registered: 15/05/12
Posts: 12
The beginning is my script, the one above your post is someone else's, so.

On the contrary, when I add someone to my notify list and check it, I get $true.

But using the same settings, when I try the regular join instead of the edit box (with that command), I get the same results. Again, I want it to give the notice if they're NOT in my Notify list, which doesn't work. Yet I still get $true.

Anyone else have some ideas? This seems to be a hard case. crazy

Top
#237788 - 03/06/12 06:23 AM Re: Notices [Re: TheRandomDog]
Loki12583 Offline
Hoopy frood

Registered: 22/01/04
Posts: 1271
If you want it to echo when they're on notify, and notice when they aren't, you've reversed the cases from what I gave you.

Top
#237792 - 03/06/12 01:03 PM Re: Notices [Re: Loki12583]
TheRandomDog Offline
Pikka bird

Registered: 15/05/12
Posts: 12
I did, because that's how I wanted them, but I found a different way to make what I want work with the script you gave me.

Even when I test the script that you had provided, it still gives me the same error. The echo still appears wether they are on my notify list or not, and the command for the edit box still says $true when I add them to the notify list.

EDIT: I figured it out. The coding that I changed was:
Code:
on 1:JOIN:#attg: {
  if ($nick !isnotify) {
    /notice ...
  }
  else {
    echo This toon has already recieved this message. 
  }
}


I had discluded the $nick for some reason, it was probably an accident so that wouldn't have worked, so it went to else, which was to echo. That wasn't the only thing. For some reason it didn't like "!isnotify", so I removed the "!" and it worked!

Thanks guys for your help!


Edited by TheRandomDog (03/06/12 01:15 PM)

Top