RMMV A Different YEP_X_EquipRequirements Question...

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,846
Reaction score
1,598
First Language
English
Primarily Uses
RMMV
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...?
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
3,163
Reaction score
1,169
First Language
Dutch
Primarily Uses
RMMV
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 :).
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,846
Reaction score
1,598
First Language
English
Primarily Uses
RMMV
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?)
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
3,163
Reaction score
1,169
First Language
Dutch
Primarily Uses
RMMV
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.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,846
Reaction score
1,598
First Language
English
Primarily Uses
RMMV
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.
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
3,163
Reaction score
1,169
First Language
Dutch
Primarily Uses
RMMV
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
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,846
Reaction score
1,598
First Language
English
Primarily Uses
RMMV
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.
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
3,163
Reaction score
1,169
First Language
Dutch
Primarily Uses
RMMV
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.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,226
Reaction score
1,633
First Language
EN
Primarily Uses
RMMZ
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. :kaophew:

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:
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
3,163
Reaction score
1,169
First Language
Dutch
Primarily Uses
RMMV
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 :D.
Nice explaination @caethyril =)

I hope it works for you too @Frostorm =)
Good luck on your project if it does worked.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,846
Reaction score
1,598
First Language
English
Primarily Uses
RMMV
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... :p
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...
 
Last edited:

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,226
Reaction score
1,633
First Language
EN
Primarily Uses
RMMZ
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. :kaoswt:

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! :kaojoy:
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
3,163
Reaction score
1,169
First Language
Dutch
Primarily Uses
RMMV
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 :D
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,226
Reaction score
1,633
First Language
EN
Primarily Uses
RMMZ
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. :kaophew:
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,846
Reaction score
1,598
First Language
English
Primarily Uses
RMMV
@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

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,226
Reaction score
1,633
First Language
EN
Primarily Uses
RMMZ
@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?
:kaohi: You can use them in a string like any other character, yes. Example:
JavaScript:
var someText = '“Ugh,” he grumbled, “where’re my keys hiding?”'
 

Latest Threads

Latest Posts

Latest Profile Posts

I turned 17 two months ago and I feel like I've grown (personality-wise) more in this 1 year than all the 16 years I had lived combined.
Ugh, I may have been cumbersomely eventing a bunch of stuff I could have easily done changing the tileset "Passage (4 dir)" and "Ladder" options. Oops :D
I have no idea why some of the program "splash screen" always on top. E.g, RMMZ loading screen stuck on the top blocking anything I want to do until it fully loaded. What is even the purpose?
One of the secret places in the game.
Had a dream last night that I died -- what a way to start the weekend! :'D

Forum statistics

Threads
107,639
Messages
1,031,070
Members
139,760
Latest member
MEATLOAFMAN
Top