[Solved] Remove item by variable? (script call question)

Hi, there! 🙂 I have two issues with script calls and I was hoping someone might be able to lend me a hand. It feels like I'm missing something really simple here...

(1) When using "select item" the item's id is stored in variable #12 and I would like to have a script call automatically remove the item with the id stored in that variable. Here is what I tried (along with many variations of this):

 


Code:
$gameParty.loseItem($dataItems[$gameVariables[12]], 1);

 

It didn't crash or anything...just didn't work. 🙁

 

 

(2) I tried to also have a script call within a conditional branch check variable values between numbers and that didn't seem to work either. For example:

 

Code:
$gameVariables[12] >= 35 && $gameVariables[12] <= 40;

 

This one isn't super urgent or anything, I just wanted to make the events look a little cleaner. 🙂 I'm thinking that I may just be calling MV scripts wrong or something, because I remember using script calls like these just fine on Ace...

 

 

Thank you guys for your consideration! Also, I hope I posted this in the right section. :x
#1 - I actually *just* did something like that the other day. Here's what I used (negative "gain" worked fine so I went with it. LoseItem also works):

$gameParty.gainItem($dataItems[$gameVariables.value(6)], -1);

In your code you used brackets around the value, and didn't use .value.

#2 - Again, brackets, and you need .value:

$gameVariables.value(var) == 1 && $gameVariables.value(var) == 3;
Ohhh! I wasn't aware that I needed to add ".value" and the parentheses. Both of those worked perfectly!! Thank you so, so much!! ^__^
No problem! You can click the "mark solved" button on my post so it'll show up on the thread list.

Original thread: https://forums.rpgmakerweb.com/threads/solved-remove-item-by-variable-script-call-question.53481/