mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2014
Posts: 9
R
r0ot Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Apr 2014
Posts: 9
Hey guys,

I am new to mirc scripting and need some help. I am trying to create a very basic on input script so it shows a particular way in the chat window. I read some stuff and was able to achieve that, but for some reason I can't get the Nick Colors to stick in a chat window. As soon as I use my code below the nick colors work in the listview, but not in the chat window. So I tried to apply color myself...the problem is how do I make it so that when its $me...it shows up as "Green" ?

Any ideas? My main goal is/was to put some color brackets in the chat and do something like "[@ Nick]" where "@,+" etc will be in appropriate color and "Nick" will be a color I decide (same for all modes) except me ($me) always in green. Also, I have no idea how to add a space between @ and nick.

Would really appreciate any and all help.

Thank you

My code so far:

;******************************************************

on *:INPUT:*: {
if ($left($1,1) != /) {
var %n = $iif($me !isreg $chan,$left($nick($chan,$me).pnick,1),$chr(240))
haltdef
echo -tm $chan $+(3<,$chr(2),$chr(3),$replace(%n,@,4@,&,4&,%,4%,~,4~,+,5+,$chr(240),15),$nick,$chr(2),$chr(3),3>) $1-
.msg $chan $1-
}
}

on ^*:TEXT:*:#: {
if ($nick !ison $chan) {
haltdef
echo -tm $chan $+(3<,$chr(3),10,$chr(2),$nick,$chr(3),$chr(2),3>) $1-
}
else {
var %n = $iif($nick !isreg $chan,$left($nick($chan,$nick).pnick,1),$chr(240))
haltdef
echo -tm $chan $+(3<,$chr(2),$chr(3),$replace(%n,@,4@,&,4&,%,14%,~,4~,+,5+,$chr(240),15),$nick,$chr(2),$chr(3),3>) $1-
}
}

;******************************************************

Last edited by r0ot; 11/04/14 05:57 PM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191

Code:

on *:INPUT:*: {
  if ($left($1,1) != /) {
    haltdef
    if $active ischan {
      ; active window is channel window... do something with @%~+ stuff, etc

      var %n = $iif($me !isreg $chan,$left($nick($chan,$me).pnick,1),$chr(240))
      var %echo.text = $+(3<,$chr(2),$chr(3),$+($replace(%n,@,4@,&,4&,%,14%,~,4~,+,5+,$chr(240),15),$chr(32),9),$me,$chr(2),$chr(3),3>) $1-
    }
    else {
      ; active window is private chat window... just make me green

      var %echo.text = $+(3<,$me,>) $1-
    }  
    echo -tm $active %echo.text 
    .msg $active $1-
  }
}

on ^*:TEXT:*:*: {
  haltdef
  if !$chan {
    ; text is not #channel text.. echo to $nick 

    echo -tm $nick $+(3<,$chr(3),10,$chr(2),$nick,$chr(3),$chr(2),3>) $1-
  }
  else {
    ; so text is #channel text.. echo to $chan

    var %n = $iif($nick !isreg $chan,$left($nick($chan,$nick).pnick,1),$chr(240)) 
    echo -tm $chan $+(3<,$chr(2),$chr(3),$+($replace(%n,@,4@,&,4&,%,14%,~,4~,+,5+,$chr(240),15),$chr(32),15),$nick,$chr(2),$chr(3),3>) $1-
  }
}



Joined: Apr 2014
Posts: 9
R
r0ot Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Apr 2014
Posts: 9
Thank you so very much for responding and with the code...It worked, but had one error so to speak. When "@,+ etc" it worked PERFECTLY <@ nick>, but when it was just a normal user it showed a space before nick < nick>. I made the changes below and it works like a charm. Thank so very much again for showing me how to do it right.

I do have one additional question...Let's say you are in a moderated chatroom and you are a normal user...if you try to type something it gives you a error "Cannot send to channel (+m)". How can I assign a color to that? I have tried changing colors, but none of them associates to that one event. Would appreciate your insight on this. Thanks

Here's my version of your code:

Code:
on *:INPUT:*: {
  if ($left($1,1) != /) {
    haltdef
    if $active ischan {
      ; active window is channel window... do something with @%~+ stuff, etc

      var %n = $iif($me !isreg $chan,$left($nick($chan,$me).pnick,1) $chr(240))
      ;ORIGINAL var %n = $iif($me !isreg $chan,$left($nick($chan,$me).pnick,1),$chr(240))

      var %echo.text = $+(3<,$chr(2),$chr(3),$+($replace(%n,@,4@,&,4&,%,14%,~,4~,+,5+,$chr(240),),7),$me,$chr(2),$chr(3),3>) $1-
      ;ORIGINAL var %echo.text = $+(3<,$chr(2),$chr(3),$+($replace(%n,@,4@,&,4&,%,14%,~,4~,+,5+,$chr(240),15),$chr(32),9),$me,$chr(2),$chr(3),3>) $1-
    }
    else {
      ; active window is private chat window... just make me green

      var %echo.text = $+(3<,$me,3>) $1-
    }  
    echo -tm $active %echo.text 
    .msg $active $1-
  }
}

on ^*:TEXT:*:*: {
  haltdef
  if !$chan {
    ; text is not #channel text.. echo to $nick 

    echo -tm $nick $+(3<,$chr(3),15,$chr(2),, $nick,,$chr(3),$chr(2),3>) $1-
    ;ORIGINAL echo -tm $nick $+(3<,$chr(3),10,$chr(2),$nick,$chr(3),$chr(2),3>) $1-
  }
  else {
    ; so text is #channel text.. echo to $chan

    var %n = $iif($nick !isreg $chan,$left($nick($chan,$nick).pnick,1) $chr(240))
    ;ORIGINAL var %n = $iif($nick !isreg $chan,$left($nick($chan,$nick).pnick,1),$chr(240)) 

    echo -tm $chan $+(3<,$chr(2),$chr(3),$+($replace(%n,@,4@,&,4&,%,14%,~,4~,+,5+,$chr(240),),15),$nick,$chr(2),$chr(3),3>) $1-
    ;ORIGINAL echo -tm $chan $+(3<,$chr(2),$chr(3),$+($replace(%n,@,4@,&,4&,%,14%,~,4~,+,5+,$chr(240),15),$chr(32),15),$nick,$chr(2),$chr(3),3>) $1- 
  }
}

Last edited by r0ot; 12/04/14 05:09 PM.
Joined: Jan 2004
Posts: 1,360
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,360
Open a debug window with /debug @debug

This will let you see the raw numeric/name which you can catch and replace as normal with

raw 123:*:...

Assuming mIRC even sends the message. Otherwise you could check if the channel is +m before echoing

Last edited by Loki12583; 12/04/14 05:21 PM.
Joined: Apr 2014
Posts: 9
R
r0ot Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Apr 2014
Posts: 9
all I got was

Code:
-> irc.network.net PRIVMSG #channel :d
<- :irc.network.net 404 nick #channel :Cannot send to channel (+m)


Also, how can I have my nick in a different color when someone says it in the channel? I am using the code above.

Thanks!

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Originally Posted By: r0ot
I do have one additional question...Let's say you are in a moderated chatroom and you are a normal user...if you try to type something it gives you a error "Cannot send to channel (+m)". How can I assign a color to that?

You can use raw event. For detail read /help raw event

Code:
raw 404:*:{
  var %chan $2, %text $3-
  echo -tm %chan %text
  haltdef
}

edit: color %text as you wish.


Last edited by blessing; 12/04/14 05:29 PM.
Joined: Apr 2014
Posts: 9
R
r0ot Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Apr 2014
Posts: 9
You guys are freaking awesome!

Let me ask you too Blessing...how can I have my nick in a different color when someone says it in the channel?

Thanks dude.

Last edited by r0ot; 12/04/14 05:32 PM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
You can use $replace($1-,$me,colored $me) to highlight only your nickname or if ($me isin $1-) to highlight whole text

Code:
on ^*:TEXT:*:*: {
  haltdef
  if !$chan {

    ...code...

  }
  else {
    ; so text is #channel text.. echo to $chan

    var %n = $iif($nick !isreg $chan,$left($nick($chan,$nick).pnick,1) $chr(240))

    ; highlight whole text
    if $me isin $1- { var %text = $+(10,$1-,) }

    ; highlight only yournick
    var %text = $replace($1-,$me,$+(4,$me,))
    
    ; echo %text here
    echo -tm $chan $+(3<,$chr(2),$chr(3),$+($replace(%n,@,4@,&,4&,%,14%,~,4~,+,5+,$chr(240),),15),$nick,$chr(2),$chr(3),3>) %text
  }
}

Joined: Apr 2014
Posts: 9
R
r0ot Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Apr 2014
Posts: 9
PERFECT! One last question I swear lol...Mirc has its own nick completion service...Is there anyway I can add a character so that when I hit tab to complete a nick so that it shows up as "nick:" instead of just "nick" ?

Last edited by r0ot; 13/04/14 02:52 PM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Afaik, there is no way to manipulate editbox without make tab completion function halted.

All you can do is manipulate text that you will echo / send to the channel. That will involves on input event and text you want to manipulate.



Joined: Jan 2004
Posts: 1,360
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,360
You can reimplement tab completion with the tabcomp event, although undoubtedly such scripts already exist.

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Manipulating editbox with tabcomp event will make tab completion function halted as well.
Idk if there is any tricks out there.

Joined: Jan 2004
Posts: 1,360
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,360

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
Thankyou for the link. smile

It does not work perfectly. I mean, it does nick completion on first nick (only), but after that you cannot use tab to "search/nick completion" other nicks in case you want other nick, not the first one.


Joined: Apr 2014
Posts: 9
R
r0ot Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Apr 2014
Posts: 9
Thank you Blessing.


Link Copied to Clipboard