YEP Item Core Question

So, I'm looking for a way to have an item display a certain text before use (i.e. This item has unknown effects). Once you use the item, you discover the effects and a new text shows when you select the item (i.e. This item heals you). Or... I'm OK with the item just having NEW text added after a certain switch/variable is triggered.

I'm using Yanfly's Item Core, and it looks like (maybe) you can do this through the Info Text notetags found under lunatic mode. They add some lore/additional text in the right window either at the top or bottom. However; there's another notetag right at the bottom called InfoEval (I'd post the code, but I'm not sure if I'm allowed to do this...)

Basically--it looks like you assign a variable ID and can use the notetag to run some code before displaying any new info. Do you know if this means you can basically ADD text to the item description at some point during the game? If so... I'm not quite sure where this notetag goes and how to activate it. My question: I'm not sure what "Variable Value" is... it's defaulted to 500 in the notetag example.

Any help would be great. Thanks 🙂
You can do this. You will also need Yanfly's Skill Core plugin to do so.

Add this in the item's notebox:

<After Eval>
if (!item._isUsed) item._isUsed = true;
</After Eval>

<Info Eval>
var varId = VariableID; // The variable ID to store the text
var notUsed = 'description if not used'; // The item description if not used
var ifUsed = 'description after used'; // The item description after it is used

if (item._isUsed) {
$gameVariables.setValue(varId, ifUsed);
} else {
$gameVariables.setValue(varId, notUsed);
}

<Info Text Top>
\v[VariableID]; // The variable ID you used before
</Info Text Top>

Replace the text in red with the appropriate stuff.

So, an example would be:

Code:
<After Eval>
if (!item._isUsed) item._isUsed = true;
</After Eval>

<Info Eval>
var varId = 2; // The variable ID to store the text
var notUsed = 'You have not used this item yet!'; // The item description if not used
var ifUsed = 'You have used this item!'; // The item description after it is used

if (item._isUsed) {
$gameVariables.setValue(varId, ifUsed);
} else {
$gameVariables.setValue(varId, notUsed);
}

<Info Text Top>
\v[2]; // The variable ID you used before
</Info Text Top>

You will need a different variable for each item you want to make this way.
You can do this. You will also need Yanfly's Skill Core plugin to do so.

Add this in the item's notebox:

<After Eval>
if (!item._isUsed) item._isUsed = true;
</After Eval>

<Info Eval>
var varId = VariableID; // The variable ID to store the text
var notUsed = 'description if not used'; // The item description if not used
var ifUsed = 'description after used'; // The item description after it is used

if (item._isUsed) {
$gameVariables.setValue(varId, ifUsed);
} else {
$gameVariables.setValue(varId, notUsed);
}

<Info Text Top>
\v[VariableID]; // The variable ID you used before
</Info Text Top>

Replace the text in red with the appropriate stuff.

So, an example would be:

Code:
<After Eval>
if (!item._isUsed) item._isUsed = true;
</After Eval>

<Info Eval>
var varId = 2; // The variable ID to store the text
var notUsed = 'You have not used this item yet!'; // The item description if not used
var ifUsed = 'You have used this item!'; // The item description after it is used

if (item._isUsed) {
$gameVariables.setValue(varId, ifUsed);
} else {
$gameVariables.setValue(varId, notUsed);
}

<Info Text Top>
\v[2]; // The variable ID you used before
</Info Text Top>

You will need a different variable for each item you want to make this way.

You are AMAZING 🙂 That's exactly what I was looking to do. Thanks for posting the code and making it so easy to understand and add into my game. Thanks again for your help!

*UPDATE* This works great, but the only issue I'm having is the text that you place between the parenthesis. For some reason it isn't wrapping in the text box. If you type too much, it gets cut off. I tried ENTER after the part the text gets cut off, hoping it would start on the next line down... but that's causing an error and the Developer Tool box populates.

Not sure why... because when I type that code in and keep the text on the same line... no error but the text gets cut off. When I space the text down a line... it errors. I'm guessing you can't break the code by moving it down to the next line... so any idea how you wrap the text in the text box?
You can manually add line breaks by using \n in the text (Don't add spaces before or after it as it will add a space in the text). So, it'll look something like this:

var ifUsed = 'This is the first line.\nThis is the second line.\nI am the third line!';

If you want it to look a bit more readable for yourself (the effect will be the same) and sort of know what you're doing, you can type it in multiple lines as such:

var ifUsed = 'This is the first line';
ifUsed = ifUsed + '\n' + 'This is the second line';
ifUsed = ifUsed + '\n' + 'I am the third line';

Also, I forgot to close the <Info Eval> in the first post. It worked this time, but you should remember to close them out to avoid future problems. So put a </Info Eval> before the <Info Text Top> line.
You can manually add line breaks by using \n in the text (Don't add spaces before or after it as it will add a space in the text). So, it'll look something like this:

var ifUsed = 'This is the first line.\nThis is the second line.\nI am the third line!';

If you want it to look a bit more readable for yourself (the effect will be the same) and sort of know what you're doing, you can type it in multiple lines as such:

var ifUsed = 'This is the first line';
ifUsed = ifUsed + '\n' + 'This is the second line';
ifUsed = ifUsed + '\n' + 'I am the third line';

Also, I forgot to close the <Info Eval> in the first post. It worked this time, but you should remember to close them out to avoid future problems. So put a </Info Eval> before the <Info Text Top> line.

Can't believe I forgot about the text control characters. Yes, this worked great. I also closed out the Info Eval.

Last question... and this is just me being picky. I'm OK if there's no way to do this, but other control character's don't work in the text. I like to color coordinate my text, but for some reason \C[13] isn't working or any other color... or \{ or \}. When I type in the control character code, it actually shows up with the backslash and C [13].

Again--at this point it's me just being picky. I'm OK with how it is, but was wondering if maybe I'm overlooking something?

This is my last question. Thanks again for your help!
That's because those are escape characters and are only converted when inputting the text directly. However, since we're inputting the text here using a variable, these codes unfortunately are not converted. \n works because it's a built in js code and not an escape character.

So to my knowledge, escape codes won't work here. I'm not sure if it's possible, but even if it is, I don't know how :rsad:.
That's because those are escape characters and are only converted when inputting the text directly. However, since we're inputting the text here using a variable, these codes unfortunately are not converted. \n works because it's a built in js code and not an escape character.

So to my knowledge, escape codes won't work here. I'm not sure if it's possible, but even if it is, I don't know how :rsad:.

That's fine. I got exactly what I wanted. Not a big deal.

Thanks again for your help. Really do appreciate it 🙂

Original thread: https://forums.rpgmakerweb.com/threads/yep-item-core-question.81896/