mIRC Home    About    Download    Register    News    Help

Print Thread
dividing line of code #249457 30/11/14 03:59 PM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
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.

Re: dividing line of code [Re: JuanAm] #249458 30/11/14 04:00 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Can you give an example of what you mean?


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: dividing line of code [Re: Nillen] #249460 30/11/14 05:17 PM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
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.


Re: dividing line of code [Re: JuanAm] #249461 30/11/14 05:33 PM
Joined: Feb 2011
Posts: 388
K
KindOne Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 388
You want " $& " not " /// "



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



irc.swiftirc.net #msl (mIRC Scripting Language)
Re: dividing line of code [Re: KindOne] #249462 30/11/14 05:42 PM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
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.