mIRC Homepage
Posted By: chillout Weird //echo behaviour - 15/01/19 02:43 PM
So I have this little echo script (I could left out the colorcodes in it but wanted to let it original as it is maybe the problem is there):
Code:
on ^*:text:*:*: { echo $iif(#,#,$nick) $+(13<,$left($nick(#,$nick).pnick,1) $+ $nick,13> ) $1- | haltdef }

The problem is with this script that users get a double letter in front of their nickname, e.g.:
Code:
=========example1==============================
[13:35:18] <+liza> I'm back soon
[13:39:06]  signoff liza ["Bye"]
[13:41:22]  liza [~AndChat@147.159.111.52] joined #channel
[13:41:37] <lliza> good afternoon
=========example2==============================
[14:41:30]  mode[#channel +v liza] by chillout
[14:41:37] <+liza> thanks
[14:42:28]  mode[#channel -v liza] by chillout
[14:42:33] <lliza> why?
=========example3==============================
[15:06:59]  liza [~AndChat@147.159.111.52] joined #channel
[15:07:04] <llisa> hello

What is going on here? I have this script to show the @+ in front of the nick.
Posted By: Wims Re: Weird //echo behaviour - 15/01/19 02:45 PM
that's because $nick().pnick returns the nickname with the mode, so for an user without any mode, it returns the first letter of the nickname, which you add in the front of the nickname. You can use $remove($nick,$nick().pnick) to get the mode only, for example.
Posted By: Loki12583 Re: Weird //echo behaviour - 15/01/19 03:03 PM
Some users may have multiple modes, if you want to view only the highest you also need $left

Code:
alias prenick { var %nick = $iif($1,$1,$nick) | return $left($remove($nick(#,%nick).pnick,%nick),1) $+ %nick }
Posted By: chillout Re: Weird //echo behaviour - 15/01/19 05:56 PM
Hmm, both codes doesnt really solve the problem, Wims: do I need to put something between () I get an error: * Invalid parameters: $nick. Loki12583: The code you mentioned shows all nicks just normal but doesnt show the voiced or ops in front of the nick, the positieve is that the nickname doesn't have the double letter anymore (: *edited* I don't have any other on echo scripts running. Thank you.
Posted By: Loki12583 Re: Weird //echo behaviour - 15/01/19 06:06 PM
Did you leave my alias by itself or try to incorporate its content into your script? Note there are different uses of %nick and $nick
Posted By: chillout Re: Weird //echo behaviour - 15/01/19 06:19 PM
Yes I think that this must be the way to do it? The alias:
Code:
alias prenick { var %nick = $iif($1,$1,$nick) | return $left($remove($nick(#,%nick).pnick,%nick),1) $+ %nick }

and the on ^*:text:*:*:
Code:
on ^*:text:*:*: { echo $iif(#,#,$nick) $timestamp $+(13<,%prenick $+ $nick,13> ) $1- | haltdef }

like this... did I do anything wrong? It shows only the nickname without @ or + (others are not important).
Posted By: Loki12583 Re: Weird //echo behaviour - 15/01/19 07:47 PM
$prenick not %prenick
Posted By: chillout Re: Weird //echo behaviour - 16/01/19 12:10 AM
Ahh I was not sharp, I changed that but now I get double nicknames/:
Posted By: Talon Re: Weird //echo behaviour - 16/01/19 12:20 AM
your original line:
Code:
on ^*:text:*:*: { echo $iif(#,#,$nick) $+(13<,$left($nick(#,$nick).pnick,1) $+ $nick,13> ) $1- | haltdef }


is actually almost right, you don't need any fancy custom aliases, you just need to take advantage of switches with $nick()

you should use:

$nick(#,$nick,a,r).pnick

which uses include/exclude lists, it basically states include all nicknames from <#channel> excluding regulars. The return from a regular results in an empty string. You're not needing to $remove() anything either. You also have a $+ inside of a $+() which could've just been another parameter. I changed that in the modified version below.

So finalized:
Code:
on ^*:text:*:*: { echo $iif(#,#,$nick) $+(13<,$left($nick(#,$nick,a,r).pnick,1),$nick,13>) $1- | haltdef }
Posted By: chillout Re: Weird //echo behaviour - 17/01/19 08:53 AM
Perfect, it is working as aspected Talon. Thank you all for the help and information, learned from also. Greetings!
Posted By: chillout Re: Weird //echo behaviour - 19/01/19 02:26 PM
Hmm, one 'little problem' I noticed is that my switchbar colors are not showing correctly anymore, on a mode or event it supposed to be colored 'blue' and by text on a channel it supposed to be colored 'red'. Now there is no difference anymore, no matter what happens on a channel it will only get 'blue' colored, even when someone speaks on a channel, any suggestions? Not that it is soooo improtant but if there is a trick for it I will be very glad. Thank you.
Posted By: Raccoon Re: Weird //echo behaviour - 19/01/19 04:22 PM
When using /echo to emulate spoken messages, you need to use the '-m' switch to indicate that the switchbar color should change accordingly. Don't neglect the other half-dozen switches you'll also want to use, to enable timestamps indentation highlight flashing beeping... etc settings that normally apply to message events.

See: /help /echo
Posted By: chillout Re: Weird //echo behaviour - 19/01/19 06:07 PM
Djeee.. now I feel stupid haha, thought it had something to do with the haltdef command, overlooked the echo parameters. Thank you Raccoon, and yes I added also the -bf switch to it.
© mIRC Discussion Forums