Checking item cost and other things

Hi, semi-lurker here.
For a while I've been struggling to make a small bargain system where in battle you could use a "tribute" skill to trade any item and depending on it's value, the enemy would abort battle and leave you alone. However, for that I'd need to check the price of the items, as well as if the party has any (regular) items in the first place and so far I've found no way to actually check those values.
😅

Are there any script calls or the likes to check those two values? Don't really want to abandon this game mechanic.
The data of items are stored in three arrays, these are:
$dataItems
$dataWeapons
$dataArmors

The price of let's say, item 5, is stored in $dataItems[5].price

The [5] is the item ID, so if it is armor 11 it would be $dataArmors[11].price

So if you want to do a conditional branch you can do it with that variable with the regular checks. Like $dataItems[5].price < 100

You can also set a game variable to an items price by using Control Variables, the operand Script and simply entering $dataItems[5].price

I'm guessing you're asking how to check if the party has any regular items at all, correct me if I'm wrong.
Then this returns true if the party has items in the inventory: Object.keys($gameParty._items).length > 0

Maybe this helps 🤘
Ah! Thanks, $dataItems[var].price did work. 😮‍💨

Also yeh, that's what I mean. But the code didn't work. :v
I need it specifically to be regular items, and regular items only because the skill still shows up when I have any other item with me. (though I am also using Yanfly's Skillcore so its most likely me just not understanding how to use the plugin)
That's odd, Object.keys($gameParty._items).length > 0 works for me, and it's for regular items. Are you using it in a conditional branch?
I'm assuming you mean regular items as in the selection between regular item/hidden item/key item etc. If so you could use something like this:

Code:
$gameParty.items().filter(function(item) {return item.itypeId === 1}).length > 0
@ozubon I am using scripts inside a notetag.

@Silva Thanks, that worked! And yeah I did mean that.

Original thread: https://forums.rpgmakerweb.com/threads/checking-item-cost-and-other-things.119695/