mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
I have this script that works fine until I added the @. I want it to be so that only ops can use it. However, I put the @ and now it wont run at all. Ran fine without it.

Anyone know why?

Here is the script:
Quote:
ON @:TEXT:!Sban*:#: {
if ( $2 == $null ) {
notice $nick please specify a nick | return
}
if ( $2 == $me ) {
.notice $nick Nt. I don't think so. | return
}
else /mode $chan +b $2
/mode $chan +b $address($2,1)
/mode $chan +b $address($2,2)
/mode $chan +b $address($2,3)
/mode $chan +b $address($2,4)
/mode $chan +b $address($2,5)
/mode $chan +b $address($2,6)
/mode $chan +b $address($2,7)
/mode $chan +b $address($2,8)
/mode $chan +b $address($2,9)
/mode $chan +b $address($2,10)
/mode $chan +b $address($2,20)
.msg $chan better hope you dont get kicked $2. You won't be back any time soon.
}

ON @:TEXT:!Sunban*:#: {
if ( $2 == $null ) {
notice $nick please specify a nick | return
}
else /mode $chan -b $2
/mode $chan -b $address($2,1)
/mode $chan -b $address($2,2)
/mode $chan -b $address($2,3)
/mode $chan -b $address($2,4)
/mode $chan -b $address($2,5)
/mode $chan -b $address($2,6)
/mode $chan -b $address($2,7)
/mode $chan -b $address($2,8)
/mode $chan -b $address($2,9)
/mode $chan -b $address($2,10)
/mode $chan -b $address($2,20)
.msg $chan Well I felt sorry for you too.
}

Joined: Apr 2007
Posts: 228
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Change the on event from the @ over to *, and try this:

if ($nick isop $chan)

Code:
ON *:TEXT:!Sban*:#: {
  if ($nick isop on $chan) {  
    if ( $2 == $null ) { notice $nick please specify a nick | return }
    if ( $2 == $me ) { .notice $nick Nt. I don't think so. | return }
    else { 
      /mode $chan +b $2
      /mode $chan +b $address($2,1)
      /mode $chan +b $address($2,2)
      /mode $chan +b $address($2,3)
      /mode $chan +b $address($2,4)
      /mode $chan +b $address($2,5)
      /mode $chan +b $address($2,6)
      /mode $chan +b $address($2,7)
      /mode $chan +b $address($2,8)
      /mode $chan +b $address($2,9)
      /mode $chan +b $address($2,10)
      /mode $chan +b $address($2,20)
      .msg $chan better hope you dont get kicked $2. You won't be back any time soon.
    }
  }
}

ON *:TEXT:!Sunban*:#: {
  if ($nick isop on $chan) {
    if ( $2 == $null ) { notice $nick please specify a nick | return }
    else { 
      /mode $chan -b $2
      /mode $chan -b $address($2,1)
      /mode $chan -b $address($2,2)
      /mode $chan -b $address($2,3)
      /mode $chan -b $address($2,4)
      /mode $chan -b $address($2,5)
      /mode $chan -b $address($2,6)
      /mode $chan -b $address($2,7)
      /mode $chan -b $address($2,8)
      /mode $chan -b $address($2,9)
      /mode $chan -b $address($2,10)
      /mode $chan -b $address($2,20)
      .msg $chan Well I felt sorry for you too.
    }
  }
}


Also, cramming stuff up against identifiers never turns out well:

$2.

could be

$2 $+ .

$+ combines the identifier and whatever else, while still parsing it properly.

Last edited by Mpot; 18/10/07 04:08 AM.
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
and just to clarify, from the /help file:
Quote:
The @ prefix

You can limit events to being executed only when you have Ops on a channel by using the @ prefix.

on @2:JOIN:#mIRC:/mode $chan +o $nick

When the above user joins channel #mIRC and you have Ops on #mIRC, the associated /mode command will be executed, in this case giving the user Ops. If you don't have Ops, the event will not trigger.

So this makes the script trigger only when you have ops, not when others do. For that you use the abovementioned if-statement: if ($nick isop $chan)

Last edited by 5618; 18/10/07 11:31 AM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Change the 2 "if ($nick isop on $chan) {" in Mpot's code to:

Code:
if ($nick isop $chan) {


As mentioned @ checks if YOU are an op, not the person triggering the script.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
Ooo I see. Thanks Riamus didn't understand that.

By the way mpot, I don't understand how to use the $2 $+. Could you give me an example as to how it would be used in this script?

Also I remember a friend telling me you could put something like $2- and it meant that the script would not run if $2 was empty or not specified. I know I did a if $2 == null thingy. BUt whats the command just for my own curiosty, is it $2-?

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
if (!$2)

/help if then else

Originally Posted By: mirc.chm

You can use the ! prefix in front of variables and identifiers in an if-then-else statement to negate a value.


Joined: Apr 2007
Posts: 228
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2007
Posts: 228
Oops, I did put an "on" in there. Should be isop $chan, not isop on chan. ANYHOW.

A double $$ means that the script won't run if the data isn't specified. A single $ means that it'll try and run anyway. As for $-, that basically means that the identifier can have more than one word. For example:

I like pie! could be $1 $2 $3

or

$1-


--


$+ combines things. For instance:

I li $+ ke pi $+ e

Would turn in to

I like pie

The point of doing that is so that you can combine stuff in the output. Let's say you wanted to message the channel with a comma after the nickname.

msg $chan What's up $nick, how are you?

Would cause an error, because the engine reads it incorrectly.

However, this would work and allow the engine to read it properly, and still output with the comma after the nick:

msg $chan What's up $nick $+ , how are you?


--

Oh, yeah, for stopping if something inputted:

if ($1 == $null) { return }

Or, shorten it to

if (!$2) { return }

The ! is a negation prefix.

Last edited by Mpot; 18/10/07 04:48 PM.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
Originally Posted By: Mpot

I like pie! could be $1 $2 $3

or

$1-



I like pie! could also be $1-3

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
if ($1 == $null) { }
is different of
if (!$1) { }

!$1 means that $1 is equal to $false, $null or 0, not only $null


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2007
Posts: 42
Z
zad0909 Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jul 2007
Posts: 42
Thanks for clearing all that up guys <3


Link Copied to Clipboard