mIRC Home    About    Download    Register    News    Help

Topic Options
#264822 - 15/01/19 02:43 PM Weird //echo behaviour
chillout Offline
Pikka bird

Registered: 12/01/19
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.

Top
#264823 - 15/01/19 02:45 PM Re: Weird //echo behaviour [Re: chillout]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3495
Loc: France
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

Top
#264824 - 15/01/19 03:03 PM Re: Weird //echo behaviour [Re: Wims]
Loki12583 Online
Hoopy frood

Registered: 22/01/04
Posts: 1264
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 }

Top
#264827 - 15/01/19 05:56 PM Re: Weird //echo behaviour [Re: Loki12583]
chillout Offline
Pikka bird

Registered: 12/01/19
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.


Edited by chillout (15/01/19 05:59 PM)

Top
#264828 - 15/01/19 06:06 PM Re: Weird //echo behaviour [Re: chillout]
Loki12583 Online
Hoopy frood

Registered: 22/01/04
Posts: 1264
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

Top
#264829 - 15/01/19 06:19 PM Re: Weird //echo behaviour [Re: Loki12583]
chillout Offline
Pikka bird

Registered: 12/01/19
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).

Top
#264832 - 15/01/19 07:47 PM Re: Weird //echo behaviour [Re: chillout]
Loki12583 Online
Hoopy frood

Registered: 22/01/04
Posts: 1264
$prenick not %prenick

Top
#264834 - 16/01/19 12:10 AM Re: Weird //echo behaviour [Re: Loki12583]
chillout Offline
Pikka bird

Registered: 12/01/19
Posts: 18
Ahh I was not sharp, I changed that but now I get double nicknames/:

Top
#264835 - 16/01/19 12:20 AM Re: Weird //echo behaviour [Re: chillout]
Talon Offline
Vogon poet

Registered: 09/12/02
Posts: 198
Loc: Ohio, USA
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 }

Top
#264845 - 17/01/19 08:53 AM Re: Weird //echo behaviour [Re: Talon]
chillout Offline
Pikka bird

Registered: 12/01/19
Posts: 18
Perfect, it is working as aspected Talon. Thank you all for the help and information, learned from also. Greetings!

Top
#264866 - 19/01/19 02:26 PM Re: Weird //echo behaviour [Re: chillout]
chillout Offline
Pikka bird

Registered: 12/01/19
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.

Top
#264868 - 19/01/19 04:22 PM Re: Weird //echo behaviour [Re: chillout]
Raccoon Offline
Hoopy frood

Registered: 18/02/03
Posts: 2590
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!

Top
#264869 - 19/01/19 06:07 PM Re: Weird //echo behaviour [Re: Raccoon]
chillout Offline
Pikka bird

Registered: 12/01/19
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.

Top