mIRC Homepage
Posted By: JuanAm dividing line of code - 30/11/14 03:59 PM
In other programming languages, you can divide a line of script in several lines, that facilitates the reading of the code, when we have an extensive line.
I did not find the way for MSL.
The old versions of mIRC, such as 6.22, gives error at people who using it, when we have a extensive line code in the script.
Posted By: Nillen Re: dividing line of code - 30/11/14 04:00 PM
Can you give an example of what you mean?
Posted By: JuanAm Re: dividing line of code - 30/11/14 05:17 PM
Originally Posted By: Nillen
Can you give an example of what you mean?


Example1:
on 1:LOAD: {
Code:
  echo -s $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) $+ $chr(xx) more $chr(xx).......................................


Example2:
Code:
if (($left($1,1) == %prefij) && ($1 != !lpo) && ($1 != !op) && ($1 != !deop) && ($1 !=  !fin) &&  ($1 !=  !entren) && ($1 != !salgan) && ($1 != !nuevapass) && ($1 != !n) && ($1 != !lo)  &&  ($1 != !lco)  && ($1 != !la)  && ($1 != !ld) && ($1 !=  !ungl) && ($1 != !ayuda)  &&  (!$2)if (($left($1,1) == %prefij) && ($1 != !lpo) && ($1 != !op) && ($1 != !deop) && ($1 !=  !fin) &&  ($1 !=  !out) && ($1 != !in) && ($1 != !nuevapass) && ($1 != !n) && ($1 != !lo)  &&  ($1 != !lcso)  && ($1 != !lsa)  && ($1 != !lsd) && ($1 !=  !ungline) && ($1 != !help)  &&  ($2 == $null)) {   msg $chan 4Sintax Error  A parameter after the command is missing, or the command does not exist }


In other programming languages, an extensive lines can be divided into more than one line, without affecting syntax.

Example extensive line:

Quote:
if (($left($1,1) == %prefij) && ($1 != !lpo) && ($1 != !op) && ($1 != !deop) && ($1 != !fin) && ($1 != !entren) && ($1 != !salgan) && ($1 != !nuevapass) && more if more if && more if.....................


Suppose, and is only for example, that there is a divider lines in MSL, which we will call '///'.

What I want to do with this line:

Quote:
if (($left($1,1) == %prefij) && ($1 != !lpo) ///
&& ($1 != !op) && ($1 != !deop) && ($1 != !fin) ///
&& ($1 != !entren) && ($1 != !salgan) ///
&& ($1 != !nuevapass) ///
&& more if more ///
if && more if.....................


I divided extensive line, with the 'separator or divider lines', called "///", I can put pieces of the line in several lines without syntax is lost.

Posted By: KindOne Re: dividing line of code - 30/11/14 05:33 PM
You want " $& " not " /// "



http://en.wikichip.org/wiki/mirc/identifiers/$%26

Posted By: JuanAm Re: dividing line of code - 30/11/14 05:42 PM
Originally Posted By: KindOne
You want " $& " not " /// "



http://en.wikichip.org/wiki/mirc/identifiers/$%26



Thanks KindOne, is what I was looking for.
The '///' was just a guess for the example. smile

More Information for other users:
Quote:
$& is used to split one long line over multiple lines for script readability.

Examples

echo -atg This is a really long line that, if there were complicated coding identifiers and variable names, $&
would get really confusing and cramped without the added help of the $& identifier.

While this seems useless, if there was a heavy use of identifiers and such throughout the line, it would help make it much more readable.
© mIRC Discussion Forums