This lines a bit dodgy for a start, and likely didnt help you in diagnosing your problem
if ((/* !iswm $1) && ($+($readini($mircini, text, commandchar),*) !iswm $1) || ($ctrlenter)) {
... $1 cant be a wild match for both /* and the commandchar if its been changed, and you are saying do the change if CTRLENTER is pressed!
try...
if ((!$ctrlenter) && ((/* !iswm $1) || ($+($readini($mircini, text, commandchar),*) !iswm $1))) {
^ do the !$ctrlenter check first as it takes the least resources, so if it fails then the rest need not be done

If you make this correction, then type something in any one of the 4 chat windows and press ctrl-enter you see it appear as normal in that window, and highlighted by ON CHAT in the correct window.
FROM that result it can be diagnosed your problem exists in the ON INPUT routine

Quote:
!.msg $active $1-


And this is your problem, (solution is yet to come to me sorry)

if i do that and have created 2 dcc connections (even one does it using the second chat window) then in the ON INPUT im doing
.msg =DaveC blah blah blah
that is going to message the first dcc chat to davec (being the second dcc chat window of dcc chat connection1), from any of the 4 dcc chat windows, and thus the ON CHAT event well trip off for the said dcc chat incomming text.

err not sure if that is legable, example....
/dcc chat DaveC

dcc chat outbound window created
dcc chat inbound window created

/dcc chat DaveC

dcc chat outbound window created
dcc chat inbound window created

test typed in chat window1
.msg =DaveC test typed in chat window1

test typed in chat window2
.msg =DaveC test typed in chat window2

test typed in chat window3
.msg =DaveC test typed in chat window3

test typed in chat window4
.msg =DaveC test typed in chat window4

ON CHAT trips for window blue every time, becuase thats who your sending to

There is a method of forcingt he text out the right dcc chat window, but thats using /EDITBOX and that incurs the text displaying as per normal in the outgoing dcc chat window, sicne your in the dcc chat windows ON INPUT already, you might as well just not display the highlight, and not halt.

Aka unless you find a method of sending to the correct =DaveC (being theres 4 of them) i dont know if u can fix it