MV A Different YEP_X_EquipRequirements Question...

I noticed there was already a thread regarding this plugin, but my question is totally different from @Pootscooter's. I repurposed the Equip Requirements page (where it usually lists the requirements for equipping the item) into an item description page. The example given by Yanfly is this:
JavaScript:
  <Custom Equip Requirement Text>
   text = user.name() + ' has used this sword since young!\n';
   text += 'This is another line for the text!'
  </Custom Equip Requirement Text>
However, I don't know how to use apostrophes since ' is used for the starting/ending of text. So how would I write words like "don't", "won't", "couldn't", etc...?
I think you need backlash for it first like 'won\'t '
but I can recheck that because I have it in my MC plugin 🙂

Edit:
I was right: sample = 'Don\'t use '.MoreCodes 🙂.
I think you need backlash for it first like 'won\'t '
but I can recheck that because I have it in my MC plugin 🙂

Edit:
I was right: sample = 'Don\'t use '.MoreCodes 🙂.
Thank you! Also, does anyone know how to change the text color? Escape codes don't work, at least not normally (maybe there's a different syntax?)
if used in notetag, it should work, in case it doesn't,try TSR_TextColorAddon and
see if it will work (no garantees for notebox though.

there might be a way though, but not sure how to make it work inside those.
if used in notetag, it should work, in case it doesn't,try TSR_TextColorAddon and
see if it will work (no garantees for notebox though.

there might be a way though, but not sure how to make it work inside those.
Well, it's basically a javascript eval right? So I'm assuming it has to be in JS syntax. I've tried adding this.changeTextColor(this.systemColor()); right above/before the line of text I want changed, but it didn't do anything... I guess I'll try the plugin you linked.
this is in the helpfile:

"If you plan on using text codes, \i[4] would appear as \\i[4]."

won't it work if you do \\c[3]text here\c[0] (default) and with TSR_TextColorAddon \c?
TSR = optional by than
Well, the stuff in the <Custom Equip Requirement Text> notetag isn't normal text. It's actually JS evaluated into a string. So it's totally different than the text in message windows, help windows, etc...

I'm gonna use that plugin anyway for other stuff since it's so cool lol, so thx for that. However, for the JS text, I think only a Javascript solution will do.
similair like:

let blue = [word1, word2, word3]
let text = "description line here"
let text += "desc line 2"
for (i in blue; and some more)
the color become blue for those words?

I'm not exacly how to do tht though, but maybe a workaround like this
should work otherwise in my opinion.

while I dont know code exacly used and only know the plugin by name (while I got all)
if not new ones are added, I can check only, but while my equip scene is very specific,
this one doesn't work by than or will break it.

but I hope you figure it out or someone with knowledge on this plugin for colors.
I know it is possible, but not exacly sure how they did it though or I could break it
to see how it's done.

the only thing I know is that it does work, but not sure how too.
Also, does anyone know how to change the text color? Escape codes don't work, at least not normally (maybe there's a different syntax?)
JavaScript uses backslashes for its own escape notation, so to actually use a backslash in text, e.g. as part of an RPG Maker text code, then like ShadowDragon said: you need to use \\ instead. Example:
  • "It's so \\C[4]colourful\\C[0]!"
If that doesn't work here, then the text might be being passed in after the engine converts its backslashes to \x1b (a control character often reserved for this purpose). In that case you could try something like this instead:
  • 'Has anyone seen my \x1bC[12]colours\x1bC[0]?'
For example, if you want to store a text code in a game variable then you have to use \x1b: the backslashes in the message get replaced, then the variable value is substituted, so that value has to have had its backslashes "pre-replaced" to be recognised as a text code. 😮‍💨

Also, a quick note: JavaScript has various string delimiters including 'single quotes', "double quotes", and `back ticks`. The first two are identical, and can be used to avoid having to escape single-/double-quotes within particular strings. Back-ticks were introduced in ES6, thus will not be compatible with older versions of RMMV's editor, but they offer some extra features; more info here:
I knew \x1b where used for android users or older part of MV, but I didn't know
it cold be used for colors as well like though.

I learn always something else every day 🙂 sometimes it's complicated 😀.
Nice explaination @caethyril =)

I hope it works for you too @Frostorm =)
Good luck on your project if it does worked.
JavaScript uses backslashes for its own escape notation, so to actually use a backslash in text, e.g. as part of an RPG Maker text code, then like ShadowDragon said: you need to use \\ instead. Example:
  • "It's so \\C[4]colourful\\C[0]!"
THANK YOU! It works... 😛
1606864820943.png


It's so bizarre though, cuz I know I tried \\C[x] before (one of the 1st things I tried)...weird how it works when I copy-pasted it, but not when I typed it. I can only assume I made a typo when I tried it last time.

Edit: Ok, I found out why it didn't work the 1st time I tried. It was because I used apostrophes instead of quotations to start/end the text. Yanfly's example uses apostrophes, so I just followed the same format. I had no idea that the double-backslash escape codes only work if you use quotations instead of apostrophes...weird...
Edit: Ok, I found out why it didn't work the 1st time I tried. It was because I used apostrophes instead of quotations to start/end the text. Yanfly's example uses apostrophes, so I just followed the same format. I had no idea that the double-backslash escape codes only work if you use quotations instead of apostrophes...weird...
That's incorrect: as I mentioned, 'single' and "double" quotes work identically in pure JavaScript. 😅

My guess is that the example you copied, perhaps due to automatic site formatting, had:
  • Opening/closing quotes: ‘ & ’ or “ & ”
  • ...rather than 'neutral' ones: ' or "
The first have no special use in JavaScript and will not [currently] be recognised by a JS compiler, e.g.
JavaScript:
var myString = 'this is a string';
var myError = ‘this is not a string’;
Awkwardly, some fonts make the difference between the two difficult to distinguish. If in doubt, I recommend using a code editor (e.g. Visual Studio Code) with JS syntax highlighting: this will help to spot errors~

Regardless, good to hear you've got it working! 😂
that was something I didn't notice too of the opening and closed, don't they
the same buttons as "those" or purely font you use?

if it's the same button, than it can be hard to use, and fast ignored or spot them.
ty for that error as well 😀
that was something I didn't notice too of the opening and closed, don't they
the same buttons as "those" or purely font you use?
They are different characters with different ASCII codes:
  • " and ' are ASCII 34 and 39 respectively;
  • ‘ ’ “ ” are ASCII 145, 146, 147, 148.
I've never seen a keyboard with open or close quote buttons, but some text editors may automatically replace the "neutral" quotes for open/close ones. E.g. MS Word has an on/off autocorrect setting something like this:
  • Replace as you type > "Straight quotes" with “smart quotes”
This also applies to websites, particularly blogs: they might do similar automatic replacements. Code blocks are, amongst other things, designed to avoid this kind of auto-formatting. 😮‍💨
@caethyril Ah, that explains a lot! So doesn't this mean that we can use left/right quotations w/o needing to put a \ before it?
@caethyril Ah, that explains a lot! So doesn't this mean that we can use left/right quotations w/o needing to put a \ before it?
👋 You can use them in a string like any other character, yes. Example:
JavaScript:
var someText = '“Ugh,” he grumbled, “where’re my keys hiding?”'

Original thread: https://forums.rpgmakerweb.com/threads/a-different-yep_x_equiprequirements-question.130461/