MV How to extend the amount of lines available in a comment?

Made an account just to ask this (presumably simple) question, but I'm using a plugin that utilizes comments in order to function, but I only have 6 lines available for a comment, which isn't enough for me to put everything I need.

The plugin is Yanfly's CommonEventMenu for reference, and this is probably a stupid question, but I've spent like 3 hours trying to find an answer and I couldn't.

Sorry in advance if I'm asking in the wrong place or doing anything else wrong, by the way.
comments are code 108 and 408.

but even if its 6 lines (not tested this) you can have like 100 lines
Code:
comment: line 1
line2
line3
comment: line 4
line5
line6
comment: line 7
line8
line9
and you can continue like that.

a comment is a comment if it has code 408 include (what most does) to read
each line of code.
comments are code 108 and 408.

but even if its 6 lines (not tested this) you can have like 100 lines
Code:
comment: line 1
line2
line3
comment: line 4
line5
line6
comment: line 7
line8
line9
and you can continue like that.

a comment is a comment if it has code 408 include (what most does) to read
each line of code.
I appreciate the help, but I don't think I fully understand, sorry. I've tried splitting it up between comments like that before, and it hasn't worked.

To reiterate, all I'm trying to do is fit the following into one comment:

<Menu Visible Eval>

if ($gameSwitches.value(16)) {

visible = true;

} else {

visible = false;

}

</Menu Visible Eval>

Sorry if I'm being unhelpful in any way.
there is an example I think, but comments if it has 6 lines and it must
be per comment on eval, you can do it this way:
Code:
<Menu Visible Eval>
if ($gameSwitches.value(16)) {
visible = true } else { visible = false
}
</Menu Visible Eval>

// or try (for later nwjs (0.48.4+))

<Menu Visible Eval>
visible = $gameSwitches.value(16) ? true : false
</Menu Visible Eval>
I still don't get why use common eval in the first place, while you can write more lines in a script command, including comments.
I still don't get why use common eval in the first place, while you can write more lines in a script command, including comments.
Yanfly has a menu builder that require comments to be used in a html way I believe.
didn't use it, but it can go pretty much crazy if done nicely.

StoneWorks has a menu setup with it, which is really nice.
but it depends what you exactly look and want to build 🙂
JavaScript (JS) ends statements with a semicolon; line breaks are only meaningful in specific cases:
  • `Template literals` - enclosed line breaks are interpreted as the string "\n";
  • // Single-line comments - a line break ends the comment; and
  • Automatic semicolon insertion (ASI) - a line break may be treated as a semicolon at runtime.
This means you can always reduce any amount of uncommented JS to a single line. It might not look as pretty, but it is possible.

What @ShadowDragon has suggested should work. As far as I'm aware the conditional operator (condition ? ifTrue : ifFalse) has been present in JS since the release of the language: you certainly should not need to update NWJS for that!

Your specific example is actually even simpler though, because $gameSwitches.value(16) already returns true or false. That means you can write:

<Menu Visible Eval> visible = $gameSwitches.value(16); </Menu Visible Eval>
Alternatively, to make it visible only when the switch is OFF, add a ! ("not") in front:

<Menu Visible Eval> visible = !$gameSwitches.value(16); </Menu Visible Eval>

@utunnels - "comment tags" won't be executed as part of the event when it runs, unlike a Script command. However, they can still be checked by a plugin when an event changes page...or (as in this case) when the event is marked for inclusion in a menu.
I should kind of know of the value = switchas instead being longer,
but should run fine, as you can when ON, also return false first or true otherwise.

but shorter is indeed better when possible 🙂

I thought ?: was a ES6 coding operator which support in 1.6.x MV,
but also required NWJS update to be better to read it smoother.
I thought ?:was a ES6 coding operator which support in 1.6.x MV,
but also required NWJS update to be better to read it smoother.
We're you referring to ?. or ?? (Optional chaining or nullish coalescing) - that was ES11, I think?
We're you referring to ?. or ?? (Optional chaining or nullish coalescing) - that was ES11, I think?
to the condition ? true : false and I use ?? in some of my plugins to shorten though.
as ?? is more liable than the || that can give false positive results 🙂

but ?? require MV 1.6.x, and MZ uses it far more by authors as its cleaner as well.
I think you are confused. The ternary operator ?: was there as long as I know JavaScript.
There are some new operators in MZ(nw 0.48.4), like ||= operator.

something.a = something.a || 0
can be written like
something.a ||= 0
there is an example I think, but comments if it has 6 lines and it must
be per comment on eval, you can do it this way:
Code:
<Menu Visible Eval>
if ($gameSwitches.value(16)) {
visible = true } else { visible = false
}
</Menu Visible Eval>

// or try (for later nwjs (0.48.4+))

<Menu Visible Eval>
visible = $gameSwitches.value(16) ? true : false
</Menu Visible Eval>
Works perfectly, thank you!
to the condition ? true : false and I use ?? in some of my plugins to shorten though.
as ?? is more liable than the || that can give false positive results 🙂

but ?? require MV 1.6.x, and MZ uses it far more by authors as its cleaner as well.
You need to watch with ?? if you do mobile deployments as it crashes some Android models; we ended up having to remove it from our plugins.
You need to watch with ?? if you do mobile deployments as it crashes some Android models; we ended up having to remove it from our plugins.
I do not deploy to on mobile, so I'm good, but otherwise, it can be a mobile check.
I didn't know android could crash on it though.
I do not deploy to on mobile, so I'm good, but otherwise, it can be a mobile check.
I didn't know android could crash on it though.
Yeah, it's fine if you don't. Unfortunately, that's not the case with my project.

The thing with doing it as a mobile check is that you still have to do it the old way if it's not mobile anyway, and at that point you're losing the efficiency it provided in the first place, so we decided to just go back to the old way of doing it.
The thing with doing it as a mobile check is that you still have to do it the old way if it's not mobile anyway, and at that point you're losing the efficiency it provided in the first place, so we decided to just go back to the old way of doing it.
Is there another way (better, more efficient, easier to read, etc.) to do this?
JavaScript:
let value;
const result = value ?? 10;
I had to change it to:
JavaScript:
let value;
const result = value == null ? 10 : value;
Is there another way (better, more efficient, easier to read, etc.) to do this?
JavaScript:
let value;
const result = value ?? 10;
I had to change it to:
JavaScript:
let value;
const result = value == null ? 10 : value;
You could use !value in place of value == null if you don't need it to support the value 0. Other than that, the only other way of writing it isn't really any better, per se.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-extend-the-amount-of-lines-available-in-a-comment.175986/