mIRC Home    About    Download    Register    News    Help

Print Thread
Help with $1-2 #195222 20/02/08 05:27 AM
Joined: Dec 2007
Posts: 24
T
Tzar469 Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Dec 2007
Posts: 24
I'm making a kill-count script for a deathmatch game. This game is relayed from the server to a channel. I want the triggers to work if it is in the first or second position because I want this to able to be triggered by the relay bot so it can send the data back to the server. I'm puzzled as to why the following only partially works:

Code:
on *:text:!*:#:{
  if (!stats isin $strip($1-2)) {
    if ($2 == !stats) var %nick = $iif($3,$3,$1), %ingame = 1
    elseif ($1 == !stats) var %nick $iif($2,$2,$nick)
    dmsg %nick has killed $calc($hget(playerkills,%nick)) people without dying. 
  }
  elseif (!deaths isin $strip($1-2)) {
    if ($1 == !deaths) var %nick $iif($2,$2,$nick)
    elseif ($2 == !deaths) var %nick $iif($3,$3,$1), %ingame 1
    dmsg %nick has died $calc($hget(playerdeaths,%nick)) times.
  }
}
alias dmsg { msg $chan $iif(%ingame,!fds msg) $1- )


The problem is that the script triggers on !stats and !deaths but not if either of them is $2. It also don't work if the line is colored. How do I fix this?

Last edited by Tzar469; 20/02/08 05:34 AM.
Re: Help with $1-2 [Re: Tzar469] #195226 20/02/08 09:23 AM
Joined: May 2003
Posts: 41
D
Damsulegna Offline
Ameglian cow
Offline
Ameglian cow
D
Joined: May 2003
Posts: 41
Code:
on *:text:!*:#:{


this part is looking for ! in 1st chat.

perhaps using
Code:
on *:text:*:#:{


might help


If At First You Don't Succeed, Ask Someone For Help......
Re: Help with $1-2 [Re: Tzar469] #195241 20/02/08 02:29 PM
Joined: Aug 2003
Posts: 144
M
Miguel_A Offline
Vogon poet
Offline
Vogon poet
M
Joined: Aug 2003
Posts: 144
Hi

You had two errors.
When working with an alias outsite a event you need to send all the information to that alias.

In this case you have not send the channel. I have created tha variable %Chan and have added to the on text event and addes %Chan to the alias dmsg.

The other small thing was that you have close your alias with a ) and not with the }.

Th rest off the code sounds good... I think it should work fine.

Code:
on *:text:*:#:{
  set %Chan $chan
  if (!stats isin $strip($1-2)) {
    if ($2 == !stats) { 
      var %nick = $iif($3,$3,$1), %ingame = 1
    }
    elseif ($1 == !stats) { 
      var %nick $iif($2,$2,$nick)
    }
    dmsg %nick has killed $calc($hget(playerkills,%nick)) people without dying. 
  }
  elseif (!deaths isin $strip($1-2)) {
    if ($1 == !deaths) { 
      var %nick $iif($2,$2,$nick)
    }
    elseif ($2 == !deaths) { 
      var %nick $iif($3,$3,$1), %ingame 1
    }
    dmsg %nick has died $calc($hget(playerdeaths,%nick)) times.
  }
}

alias dmsg { 
  msg %Chan $iif(%ingame,!fds msg) $1-
  unset %Chan
}

Re: Help with $1-2 [Re: Miguel_A] #195242 20/02/08 03:10 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Quote:
You had two errors.
When working with an alias outsite a event you need to send all the information to that alias.
Not true. Remote identifiers ($nick, $chan, $address etc) are accessible to aliases called from within the event (and to any child aliases).


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: Help with $1-2 [Re: qwerty] #195244 20/02/08 04:06 PM
Joined: Aug 2003
Posts: 144
M
Miguel_A Offline
Vogon poet
Offline
Vogon poet
M
Joined: Aug 2003
Posts: 144
Humm.

Thanks didnīt know that. Next time i will not make the ame mistake.

Re: Help with $1-2 [Re: Damsulegna] #195282 21/02/08 01:03 AM
Joined: Dec 2007
Posts: 24
T
Tzar469 Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Dec 2007
Posts: 24
Ah, how stupid of me to make that error

Thanks for the help everyone! smile

Edit: I now have the following piece of code:

Code:
alias finddead {
  if ($regex($1-, /(killed \w+)/i)) {
    var %died $remtok($regml(1),killed,1,32)
  }
  return %died
}


It is supposed to return the word after the word "killed" but it doesn't work if the word contains symbols. How do I fix that?

Last edited by Tzar469; 21/02/08 04:55 AM.
Re: Help with $1-2 [Re: Tzar469] #195291 21/02/08 06:47 PM
Joined: Jul 2006
Posts: 3,697
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,697
use :
Code:
alias finddead noop $regex($1-,/killed (.\S+)/i) | return $regml(1)

smile


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Help with $1-2 [Re: Wims] #195300 21/02/08 09:16 PM
Joined: Mar 2006
Posts: 393
T
The_JD Offline
Fjord artisan
Offline
Fjord artisan
T
Joined: Mar 2006
Posts: 393
Try escaping the regex with $replacex. The charachters that need escaping are found @ regular-expressions.info smile


[02:16] * Titanic has quit IRC (Excess Flood)