MV If statements and conditions in Actor Note Box

Hi can you add an if statement to an Actor Note Box? like if switch id 33 is on run code <whateverecodehere> i have searched and the closest i found was finding this below...

xSmwb4.jpg


will this work in an actor note? any advice or help would be appreciated.

Spoiler: what i tried
i put
Code:
if ($gameSwitches.value(348)) {
<runthiscode>
}
There is no error shown but the script just runs and ignores the if statement it seems?

EDIT 2: made my first github! if you can help give examples from this or get a better idea or what im trying to do. Download project zip
In theory, I guess you could eval() the actor's note contents.
JavaScript:
eval($dataActors._data[1].note)
In theory, I guess you could eval() the actor's note contents.
JavaScript:
eval($dataActors._data[1].note)
how would i use that in the example above to possibly make the code only work when a switch is on? i already have a plugin in the note i just need one of them to run when specified.

Code:
if ($gameSwitches.value(348)) {
<bsShadowSource:50,100,0,0,0,0,0>
}

<AFS Leader>
<Passive State: 350>
<gender:m>
<level up event: 132>
<VICTORY ACTION TYPE: exp>
<VICTORY ACTION EFFECT>
this.DXVACommonEvent("58");
</VICTORY ACTION EFFECT>

<materia slots>
       Head: 0:0:0:0, type armor
         Left Hand: 0=0:0=0, type armor, growth 2
</materia slots>

<command picture: 'Actor1_1'>

<equip slot: 1>
<equip slot: 2>
<equip slot: 3>
<equip slot: 4>
<equip slot: 5>
<equip slot: 6>

<Cannot Change Class>
<Starting JP: 500>
<tpChange: 10>
<techtree>
Summoner
</techtree>
<EQS Max Slots 1 Level 1 to 99: 1>
<EQS Max Slots 2 Level 1 to 99: 1>
<EQS Max Slots 3 Level 1 to 99: 1>
<EQS Max Slots 4 Level 1 to 99: 1>
<EQS Max Slots 5 Level 1 to 99: 1>
<EQS Max Slots 6 Level 1 to 99: 1>

  <Status Menu Page: Origin>\n[1] is originally from Maikocity his mother was born in Maiko
city and not much is known about his father at the moment.
  </Status Menu Page: Origin>
how would i use that in the example above to possibly make the code only work when a switch is on? i already have a plugin in the note i just need one of them to run when specified.

Code:
if ($gameSwitches.value(348)) {
<bsShadowSource:50,100,0,0,0,0,0>
}
That is something I believe that would have to be coded into (or a patch written) for the plugin your using.

What plugin is the plugin in question?
... I (or someone here) might be able to make a quick patch for you
Hi can you add an if statement to an Actor Note Box?
This question is based on a misunderstanding of RPG Maker MV. The note box is exactly that - for taking notes. It does not run code, anything you type in there is just text.

Through the use of plugins you can cause things in there to become code, but that must always be delineated by a notetag defined by the plugin. Just typing code into any note box will do nothing.

So you need to decide and describe exactly when you want this code to run and what it should be doing. For example, with no further information, your example (if this switch is on, do this) would be achieved by creating a common event that has a trigger of that switch.
By "just text" ATT_Turan means it's all a string. I don't believe they've ever documented it's use yet in the help file but the note box doubles as meta data.
You can retrieve the contents of the entire box using .note method, but also individual <tags> can be read with .meta.nameoftag as if it were html or css. Which is technically code, just not strictly javascript.

Using a switch as a condition, you'd just be changing the <bsShadowSource> tag from null to "50,100,0,0,0,0,0"
I assume it's placement in the Actor's Note Box is by design of someone else script.
I also assume it's reading it using .meta.bsShadowSource
but I wouldn't be surprised if someone was parsing the notebox for tags.

Anyway, rather than putting an if statement in the notebox itself, I would just add the if statement to the script that needs to read the tag.

if (switch on) { return blahblah.meta.bsShadowSource} else { return null};
By "just text" ATT_Turan means it's all a string. I don't believe they've ever documented it's use yet in the help file but the note box doubles as meta data.
You can retrieve the contents of the entire box using .note method, but also individual <tags> can be read with .meta.nameoftag as if it were html or css. Which is technically code, just not strictly javascript.

Using a switch as a condition, you'd just be changing the <bsShadowSource> tag from null to "50,100,0,0,0,0,0"
I assume it's placement in the Actor's Note Box is by design of someone else script.
I also assume it's reading it using .meta.bsShadowSource
but I wouldn't be surprised if someone was parsing the notebox for tags.

Anyway, rather than putting an if statement in the notebox itself, I would just add the if statement to the script that needs to read the tag.

if (switch on) { return blahblah.meta.bsShadowSource} else { return null};
Interestingly, the only reason the devs added the meta property to notes is because of the way script developers for the RGSS-based makers used the notebox. It was never intended to be used for notetags and a method of injecting code, but because that use case was realised and taken advantage of, they leaned into it and made it a semi-official thing.
Thankyou all for the ideas. i am trying to edit what i need with fails . if anyone wants to implement their idea or help figure this out please do i set up a github project . thanks!

Original thread: https://forums.rpgmakerweb.com/threads/if-statements-and-conditions-in-actor-note-box.146100/