|
Joined: Jan 2004
Posts: 509
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2004
Posts: 509 |
I have an input event code, it goes something like,
var %a = $1-
var %b = . $1-
while ($findtokcs(%a,b,32)) %a = $puttok(%a,be,$ifmatch,32) | while ($findtokcs(%a,B,32)) %a = $puttok(%a,Be,$ifmatch,32)
.echo -q $regsub(%a,/(?<=^| )(cam)(?= |$)/gi,\1era,%a)
if ($regex(%a,$+(/\b,$hget(expansions,1),\b/))) %a = $replacecs(%a,bbl, be back later, BBl, Be back later)
if (!$istok($chr(34) $chr(46) $chr(63) $chr(33) $chr(42) $chr(125),$right(%a,1),32)) && (!$istok($chr(58) $chr(59) $chr(42) $chr(45),$mid(%a,-2,1),32)) {
if (#* !iswm $($ $+ $0,2)) {
/say $+($upper($left(%a,1)),$right(%a,-1)) $+ . | /halt
}
if (#* iswm $($ $+ $0,2)) {
/say $+($upper($left(%a,1)),$right(%a,-1)) | /halt
}
}
/say %a | /halt
Etc. And all those codes work just fine, But, knowing %b is . $1-, while ($regex(%b,/([?!.] [a-z])/)) %b = $replacecs(%b,$regml(1),$upper($regml(1))) /say $mid(%b,3) $+ $iif($right(%b,1) !isin .!?,.) | /halt What that does is capitalize the first letter after a space after . ? or ! How do I put the 2 codes together so they can equally fit in one input event? If I put them together, the first letter after a sentence will not be capitalized. I thought about using a %c, var %c = %a || %b, or even %a %b, yo concatenate the two varibles, but no luck. 2.)Also, say I have something like this. %a = $replacecs(%a,convo, conversation, Convo, Conversation) How would I make it, so that if I had a word list, it will not edit if the nick is in channel. For example, 'convo' becomes 'conversation.' But, if in the channel, a user with the nick 'convo' joins, then, the code willnot take in effect, but only for that word. Therefore, if someone's nick is Chan, then, I will not call them Channel. Thanks.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
I havent actually followed the code throught in what its doing, but if you simply wanted to have the %b's regex applied to the resulting %a value then this should work.
INPUT EVENT {
/SAY $second.part($first.part($1-))
}
;
alias -l first.part {
var %a = $1-
while ($findtokcs(%a,b,32)) %a = $puttok(%a,be,$ifmatch,32) | while ($findtokcs(%a,B,32)) %a = $puttok(%a,Be,$ifmatch,32)
.echo -q $regsub(%a,/(?<=^| )(cam)(?= |$)/gi,\1era,%a)
if ($regex(%a,$+(/\b,$hget(expansions,1),\b/))) %a = $replacecs(%a,bbl, be back later, BBl, Be back later)
if (!$istok($chr(34) $chr(46) $chr(63) $chr(33) $chr(42) $chr(125),$right(%a,1),32)) && (!$istok($chr(58) $chr(59) $chr(42) $chr(45),$mid(%a,-2,1),32)) {
if (#* !iswm $($ $+ $0,2)) {
RETURN $+($upper($left(%a,1)),$right(%a,-1)) $+ .
}
if (#* iswm $($ $+ $0,2)) {
RETURN $+($upper($left(%a,1)),$right(%a,-1))
}
}
RETURN %a
}
alias second.part {
var %b = . $1-
while ($regex(%b,/([?!.] [a-z])/)) %b = $replacecs(%b,$regml(1),$upper($regml(1)))
RETURN $mid(%b,3) $+ $iif($right(%b,1) !isin .!?,.)
}
2.)Also, say I have something like this. %a = $replacecs(%a,convo, conversation, Convo, Conversation) ^ This is not on whole words which might cause a problem, as this code below only matches whole words that are nicks, but its a start
var %i = $numtok(%a,32)
while (%i) {
var %word = $gettok(%a,%i,32)
if $nick($chan,%word) { var %a = $puttok(%a,$+($left(%word,1),,$mid(%word,2),%i,32) }
dec %i
}
... DO what EVER to %A here ... ie: %a = $replacecs(%a,convo, conversation, Convo, Conversation)
var %a = $remove(%a,)
All i did is put a double bold into any nick i found after the first letter, this should stop it matching in the replacecs (should be a replacexcs really), then removed the double bolds at the end. PS: everything here was done in the forum editor, so i didnt test any code sorry.
|
|
|
|
Joined: Jan 2004
Posts: 509
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2004
Posts: 509 |
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
ctrl-b ctrl-b
Thats the two bolds
|
|
|
|
Joined: Jan 2004
Posts: 509
Fjord artisan
|
OP
Fjord artisan
Joined: Jan 2004
Posts: 509 |
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
Well since your passing out nothing more than snippits theres not much that can be done to correct it.
|
|
|
|
|