mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2011
Posts: 34
O
Ameglian cow
OP Offline
Ameglian cow
O
Joined: Jan 2011
Posts: 34
I want to make this script shorter so that there aren't so many "if" lines.

Code:
on *:input:#:{
  if ($1 == .10) { halt }
  if ($1 == .11) { halt }
  if ($1 == .12) { halt }
  if ($1 == .13) { halt }
  if ($1 == .14) { halt }
  if ($1 == .15) { halt }
  if ($1 == .16) { halt }
  if ($1 == .17) { halt }
  if ($1 == .18) { halt }
  if ($1 == .19) { halt }
  if ($1 == .20) { halt }
  if ($1 == .21) { halt }
  if ($1 == .22) { halt }
  if ($1 == .23) { halt }
  if ($1 == .24) { halt }
  if ($1 == .25) { halt }
}

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
/help isnum

Code:
on *:input:#:{
  if ($1 isnum .10-.25) { halt }
}


Of course, if you might have .102 and not want that to be halted, then you'd also want to check $len()...

Code:
on *:input:#:{
  if ($1 isnum .10-.25 && $len($1) == 3) { halt }
}



Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2011
Posts: 34
O
Ameglian cow
OP Offline
Ameglian cow
O
Joined: Jan 2011
Posts: 34
Thanks, i usually refer to the help file first but most of the time the info is over my head.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Np. I just pointed it out so you could find it for reference.


Invision Support
#Invision on irc.irchighway.net
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
You can do it with regsubex:
Code:
on *:input:#:{
  if ($istok($regsubex($str($chr(32),24),//g,$iif(\n > 9,$+(.,\n))),$1,32)) { halt }
}
I'm just showing you another way is all.


Link Copied to Clipboard