mIRC Home    About    Download    Register    News    Help

Print Thread
Weird //echo behaviour #264822 15/01/19 02:43 PM
Joined: Jan 2019
Posts: 18
C
chillout Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2019
Posts: 18
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.

Re: Weird //echo behaviour [Re: chillout] #264823 15/01/19 02:45 PM
Joined: Jul 2006
Posts: 3,555
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,555
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.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Weird //echo behaviour [Re: Wims] #264824 15/01/19 03:03 PM
Joined: Jan 2004
Posts: 1,274
L
Loki12583 Online
Hoopy frood
Online
Hoopy frood
L
Joined: Jan 2004
Posts: 1,274
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 }

Re: Weird //echo behaviour [Re: Loki12583] #264827 15/01/19 05:56 PM
Joined: Jan 2019
Posts: 18
C
chillout Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2019
Posts: 18
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.

Last edited by chillout; 15/01/19 05:59 PM.
Re: Weird //echo behaviour [Re: chillout] #264828 15/01/19 06:06 PM
Joined: Jan 2004
Posts: 1,274
L
Loki12583 Online
Hoopy frood
Online
Hoopy frood
L
Joined: Jan 2004
Posts: 1,274
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

Re: Weird //echo behaviour [Re: Loki12583] #264829 15/01/19 06:19 PM
Joined: Jan 2019
Posts: 18
C
chillout Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2019
Posts: 18
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).

Re: Weird //echo behaviour [Re: chillout] #264832 15/01/19 07:47 PM
Joined: Jan 2004
Posts: 1,274
L
Loki12583 Online
Hoopy frood
Online
Hoopy frood
L
Joined: Jan 2004
Posts: 1,274
$prenick not %prenick

Re: Weird //echo behaviour [Re: Loki12583] #264834 16/01/19 12:10 AM
Joined: Jan 2019
Posts: 18
C
chillout Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2019
Posts: 18
Ahh I was not sharp, I changed that but now I get double nicknames/:

Re: Weird //echo behaviour [Re: chillout] #264835 16/01/19 12:20 AM
Joined: Dec 2002
Posts: 198
T
Talon Offline
Vogon poet
Offline
Vogon poet
T
Joined: Dec 2002
Posts: 198
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 }

Re: Weird //echo behaviour [Re: Talon] #264845 17/01/19 08:53 AM
Joined: Jan 2019
Posts: 18
C
chillout Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2019
Posts: 18
Perfect, it is working as aspected Talon. Thank you all for the help and information, learned from also. Greetings!

Re: Weird //echo behaviour [Re: chillout] #264866 19/01/19 02:26 PM
Joined: Jan 2019
Posts: 18
C
chillout Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2019
Posts: 18
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.

Re: Weird //echo behaviour [Re: chillout] #264868 19/01/19 04:22 PM
Joined: Feb 2003
Posts: 2,641
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,641
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


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: Weird //echo behaviour [Re: Raccoon] #264869 19/01/19 06:07 PM
Joined: Jan 2019
Posts: 18
C
chillout Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Jan 2019
Posts: 18
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.