mIRC Home    About    Download    Register    News    Help

Print Thread
#207804 02/01/09 07:09 PM
Joined: Nov 2007
Posts: 117
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2007
Posts: 117
on 1:open:?: {
.notice $Me $nick te manda un privado
.if %nick isin %nolist { .echo -a 1,8Testeando.. }
.if %nick && %ve == 1 { .echo -a 1,3Aprobado )
else %nick && %ve == 0 { .notice $Nick no has sido aceptado | close -m $NIck | halt }
}
}
}

i made this , but doesnt work,any help

if the nick is on the list, it will be accepted else close the window

thnx


TheWarlock #207805 02/01/09 07:29 PM
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Please explain what %nick means and what %ve means, and what values they have.

TheWarlock #207807 02/01/09 10:16 PM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
you have 2 syntax problems:

1) your "else" has a condition.. else blocks never have a condition. Please read /help /if to look at the syntax for if/elseif/else-- you probably want elseif.

2) you have two independent if branches. both will execute-- meaning if %ve is 0, you will *always* close the window, regardless of the initial check for the list. This is what is happening:

if (%nick isin %nolist) ...

followed by:

if (%nick && %ve) ...
else ...

both of these branches will get executed. it will check if the nick is in the list, and THEN check if %ve is 1 or 0. If it is 0, it will close the window. Your second "if" should be an "elseif" if you want it to only execute the first matched condition of the three.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
argv0 #207808 02/01/09 11:43 PM
Joined: Nov 2007
Posts: 117
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2007
Posts: 117
i dont get it , can you showme some example thnx

argv0 #207809 02/01/09 11:43 PM
Joined: Nov 2007
Posts: 117
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2007
Posts: 117
i dont get it , can you showme some example thnx

TheWarlock #207810 03/01/09 12:24 AM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Examples can be found in the help file under /help /if, others may write more complete examples (aka "write it for you")


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
TheWarlock #207832 04/01/09 12:18 AM
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Examples ...

if (comparison) { command }
elseif (comparison) { command }
else { command }


I read it as a sentence.

If such and such is true, do this command.
Else if such and such is true do THIS command.
else do this command ....

The thing is, when you have an if statement it will evaluate the comparison and if it is true it will perform the command. Then it will move on to the next line UNLESS you return or halt or use elseif or else.

When you read it like a sentence it makes sense.

if (this is true) { do this }
elseif (this is true) { do this }
else { do this }




Code:
on 1:open:?: {
.notice $Me $nick te manda un privado 
if (%nick isin %nolist) { .echo -a 1,8Testeando.. }
elseif (%nick) {
if (%ve == 1) { .echo -a 1,3Aprobado ) 
elseif (%ve == 0) { .notice $Nick no has sido aceptado | close -m $NIck | halt } 
}
}
}


Try this, I don't really know the point or the different variables so I couldn't give you the best option.


Link Copied to Clipboard