mIRC Homepage
Posted By: Bullseye sepperating sign - 07/02/07 07:56 PM
to show the sellected nicks i have this piece of code:
Code:
var %nicklijst = $+(%nicklijst,$chr(32),$nick($chan,%nick1)) 


nicks are sepperated by a space.
i would like it to show like this:

john & jack & charles & sophie & etc & etc

the & is $chr(38) but i always get the & sign before the firts or after the last nick like this:

& john & jack & charles & sophie & etc & etc

or

john & jack & charles & sophie & etc & etc &

Depending on where i put that code
How do i stop those first or last & signs from showing
Posted By: Riamus2 Re: sepperating sign - 07/02/07 09:15 PM
I use $iif for such things. Here's just an example:

Code:
var %nick = $iif(%nick,%nick & $nick($chan,%i),$nick($chan,%i))



That assumes that %i is a variable that's used in a loop to add everyone in the nicklist to the variable. Anyhow, what that will do is check to see if there is already a name in the %nick variable. If there is, then it will put the variable followed by the & followed by the new nick. If not, it will just put the new nick.

The result would look like:

John & James & Amy & Ashley & Mark & Sarah & Christy & Steve
Posted By: genius_at_work Re: sepperating sign - 08/02/07 02:14 AM
You could also use $replace after all the names are added. Build the list with only a space between each name. After the list is complete, do this:

Code:
%before = your list of nicks delimited by spaces
%after = $replace(%before,$chr(32),$+($chr(32),$chr(38),$chr(32)))


-genius_at_work
Posted By: Doqnach Re: sepperating sign - 08/02/07 10:30 AM
if you want to show selected nicks I presume you mean the ones selected in the nicklist? then try:
Code:
$replace($snicks,$chr(44),$+($chr(32),&,$chr(32)))
Posted By: Riamus2 Re: sepperating sign - 08/02/07 02:28 PM
Originally Posted By: genius_at_work
You could also use $replace after all the names are added.


For nicks, this is a good method. However, if you're combining other items that already have spaces in them, then this won't work. By using the $iif method, it will work regardless of whether the items being combined have spaces or any other separating character. Might be better to use that method just to get used to it in case it's needed for something else later, so he doesn't need to ask again for help with that one. smile
© mIRC Discussion Forums