mIRC Home    About    Download    Register    News    Help

Print Thread
#237777 02/06/12 05:14 PM
Joined: May 2012
Posts: 12
T
Pikka bird
OP Offline
Pikka bird
T
Joined: May 2012
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?

TheRandomDog #237780 02/06/12 07:53 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
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.
  }
}

Loki12583 #237781 02/06/12 08:55 PM
Joined: May 2012
Posts: 12
T
Pikka bird
OP Offline
Pikka bird
T
Joined: May 2012
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.

TheRandomDog #237784 02/06/12 10:26 PM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
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"
argv0 #237785 03/06/12 02:36 AM
Joined: May 2012
Posts: 12
T
Pikka bird
OP Offline
Pikka bird
T
Joined: May 2012
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

TheRandomDog #237788 03/06/12 05:23 AM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
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.

Loki12583 #237792 03/06/12 12:03 PM
Joined: May 2012
Posts: 12
T
Pikka bird
OP Offline
Pikka bird
T
Joined: May 2012
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!

Last edited by TheRandomDog; 03/06/12 12:15 PM.

Link Copied to Clipboard