MV YEP Item Durability syntax for repairing equipment types?

After lots of headache with figuring out how to repair equipment to a variable, changing around how I handle it via common events, I finally figured out that I could've just put
Code:
<Custom Repair Effect>
item.durability += $gameVariables.value(32);
</Custom Repair Effect>
in the repair item's notetags. Waaaay easier than conditional branches checking the variable in an event. Only problem with that code is that it can repair items waaay past their max durability.

So, I need help making the repair effect only repair specific equipment types per repair kit - light armors, heavy weapons, etc. The notetag for that seems to be
Code:
<Repair WType x: y>
<Repair AType x: y>
but I'm having trouble figuring out the syntax for the custom repair effect checking the weapon/armor type in the repair kit item?

Basically I want a Light Armor Kit to repair only Light Armor types by adding variable 32 to the armor's durability and stopping at the item's Max Durability. And then I can switch it around for Heavy Armors and then get to making weapon repair kits for the different weapon types.
Also on a side note while I'm asking, if I want the Light Armor Kit to repair light armors by variable 32 + variable 22 also how would I put that math function in code?
Can I suggest you use one thread for all of your questions related to a topic? You have three threads about doing stuff with Item Durability, not to mention your posts on Maliki's thread and some poor freaking 5-year old thread.

It's impossible for other people to keep track of what you know or have been told.

This particular post is confusing because you're asking about two different things as if they have something to do with each other. Determining the armor type has nothing to do with limiting the repair to the max durability.

1:
The item's max durability is stored in the durMax property. So you'd do:
Code:
item.durability = Math.min(item.durability + $gameVariables.value(32), item.durMax);

2:
Have you Googled it? Or looked at the pinned thread with MV script calls? The type is the atypeId property. So you'd do
Code:
if (item.atypeId == X)
    item.durability = Math.min(item.durability + $gameVariables.value(32), item.durMax);

3:
I don't really understand the question. Code math is generally not different from math math.
Code:
$gameVariables.value(32) + $gameVariables.value(22)
Didn't know dedicating a thread to my questions revolving around this specific thing was a thing, next time I ask about this plugin I'll just leave the thread title open ended and have individual questions as posts if that works, sorry

And yeah I google everything I ask, only making a thread after I can't find an answer or run out of ideas with trial and error attempts, but all I could find is that ancient thread I necroposted in - which I probably should've read the forum rules about how old threads can be before theyre not supposed to be bumped. Thats my bad on that one.

And as far as math math if I wanted to have more complex mathematics with order of operations would parenthesis work like below or would the syntax be better without?
Code:
<Custom Repair Effect>
item.durability += $gameVariables.value(32) + 123 * $gameVariables.value(32);
</Custom Repair Effect>

<Custom Repair Effect>
item.durability += ($gameVariables.value(32) + (123 * $gameVariables.value(22));
</Custom Repair Effect>

Edit: also thank you so much for the code help
double edit: holy cow I forgot about This thread for damage formulas, I'll use that as a resource too so I quit bogging up the forum lol
There's no difference between the two, order of operations states multiplication happens before addition.

(well, there's a difference because the first one references variable 32 twice and the second one uses 32 and 22, but there's no difference in the math)

Also, the second one has an extraneous set of parentheses around the entire thing, which doesn't mean anything.
the first one references variable 32 twice
Whoopsies, typo my bad.

But thanks that clears up a lot!

Actually now I have another question regarding this code:
Code:
if (item.atypeId == 3)
    item.durability = Math.min(item.durability + $gameVariables.value(32), item.durMax);

It repairs armors of 'Type 3' the way I need it to, but how would I put an else statement that would prevent me from using an incompatible repair kit?
I want to repair Light Armor with light kits, but it lets me repair them with heavy armor kits - consuming the kit but doing no repair whatsoever because its not the right armor type in the code. It seems like its running the code but not having a workaround for if the condition is not met.
I'm guess weapon types are under wtypeId, but I have the same issue with those because of the lack of an else statement.

EDIT: I changed the repair kits to NOT be consumed and tried this so that it just consume the specific kit if successful and do essentially nothing else if the wrong kit was used.
Tried it with a weapon kit like so
Code:
<Custom Repair Effect>
if (item.wtypeId == 3)
    item.durability = Math.min(item.durability + $gameVariables.value(32), item.durMax);
    $gameParty.loseItem(151, 1);
</Custom Repair Effect>

But it doesnt remove the weapon repair kit, item 151. Weapon type 3 gets repaired but the kit is still there even though I tried making the code remove the item when the code is run.
So yeah, same problem essentially. The wrong kits can be 'used' but nothing happens - and with the new code I tried even the right kits dont get 'used' lol
When you want more than one thing to happen because of a conditional, you need to create a code block with braces.

Code:
if (item.wtypeId == 3)
{
    item.durability = Math.min(item.durability + $gameVariables.value(32), item.durMax);
    $gameParty.loseItem(151, 1);
}
When you want more than one thing to happen because of a conditional, you need to create a code block with braces.

Code:
if (item.wtypeId == 3)
{
    item.durability = Math.min(item.durability + $gameVariables.value(32), item.durMax);
    $gameParty.loseItem(151, 1);
}
Good to know! But its still not removing the item.

Tried using $gameParty.loseItem($dataItems[151], 1) and it works - removing the repair kit every time it is used. Only issue now is that I can use repair kits when the item is fully repaired already.
Is there a way to 'grey out' the item like how normal durability repairing items are greyed out and unable to be used when the item is already at max durability?
Because the loseItem() method takes a BaseItem object, not a number.
Code:
$dataItems[151]
Because the loseItem() method takes a BaseItem object, not a number.
Code:
$dataItems[151]
huh. I removed the 1 quantity from the code and it removed ALL the items lol
good to know, that might come in handy later. Still need to find a way to grey out the repair kit when the item is at max durability, though.
I removed the 1 quantity from the code and it removed ALL the items lol
...no one told you to do that?

Still need to find a way to grey out the repair kit when the item is at max durability, though.
The plugin does not appear to offer a way to determine a target item's eligibility. I suspect you'd have to commission someone to write an extension for you.

Original thread: https://forums.rpgmakerweb.com/threads/yep-item-durability-syntax-for-repairing-equipment-types.164675/