mIRC Home    About    Download    Register    News    Help

Print Thread
#267152 10/04/20 10:35 AM
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
hi all

I use this as my acronym addon.
Code
alias REG_ACRO {
  VAR %REG_ACRO_INPUT $1-, %REG_ACRO_TOK $HGET(REG_ACRO_TABLE,0).DATA, %REG_ACRO_TEMP, %REG_ACRO_OUTPUT
  WHILE (%REG_ACRO_TOK) {
    IF ($REGEX(REG_ACRO_EX,%REG_ACRO_INPUT,$+(/\b,$CHR(40),$HGET(REG_ACRO_TABLE,%REG_ACRO_TOK).ITEM,$CHR(41),\b/ig))) {
      %REG_ACRO_TEMP = $REGSUB(%REG_ACRO_INPUT,$+(/\b,$CHR(40),$HGET(REG_ACRO_TABLE,%REG_ACRO_TOK).ITEM,$CHR(41),\b/ig),$HGET(REG_ACRO_TABLE,%REG_ACRO_TOK).DATA,%REG_ACRO_OUTPUT)
      %REG_ACRO_TEMP = $REGSUB(%REG_ACRO_OUTPUT,$+(/\b,$CHR(40),$HGET(REG_ACRO_TABLE,%REG_ACRO_TOK).ITEM,$CHR(41),\b/ig),$HGET(REG_ACRO_TABLE,%REG_ACRO_TOK).DATA,%REG_ACRO_INPUT)
    }
    DEC %REG_ACRO_TOK
  }
  TOKENIZE 32 $IIF(%REG_ACRO_OUTPUT,$v1,%REG_ACRO_INPUT)
  RETURN $+($UPPER($LEFT($1,1)),$MID($1-,2))
}


what i can't get working is when i type this smile
i think it has something to to with the :
what works is :p if i use it without space to a word like: word:p else it doesn't work
anyine any idea?
all credits for this addon go to DarthReven on hawkee.

RiMaJoy #267154 10/04/20 04:51 PM
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Code
alias reg_acro {
  var -p %p $1-
  noop $hfind(reg_acro_table,*,0,w,%p = $regsubex(%p,$+(/\b\Q,$replacecs($1,\E,\E\\E\Q),\E\b/),$hget(reg_acro_table,$1)))
  return $+($upper($left(%p,1)),$mid(%p,2))
}
Not tested but should work.
The original code had several issue and was poorly performing, this fix the issue and is also much faster, you need one of the latest mIRC version.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #267158 10/04/20 08:44 PM
Joined: Jul 2008
Posts: 57
R
RiMaJoy Offline OP
Babel fish
OP Offline
Babel fish
R
Joined: Jul 2008
Posts: 57
thanks but ......
on everything i type not starting with a smiley the first word doesn't shows up.

RiMaJoy #267159 10/04/20 10:31 PM
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Right, my bad, $regsubex is eating the $N- tokens, I thought it was only doing so when the subtext contains special markers, but it always does it, using $regsub works better then:

Code
alias reg_acro {
  var -p %p $1-
  noop $hfind(reg_acro_table,*,0,w,noop $regsub(%p,$+(/\b\Q,$replacecs($1,\E,\E\\E\Q),\E\b/),$hget(reg_acro_table, $1),%p))
  return $+($upper($left(%p,1)),$mid(%p,2))
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard