mIRC Home    About    Download    Register    News    Help

Print Thread
$replace #197870 15/04/08 11:21 PM
Joined: Sep 2007
Posts: 109
K
kwell Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Sep 2007
Posts: 109
As shorten this code

Code:
$replace($spacerep($gettok(%temp,2,166)),$chr(32) $+ 1,$chr(32) $+ -1,$chr(32) $+ 2,$chr(32) $+ -2,$chr(32) $+ 3,$chr(32) $+ -3,$chr(32) $+ 4,$chr(32) $+ -4,$chr(32) $+ 5,$chr(32) $+ -5,$chr(32) $+ 6,$chr(32) $+ -6,$chr(32) $+ 7,$chr(32) $+ -7,$chr(32) $+ 8,$chr(32) $+ -8,$chr(32) $+ 9,$chr(32) $+ -9,$chr(32) $+ 0,$chr(32) $+ -0,1 $+ $chr(32),1- $+ $chr(32),2 $+ $chr(32),2- $+ $chr(32),3 $+ $chr(32),3- $+ $chr(32),4 $+ $chr(32),4- $+ $chr(32),5 $+ $chr(32),5- $+ $chr(32),6 $+ $chr(32),6- $+ $chr(32),7 $+ $chr(32),7- $+ $chr(32),8 $+ $chr(32),8- $+ $chr(32),9 $+ $chr(32),9- $+ $chr(32),0 $+ $chr(32),0- $+ $chr(32))



Its function is to add a "-" any number found, example...

Replaces
54.Fixed numeric 345 not triggering on RAW event.
by
54.Fixed numeric -345- not triggering on RAW event.


---------------------------------------------------------------
Another question
No explanation, my English is not good, What Hare with an example...

Code:
if ($read(dir/bla.txt, w, $nick)) { echo -a $nick in line 3 }


As I arrive at this result?

Last edited by kwell; 15/04/08 11:37 PM.
Re: $replace [Re: kwell] #197875 16/04/08 12:02 AM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
  • For question 1:

    Code:
    $regsubex($spacerep($gettok(%temp,2,166)), /(?<=^|\s)(\d+)(?=\s|$)/g, -\1-)


  • For question 2:

    I think what you're looking for is $readn. eg.
    Code:
    if ($read(dir/bla.txt, w, $+(*,$nick,*))) { echo -a $nick in line $readn }


Spelling mistakes, grammatical errors, and stupid comments are intentional.