mIRC Homepage

Script issue with comparisons... Why?

Posted By: Amun

Script issue with comparisons... Why? - 27/03/09 06:21 AM

This does not work:
on *:CONNECT: {
if ($me == sas) || ($me == squatchy)
{
if ($server == chicago.us.p2pirc.org) {
/nsp2p | /j supertorrents | /j stmusic | /j pre
}
}
}

However, this does:

on *:CONNECT: {
if ($me == sas) || ($me == squatchy) && ($server == chicago.us.p2pirc.org) {
nsp2p
j #supertorrents
j #stmusic
j #pre
}

Am I just not seeing it? If I remove the nickname checking part in the first one, it works fine... But not with it in it.
Posted By: Tomao

Re: Script issue with comparisons... Why? - 27/03/09 09:50 AM

The reason the first one won't work is that a bracket is misplaced.
Quote:
on *:CONNECT: {
if ($me == sas) || ($me == squatchy)
{

Should be:
Quote:
on *:CONNECT: {
if ($me == sas) || ($me == squatchy) {
Posted By: Trixar_za

Re: Script issue with comparisons... Why? - 28/03/09 12:25 AM

Yes the bracket and I can see you've programmed in C smile

May I just suggest that you use $network instead of $server, it's more flexible because it the same for all servers in the network, which helps if you connect to the round ribbon address (irc.whatever.com) instead of directly to a certain server (bleh.whatever.com).

Just thought that would help smile - later
Posted By: argv0

Re: Script issue with comparisons... Why? - 28/03/09 01:31 AM

You might be interested in looking at some other syntax rules that differ from C http://kthx.net/ftb/#34
Posted By: Trixar_za

Re: Script issue with comparisons... Why? - 28/03/09 09:31 PM

Also I'll add to argv0's link's list of difference, that mIRC scripts don't like TAB. One time I spent hours looking for the error in my script, which I just couldn't find, only to discover that I used TAB instead of spacebar with a few lines of code.
© 2022 mIRC Discussion Forums