mIRC Home    About    Download    Register    News    Help

Print Thread
#264822 15/01/19 02:43 PM
Joined: Jan 2019
Posts: 18
C
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.

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
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.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
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 }

Joined: Jan 2019
Posts: 18
C
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.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
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

Joined: Jan 2019
Posts: 18
C
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).

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
$prenick not %prenick

Joined: Jan 2019
Posts: 18
C
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/:

Joined: Dec 2002
Posts: 252
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
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 }

Joined: Jan 2019
Posts: 18
C
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!

Joined: Jan 2019
Posts: 18
C
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.

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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!
Joined: Jan 2019
Posts: 18
C
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.


Link Copied to Clipboard