Kirby commented on a Page, LOLOP  -  Mar 12, 2009

I used to do this to my "friends". >:D

Your script works 100% fine, but what if $2 happened to be the bot itself?
Even though the command is for op'd people only, it could be a problem.

Coincidentally, I've been looking into "commands with repetitiveness". (For example, write fruits.txt Apple | write fruits.txt Pears | write fruits.txt Oranges.), and I encounter something similar.

mode $chan +o $2 {
      mode $chan -o $2 {

I'm not flaming or anything, but just saying that it just so happened to catch my eye.

This isn't really for clearing repetitiveness, but just works fine.
Instead of using that

mode $chan +o $2 {
      mode $chan -o $2 {

, you can clear it up and say:

on *:text:.lolop *:#: {
  if ($nick(#,$nick,o)) && ($2 != $me) {
    var %x +o.-o, %y $2
    tokenize 46 %x
    mode # $* %y
  }
}

If this confuses you, let me elaborate.
Although this is a small script and my editing does not impact the script significantly, it can be of use when it comes to larger, more complex scipts.
I've just edited some parts, such as

if ($nick(#,$nick,o))

. That's the same thing as

if ($nick isop #)

, but I personally like the first way better. (Btw, '$chan' is the same thing as '#').

You only supplied if the person activating the command is an operator. Why not add a few more restrictions?

I've also added:

if ($2 != $me)

It's questioning whether $2 (second parameter) is not the bot; you don't want the bot deopping itself!

As for the rest, clearing the repetitiveness:

    var %x +o.-o, %y $2
    tokenize 46 %x

/var means to set a temporary (local) variable in the script.
So I'm making a variable called %x, which has a value of +o.-o (this will later stand for the two modes used in this script. %y has the value of the nick supplied in the bot command.
As for /tokenize, that's basically "making use of tokens of a string". You're separating the two values in %x, +o and -o, by 46. 46 is the chr # for the tokenizing. (As you can see, $chr(46) is the same as a period .) %x was equal to [b]+o.-o, so it turns out to be just +o and -o.
The last part,

    mode # $* %y

is just oping and deoping the same person.
As I mentioned before, $chan is the same thing as # and %y is the nick.
Now what is '$' ? As you know, in mIRC there are many identifiers--all starting with $. As is a wildcard in mIRC, it's basically taking all of the identifiers used in this script, overwriting each of them per use, and basically creating a mini-while in such small lines.
All I've done here was just setting variables to make a sequence, then finally oping and deoping the person supplied in the bot command.

Here's a shorter version (for a BOT):

on *:text:.lolop *:#: { if ($nick(#,$nick,o)) && ($2 ison #) && ($2 != $me) { var %x +o.-o, %y $2 | tokenize 46 %x | mode # $* %y } }

.
An alias too (if you want to put it on your OWN remotes, and not your bot's):

alias lolop { var %x +o.-o, %y $1 | tokenize 46 %x | mode # $* %y }

The syntax for the bot command I gave you is the same for the bot command that you made.

Sorry if this might be too hard for you to understand, but I'm just suggesting for future occasions (you might look back at this later when you get much better at it, xD).

Overall, I'd say it's okay for a beginner script

But keep on going! :-)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.