mIRC Home    About    Download    Register    News    Help

Print Thread
#106639 01/01/05 10:25 PM
Joined: Jan 2004
Posts: 46
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Jan 2004
Posts: 46
I've given up trying to search through the help files any longer, because I've come to realise the problem is I don't know what I'm doing.

What I'm trying to do, is create a script (on text) that will be able to tell if someone says, " !<any nick in the nicklist> " and have the script be able to tell if "whatever follows" the apostrophe is a nick on the channel, then have a reaction.

I have been messing around far too much with things like
if ($left($1-,1) == $char33) and && ($right($left($1-,1) ison #))) (the last part I know is wrong) and the like, and I've determined that I won't get this without some help. Enough failure already! lol
Anyone with any clue as to how I can get this to work, the help would be greatly appreciated. Thanks

#106640 01/01/05 10:27 PM
Joined: Dec 2002
Posts: 230
G
Fjord artisan
Offline
Fjord artisan
G
Joined: Dec 2002
Posts: 230
Code:
on *:text:!?*:#yourchannel:{
  if ($mid($1-,2) ison $chan) {
    yourstuffhere
  }
}

#106641 01/01/05 11:19 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Go with what greeny gave you.

Anyway, wanted to let you know where you got mixed up.


($left($1-,1) == $char33) and && ($right($left($1-,1) ison #)))

  • $char33 should be $chr(33), but in this case you can even specify the exclamation mark directly.

    if $left($1,1) == !
  • $right($left($1-,1) ison #

    Here's where you got mixed up.

    You were looking for: $right($1,-1) or $mid($1,2)

    * $right(string,N) normally returns the N characters of string, starting from the right. Though if we use a negative value, $right will work in a different way.

    * $right(string,-N) returns the string, with N characters cut off from the beginning.

    $right(!filedumphere,-1) = filedumphere
    $right(!filedumphere,-2) = iledumphere
    $right(!filedumphere,-3) = ledumphere
    ...

    * $mid(string,S,N) returns the string, starting at point S, N characters long.

    $mid(!filedumphere,1,5) = !file
    $mid(!filedumphere,6,4) = dump
    $mid(!filedumphere,2) = filedumphere (no N parameter was given, so $mid will take any text following the S starting point)

  • We end with: if ($left($1,1) == !) && ($right($1,-1) ison #) { do things }

  • Note that I specify $1 and not $1-, because a nickname cannot consist of spaces, we only need to reference the first space delimited token, which will be the nickname preceeded by an exclamation mark.

Greets

#106642 02/01/05 09:46 AM
Joined: Jan 2004
Posts: 46
F
Ameglian cow
OP Offline
Ameglian cow
F
Joined: Jan 2004
Posts: 46
Thanks for the response and the detailed description. I learned a lot from it wink I used what greeny posted as well as yours, and they both worked. I knew I was close, just not close enough.

#106643 02/01/05 06:08 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Glad to hear you could learn from it. I learned a lot from these boards as well, it's only right I return the favor.

Greets


Gone.

Link Copied to Clipboard