MV How can I make this card system work using Yanfly's lunatic code?

I'll try to keep this one short, but I'm currently working on a sideproject of mine where I'm trying to emulate... well Kingdom Hearts: Chain of Memories's card system via skills, but the code isn't working, I think because I need to clearly define what skill is it, but I have absolutely no idea how to. And don't worry, I only intend to use this skill for only one actor.

(also by personal request is there some sort of way i could have insert the code into custom cost display without using variables???)
Code:
<Uses:3>
<MaxUses:3>

<cost display eval>
$gameVariables.setValue(19, skill.meta.uses);
$gameVariables.setValue(20, skill.meta.maxuses);
</cost display eval>

<custom cost display>
\v[19]/\v[20]
</custom cost display>

<custom requirement>
if skill.meta.Uses == 0 {
   value = false;
} else {
   value = true;
}
</custom requirement>

<custom execution>
if skill.meta.Uses >= 0 {
   skill.meta.Uses = skill.meta.Uses - 1
}
</custom execution>

<setup action>
eval: BattleManager.addText(user.name() + " strikes " + target.name() + " with his bat!", 0)
immortal: targets,true
</setup action>

<target action>
action animation
wait for animation
action effect: target
death break
</target action>

<finish action>
immortal: targets,false
clear battle log
wait for effect
</finish action>

EDIT:
Right! My sincere apologies, I was in a rush when typing this, but since I got more time as of typing this, I'll gladly provide much more information.

So the issue isn't that it bricks my game or anything like that, but the custom cost display simply doesn't work (it becomes 0/0, instead of 10/10), which it turns breaks anything else involving the Uses (aka the skill still works but the uses doesn't). I'm betting its something with the "skill finding", it's a bit difficult to properly explain, but I think I need a piece of code that pulls the skill out of the database with all of information. Once I can do that then I can easily create a "reload" skill (for the record, it refills all of your current cards you've equipped).

Here's the breakdown of the code:
First, the skill has two metadata variables, called Uses and MaxUses, they represent how many "cards" of that skills you have.
Whenever the you use the skill, the amount of uses drop down by one, until it reaches zero, which in that case it's not useable anymore... unless its forced by events, that is how it opposed to go... but it doesn't work.
The custom cost display is how the game shows how many cards that the player have... this is one of the parts where it has its actual issue, it simply doesn't work.

All the other code (target action, finish action, etc.) isn't important to the issue itself, it's just formatted that it doesn't waste any time getting to the actual attack.
I always feel bad when I see a thread with no replies after a few days, because I know it sucks when I'm hoping for help.

But this is an example of a post that's really hard to respond to. You don't give any information except the huge block of code. And pretty much no one is going to read through your code, simultaneously figuring out what it's doing and trying to guess what it's supposed to do.

You don't say what you want the code to do (you compare it to another game, but I'd bet most people on this forum have not played Kingdom Hearts: Chain of Memories).
You also don't say what's wrong with it - you say "the code isn't working." What part of it isn't working? Does something happen, but not what you want? Does it fail to do anything? Does the game crash? Does the console show an error? Does it turn your computer into a monkey?

If you provide some more useful details, you may get more responses.
I always feel bad when I see a thread with no replies after a few days, because I know it sucks when I'm hoping for help.

But this is an example of a post that's really hard to respond to. You don't give any information except the huge block of code. And pretty much no one is going to read through your code, simultaneously figuring out what it's doing and trying to guess what it's supposed to do.

You don't say what you want the code to do (you compare it to another game, but I'd bet most people on this forum have not played Kingdom Hearts: Chain of Memories).
You also don't say what's wrong with it - you say "the code isn't working." What part of it isn't working? Does something happen, but not what you want? Does it fail to do anything? Does the game crash? Does the console show an error? Does it turn your computer into a monkey?

If you provide some more useful details, you may get more responses.
Right! My sincere apologies, I was in a rush when typing this, but since I got more time as of typing this, I'll gladly provide much more information.

So the issue isn't that it bricks my game or anything like that, but the custom cost display simply doesn't work (it becomes 0/0, instead of 10/10), which it turns breaks anything else involving the Uses (aka the skill still works but the uses doesn't). I'm betting its something with the "skill finding", it's a bit difficult to properly explain, but I think I need a piece of code that pulls the skill out of the database with all of information. Once I can do that then I can easily create a "reload" skill (for the record, it refills all of your current cards you've equipped).

Here's the breakdown of the code:
First, the skill has two metadata variables, called Uses and MaxUses, they represent how many "cards" of that skills you have.
Whenever the you use the skill, the amount of uses drop down by one, until it reaches zero, which in that case it's not useable anymore... unless its forced by events, that is how it opposed to go... but it doesn't work.
The custom cost display is how the game shows how many cards that the player have... this is one of the parts where it has its actual issue, it simply doesn't work.

All the other code (target action, finish action, etc.) isn't important to the issue itself, it's just formatted that it doesn't waste any time getting to the actual attack.

also bump
So the issue isn't that it bricks my game or anything like that, but the custom cost display simply doesn't work (it becomes 0/0, instead of 10/10)
So here are the things that I think are problems...
<cost display eval>
$gameVariables.setValue(19, skill.meta.uses);
$gameVariables.setValue(20, skill.meta.maxuses);
</cost display eval>
There are two things that I think are wrong. One, your use (here and repeatedly elsewhere) of "skill". I don't see anything in the documentation for Yanfly's Skill Core that says you can use skill to refer to the skill being used. Rather, it would be this

However, the second thing wrong is that meta data is not stored in the Game_ classes. It's only stored in the Data_ classes. So try:
Code:
<Cost Display Eval>
$gameVariables.setValue(19, $dataSkills[ID].meta.uses);
$gameVariables.setValue(20, $dataSkills[ID].meta.maxuses);
</Cost Display Eval>
where ID is the ID of this skill.

Also, regarding some other parts of your code - because the meta data is stored in the Data_ classes, it can't be edited during the game (so the places where you say something like meta.uses-1) - it's not a variable you can manipulate. You must read the meta data, store it into one of the game's variables, then manipulate it from there.

This also alters some of how you approach it. For example, there's really no point in you having two notetags for uses and maxuses - you would just refer to the uses you specify in the notetag as your maximum, then use the variable in-game as your counter for current uses.

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-make-this-card-system-work-using-yanflys-lunatic-code.139947/