mIRC Home    About    Download    Register    News    Help

Print Thread
#140034 21/01/06 11:13 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
my code for my channel:

Code:
ON *:JOIN:#channel: {
  if ($nick == $me) { /.timertopik 1 3 /topic #channel - my topic - | /.timermode 1 3 /mode #channel +sl 101 | /.timerfish 1 3 /invite fishbot #channel }
  elseif (fishbot isin $nick) || (myfriend isin $nick) { .op #channel $nick }
}
  


but i want to make also this thing:

if (myfriend !isin $nick) || (fishbot !isin $nick) { -> kick + ban other user )

but how to put it there?
i cant make

if me
elseif they
(and again)
elseif intruder

:tongue:


IceCapped
#140035 21/01/06 12:25 PM
Joined: Nov 2003
Posts: 227
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Nov 2003
Posts: 227
I'm not sure if you meant

if (myfriend !isin $nick) || (fishbot !isin $nick) { -> kick + ban other user )

or

if (myfriend !isin $nick) && (fishbot !isin $nick) { -> kick + ban other user )


If it's the 2nd one, just add an else { ban # $nick 2 Banned for not having the right nick }

#140036 21/01/06 12:30 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
so it structure is this:

if
elseif
else

?


IceCapped
#140037 21/01/06 01:52 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Yes you can do it like that.

/help If then else

Quote:
Basic format

if (v1 operator v2) { commands }
elseif (v1 operator v2) { commands }
else { commands }


While it doesn't show it, you can have as many elseif statements as you want, just remember that each "section" starts with an IF and (normally) ends with an ELSE

Under certain circumstances, you might not need the last ELSE, but without knowing the details of your code and how it's going to work, I can't say if this will apply to you or not

#140038 21/01/06 02:07 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
cool
thanks to both !

edit:
and which code i need

if (myfriend !isin $nick) || (fishbot !isin $nick) {
or
if (myfriend !isin $nick) && (fishbot !isin $nick) {

Last edited by raZOR; 21/01/06 02:09 PM.

IceCapped
#140039 21/01/06 03:44 PM
Joined: Nov 2003
Posts: 227
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Nov 2003
Posts: 227
What you need depends on what you want to do.

Using the || will match in all cases apart from when the nick contains both those "words"

From the command line you can test out the logic.

//var %nick = myfriendfishbot | if (myfriend !isin %nick) || (fishbot !isin %nick) { echo -a true }

//var %nick = myfriend | if (myfriend !isin %nick) || (fishbot !isin %nick) { echo -a true }

etc.

Change the %nick variable's value to what ever, it will echo true when its true, else it will do nothing.

Failing that, google for truth tables. I'm sure there is something there that will show you how to draw one up.
They really help to gain understanding and find better equavilant if tests that might be more efficient in many situations.

If its the && thing you want, using the previous else if you have, you can just use "else"

#140040 21/01/06 04:27 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
cool, thanks man


IceCapped
#140041 21/01/06 04:28 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
It seems to me like you're not quite sure what || and && actually do
The || is an OR operand
ie: if (myfriend !isin %nick) OR (fishbot !isin %nick)
If EITHER of these is true, then the statement comes back as True

The && is an AND operand
ie: if (myfriend !isin %nick) OR (fishbot !isin %nick)
If BOTH of these are true, then the statement comes back as True

#140042 21/01/06 04:59 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
i know the operators

so its like

IF friend is NOT in $nick OR fishbot is NOT in $nick then kick/ban

therefore is use ||
ps. i tested it so it seems ok

Last edited by raZOR; 21/01/06 04:59 PM.

IceCapped
#140043 21/01/06 09:17 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
IF friend is NOT in $nick OR fishbot is NOT in $nick then kick/ban


You just said, the $nick must have BOTH "friend" & "fishbot" in the nick otherwise its getting kicked.


Link Copied to Clipboard